Add a ROWCOUNT to the output of a select.

Поиск
Список
Период
Сортировка
От Gavin 'Beau' Baumanis
Тема Add a ROWCOUNT to the output of a select.
Дата
Msg-id 79F4289B-AF23-4D59-9C89-4D5B6D74706B@eclinic.com.au
обсуждение исходный текст
Ответы Re: Add a ROWCOUNT to the output of a select.
Re: Add a ROWCOUNT to the output of a select.
Re: Add a ROWCOUNT to the output of a select.
Список pgsql-sql
Hi Everyone,

After spending some time searching through our good friend Mr. Google  
and the mailing list I found a post that provided me with a query that  
does just what I need.

However, the query takes FOREVER and although this is stated in the  
original mail I thought I would ask if there was any advice that you  
might be able to provide to speed things up a little.

And while the query does return over 27,000 rows in my case, I didn't  
expect it to take 9 minutes and 11 seconds!

Please find the query below - and of course - thanks in advance for  
any assistance you might be able to provide me with!

select    (select         count(*)     from         myTable as myCount     where         myCount.contactdate <=
myTable.contactdate   ) as rownum,    contactdate
 
from    myTable
where    contactdate > '2007-06-30 23:59:59'
order by    contactdate;


-Gavin


В списке pgsql-sql по дате отправления:

Предыдущее
От: "Mag Gam"
Дата:
Сообщение: Re: Auto-formatting timestamps?
Следующее
От: "Gurjeet Singh"
Дата:
Сообщение: Re: Add a ROWCOUNT to the output of a select.