Re: Combining count() and row_number() as window functions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Thomas Kellerer <spam_eater(at)gmx(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Combining count() and row_number() as window functions
Date: 2017-01-19 14:20:33
Message-ID: 16982.1484835633@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thomas Kellerer <spam_eater(at)gmx(dot)net> writes:
> I assumed that the count() wouldn't increase the runtime of the query as the result of the row_number() can be used to calculate that.

No such knowledge exists in Postgres. Given our general approach in which
functions (including window functions) are black boxes, it's hard to see
how it could be done in a way that wasn't a ugly kluge.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2017-01-19 14:23:03 Re: Queries are taking way longer in 9.6 than 9.5
Previous Message Kenneth Marshall 2017-01-19 13:56:26 Re: migrate Sql Server database to PostgreSql