Re: [SQL] How to get last 10 rows in a table on a large database?
В списке pgsql-sql по дате отправления:
| От | Tom Lane |
|---|---|
| Тема | Re: [SQL] How to get last 10 rows in a table on a large database? |
| Дата | |
| Msg-id | 2549.941912218@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Re: [SQL] How to get last 10 rows in a table on a large database? (Stoyan Genov <genov@digsys.bg>) |
| Ответы |
Move forward all (Was Re: How to get last 10 rows in a table on a
large database?)
|
| Список | pgsql-sql |
Stoyan Genov <genov@digsys.bg> writes:
> You are unable to say:
> begin transaction;
> declare tbl_cur cursor for .... .....
> move forward all in tbl_cur;
> fetch backward 10 in tbl_cur;
> ...........
> end transaction;
> because when you "move forward all" the result gets lost.
Huh? It seems to work fine for me.
However, the "move" is a tad slow since the silly thing actually scans
over all the tuples in index order :-(. This might not be a useful
solution for Alex's problem after all, because of the time taken by
the "move".
regards, tom lane
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера