View Full Version : good practice over MySQL?
a have a PHP script that takes rows from a MySQL DB, currently i have 98 rows (members on a site) but it's dramatically growing.
Is it a good idea to use in a query LIMIT -1 , 0 to output all rows?
I am asking it based on both, mysql & php performace and the conditions on my site..
thanks again ppl!
Spookster
12-12-2003, 05:51 AM
Since you are asking a MySQL related question then you probably should have posted your question in the MySQL forum and not the PHP forum.
I will move the thread there. Just make sure you post in the right forums in the future.
Originally posted by MeGa
Is it a good idea to use in a query LIMIT -1 , 0 to output all rows?
I am asking it based on both, mysql & php performace and the conditions on my site..
If you want all rows, then just don't include a LIMIT clause. Simply
select var1, var2, var3 from table
If you use limit, then you need to also order the table which will have a (small or larger, depending on sort-variable) impact on performance.
If you get a larger table, you wount wanna select all records. You'll typically do it in 'chunks' --> 1 select at a time for x records. And then LIMIT is a gift from haven. Run a search here or Google for "recordset paging mysql limit" and you'll see what i mean. Plenty of exampletutorials about that at www.hotscripts.com as well.
oh, i couldn't find the MySQL forum. next time i will make a better search..
i know what u saying raf. all this is because of a lazy interactive web site (:D)
it's something like
DISPLAY STARTING AT
20 0
now, i can edit my php in a way that won't include a limit if a special number or text is input. but, but i was just wondering if -1 , 0 would also work aswell. thanks
vBulletin® v3.8.2, Copyright ©2000-2009, Jelsoft Enterprises Ltd.