Oscar F
Oscar F

Reputation: 323

SQL Design: Is it wise to have a table for current orders and one with all orders for historical purposes?

I'm thinking my table is going to get huge as days go by and more orders come in. Should I keep all orders in that same table forever or should I have a table for current orders and one for previous/finished orders since the current orders are the only ones that will be grabbed frequently?

Upvotes: 0

Views: 30

Answers (1)

Mihir Shah
Mihir Shah

Reputation: 988

If you keep separate table for previous/finished orders then when required you need to apply conditional joins or union.

according to me, rather than that, add one attribute say

(
     ...
     ...
     IsArchived       Bit
)

which is set to 0 (false) for current/latest order and 1 (true) for finished/previous orders, which will be faster than conditional joins or union at later on.

Upvotes: 1

Related Questions