Re: select count(*) and limit
От | Verena Ruff |
---|---|
Тема | Re: select count(*) and limit |
Дата | |
Msg-id | 446C969E.60109@triosolutions.at обсуждение исходный текст |
Ответ на | Re: select count(*) and limit (Oscar Rodriguez Fonseca <info@vraniscci.com>) |
Список | pgsql-novice |
Oscar Rodriguez Fonseca schrieb: > TABLE IN DB: > > > number_times | user_name | last_login > ---------------------------------------- > 1 | Paul | 11-12-2005 > 4 | Mary | 08-11-2005 > 5 | Charles | 01-02-2005 > > [...] > > SELECT count(*) AS number_times,NULL AS user_name,NULL as last_login \ > FROM table UNION ALL SELECT * FROM table LIMIT 2; > > This has the practical drawback that you need an integer column in your > table to get the query working as expected and the design drawback that > it is a little bit weird and somewhat non-standard way of querying. > I think this is a little bit to weired. It should be possible for another person what I am doing without explaing such a lot. > BTW, I had a similar problem and solved it storing the full result list > in a temporal variable on the server but "session-wise" (when the user > opens another unrelated page, the application frees the variable). This > is possible in my case because my app won't have more than 10 clients > at once and therefore it don't represent much memory overhead This is possible if there are only little users and only a few hundred records. I have only few users, too, but some tenthousonds records and I don't think it would be a good idea storing them completly in the servers memory. Regards, Verena
В списке pgsql-novice по дате отправления: