From: | Alexander Farber <alexander(dot)farber(at)gmail(dot)com> |
---|---|
To: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Slow query: select * order by XXX desc offset 10 limit 10 |
Date: | 2011-10-14 09:36:50 |
Message-ID: | CAADeyWg4-E3yFkZh5Yes7hJ=_sN+_KffjTRmpiLaRv8NfwLQjA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Thank you -
On Fri, Oct 14, 2011 at 11:30 AM, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
> you should to use a DECLARE statement
> http://www.postgresql.org/docs/9.1/interactive/sql-declare.html
> and fetch statement
> http://www.postgresql.org/docs/9.1/interactive/sql-fetch.html
I've managed to create a cursor
and can fetch the data row by row:
quincy=> start TRANSACTION;
quincy=> declare XXX cursor for select to_char(qdatetime,
'YYYY-MM-DD') as
QDATETIME,ID,NAME,CATEGORY,APPSVERSION,OSVERSION,DETAILS,DEVINFO from
quincyview where qdatetime <= now() order by QDATETIME desc ;
quincy=> fetch XXX;
.....
quincy=> fetch XXX;
.....
But how do I "go back"?
For my jQuery HTML table (DataTables.net)
I need to be able to go back and forth.
Regards
Alex
From | Date | Subject | |
---|---|---|---|
Next Message | Pavel Stehule | 2011-10-14 09:40:14 | Re: Slow query: select * order by XXX desc offset 10 limit 10 |
Previous Message | Pavel Stehule | 2011-10-14 09:30:37 | Re: Slow query: select * order by XXX desc offset 10 limit 10 |