I have a database of automobile classified listings.
After 90 days, the classified listing is no longer valid to be displayed (the listing expires); however, I want to retain the listing for archive purposes.
Question: From a database design best practice perspective as well as query performance, is it better to keep the old listing A) in the same table as the current listing or B), move the expired listing over to an expired table and delete that listing from the current listing table?
In other words,
Option A):
table_classified_listing:
car_id
expired = true | false
...
Option B):
// only current listing in this table (expired = false)
table_classified_listing:
car_id
...
// only expired listing in this table (expired = true)
expired_table_classified_listing:
car_id
...
UPDATE:
My concern with Option A, is that in my MySQL database - when I run EXPLAIN
, it say that it's using the expired
as the primary key to index on. However, what's more important to my query search performance is for it to use the price
field since I'm doing a search based on the price > X
. Hence why I'm considering to chose option B.