|
Re: MySQL infinity?: msg#00188php.tcphp
I'm just scared of speed optimizations for using COUNT. Right now, I am SQL_CALC_FOUND_ROWS and SELECT FOUND_ROWS() The SQL_CALC_FOUND_ROWS tells the server to store the number of rows that would have been returned had their not been any LIMIT statement. Then running FOUND_ROWS just retrieves this. The COUNT would rebuild the result set on the server side and would just not filter it for the LIMIT. Rebuilding would be kinda worthless in this case. Quoting Benjamin Holmberg <benjamin.holmberg-Re5JQEeQqe8AvxtiuMwx3w@xxxxxxxxxxxxxxxx>: > Blaine- > > Have you considered populating $total_items with the result of a query like: > select count(*) from table; > > You'd be requesting all records in the given table at the time that query > was run. Might not work so well if there are inserts occuring during its > execution. > Then again you could add several thousand to the result of that query and > would probably be fine. > > You could also just alter the query to something like: > //Limit defaults... > $start_offset = 0; > $total_items = 0; > > ... may be overriden at some point here .... > > $query = 'SELECT fields FROM table'; > if (($start_offset > 0) || ($total_items > 0)) { > $query .= ' LIMIT ' . $start_offset ', ' . $total_items; > } > > > Hope this helps. > > Regards, > Benjamin Holmberg > > On 6/16/05, Blaine Garrett <blaine-4hELYU93S8xBDgjK7y7TUQ@xxxxxxxxxxxxxxxx> > wrote: > > > > Hi, > > > > Does anyone know if mysql has a way of representing infinity. I want to > > use it > > as the default for some limit statements. > > > > example : > > > > //Limit defaults... > > $start_offset = 0; > > $total_items = 'infinity'; > > > > ... may be overriden at some point here .... > > > > $query = 'SELECT fields FROM table LIMIT ' . $start_offset ', ' . > > $total_items; > > > > Right now, I just have $total_items set to a really large number, but that > > doesn't seem overly cool. At the very least, is there a max result set > > size > > imposed by php or mysql and would there be a way to get that? > > > > Thanks, > > > > Blaine > > > > > > > > > > -- > > Blaine Garrett > > Chief Web Applications Developer > > JR Computer Associates INC > > http://jrcorps.com > > blaine-4hELYU93S8xBDgjK7y7TUQ@xxxxxxxxxxxxxxxx > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: > > talk-unsubscribe-4zcLI8jJc/rYtjvyW6yDsg@xxxxxxxxxxxxxxxx > > > > Please read and follow the list guidelines: > > http://www.tcphp.org/mailing_list/guidelines > > > > The tcphp.org <http://tcphp.org> mailing list is sponsored by pajunas > > interactive, inc. > > > > > -- Blaine Garrett Chief Web Applications Developer JR Computer Associates INC http://jrcorps.com blaine-4hELYU93S8xBDgjK7y7TUQ@xxxxxxxxxxxxxxxx --------------------------------------------------------------------- To unsubscribe, e-mail: talk-unsubscribe-4zcLI8jJc/rYtjvyW6yDsg@xxxxxxxxxxxxxxxx Please read and follow the list guidelines: http://www.tcphp.org/mailing_list/guidelines The tcphp.org mailing list is sponsored by pajunas interactive, inc. |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: MySQL infinity?: 00188, Scott Downing |
|---|---|
| Next by Date: | Re: MySQL infinity?: 00188, Blaine Garrett |
| Previous by Thread: | Re: MySQL infinity?i: 00188, Scott Downing |
| Next by Thread: | PHP linking to Outlook (Palm, etc.): 00188, mike schrenk |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |