Page 1 of 1
lengthy query
Posted: Wed Mar 30, 2005 1:06 am
by s.dot
I have a general forum which has generated about 18,000 posts in the first 3 months. Needless to say, but this forum is going to continue to get even bigger. Eventually it's going to be .. let's say.. 100,000+ posts. Is it smart to grab all of this data from the database in one query? I don't really know how else I would do it except for using a LIMIT in my query and performing multiple queries, but in the end, wouldn't it take the same amount of time, if not longer, to do multiple queries? Or, is there really no downside to having such an extensive query? Am I worrying about it for nothing?
Posted: Wed Mar 30, 2005 1:16 am
by feyd
what lengthy query? A single query for all records in a table isn't a lengthy query, in any form I know.
Do you show all the records at the same time? If so, then a single "big" query is fine. If you are doing pagination, then use LIMIT or whatever your database supports.
Posted: Wed Mar 30, 2005 1:23 am
by s.dot
Yes, I am using pagination. Indexed to 25 per page.
So a query that grabs a couple hundred thousand entries from a database won't take a long time to execute?
Posted: Wed Mar 30, 2005 10:02 am
by feyd
that depends on your selection. Grabbing a single table is negligible, typically. Doing a larger join can take a long time. Not using indexes properly, can add a lot of time too.