Re: Way to use count() and LIMIT?
От | Joe Koenig |
---|---|
Тема | Re: Way to use count() and LIMIT? |
Дата | |
Msg-id | 3C20A7C7.8963C04B@jwebmedia.com обсуждение исходный текст |
Ответ на | Re: Way to use count() and LIMIT? ("SHELTON,MICHAEL (Non-HP-Boise,ex1)" <michael_shelton@non.hp.com>) |
Список | pgsql-general |
That's so rediculously simple it hurts...I'm an idiot...Thank you VERY much. Joe Martijn van Oosterhout wrote: > > On Wed, Dec 19, 2001 at 08:13:50AM -0600, Joe Koenig wrote: > > This is exactly right. The table I'm searching has 220,000 records right > > now, and growing. The "Rock" category within "CD's" will return over > > 53,000 results. The count isn't so much for display, as for knowing > > whether or not to put a "next" button on the page. I don't want to > > always have next buttons, but not always have more results. There is > > currently the option to browse through results based on the first letter > > of the result, which I guess I could make as the 3rd step and not run > > the query that currently returns 53,000 results until they narrow it > > down more. I wasn't really expecting this to be possible, but PG does so > > many other things that I didn't think was possible, so I thought I'd ask :) > > But that's easy. Simply ask the database for one more record that you're > going to display. If you get that extra record, then display the next > button, otherwise don't. The count is irrelevent. > > -- > Martijn van Oosterhout <kleptog@svana.org> > http://svana.org/kleptog/ > > Terrorists can only take my life. Only my government can take my freedom.
В списке pgsql-general по дате отправления: