Re: Using indexes for ORDER BY and PARTITION BY clause in windowing functions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Sameer Kumar <sameer(dot)kumar(at)ashnik(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Using indexes for ORDER BY and PARTITION BY clause in windowing functions
Date: 2013-10-23 14:58:09
Message-ID: 28218.1382540289@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Sameer Kumar <sameer(dot)kumar(at)ashnik(dot)com> writes:
> I am not sure why but my PostgreSQL does not seem to be using indexes for
> ORDER BY clause or PARTITION BY CLAUSE which I use with windowing function.

When the entire contents of the table have to be read, a seqscan-and-sort
will frequently be estimated as cheaper than an indexscan. If you think
this is not true on your hardware, you might need to adjust
random_page_cost.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2013-10-23 15:02:26 Re: Sigh, my old HPUX box is totally broken by DSM patch
Previous Message Tom Lane 2013-10-23 14:51:26 Re: Sigh, my old HPUX box is totally broken by DSM patch