Re: obtain the difference between successive rows

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: rod(at)iol(dot)ie
Cc: Chris Angelico <rosuav(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: obtain the difference between successive rows
Date: 2012-10-20 16:50:50
Message-ID: 328.1350751850@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Raymond O'Donnell" <rod(at)iol(dot)ie> writes:
> On 20/10/2012 17:23, Tom Lane wrote:
>> FWIW, Postgres is reasonably smart about the case of multiple window
>> functions with identical window definitions --- once you've got one
>> lag() in the query, adding more isn't going to cost much.

> Out of curiosity, would there be much difference between having multiple
> lag()s in the SELECT and a single one in a CTE?

Not sure what you're proposing? I don't see how you'd solve this
problem with a CTE, at least not without a join, which seems unlikely
to be a win.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Berend Tober 2012-10-20 16:56:29 Re: obtain the difference between successive rows
Previous Message Chris Angelico 2012-10-20 16:41:38 Re: obtain the difference between successive rows