Quote:
|
Now, it is my understanding that, if the database is smaller, I can complete my queries quicker
|
...based on?
unless you know you have a performance problem I wouldn't be making such decisions just yet. the only way you are going to know you have a problem is if you have already experienced such issues or have been advised by someone its a problem. I would expect that with good design your table should eb able to handle multi million rows without significant issues. there's no harm in looking at ways of designing out problems but I wouldn't split data off into an archive table unless I knew it was an issue or there was a good design reason to do (such as security / privacy)
yes you could use a flag or prefix
mind you could also index the date an article was posted and exclude results that are more than n whatevers from posting. look at the
MySQL date time functions for assitance
if you want to use a flag then use a boolean datatype. The where clause is
where myflagcolumn = somestate ' where somestate is true or false
you could call your flag column IsArchived or IsActive, and the value to use in the where clause depends on what you have called the column and what you are looking for
say it was called IsArchived so true would mean the record is no longer active, false means active
then
WHERE IsArchived = false 'for current records
OR
WHERE IsArchived = true 'for inactive records
I wouldnt' move items to another db, unless you have so many items that it swamps the server. or there is no need for the data to remain visible to all. it would be perfectly legit in my mind to shift dead records to another table after a period of time, assuming that there is no further need to see that 'stuff' adjacent to other stuff. ferinstance if you were running a an auction site
you could argue that items shouldn't be on the main auction section after a period of time, say six months. after the six month period you could prune these values from the db.