Skip site navigation (1) Skip section navigation (2)

Re: Sort and index

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Jim C(dot) Nasby" <decibel(at)decibel(dot)org>
Cc: Dave Held <dave(dot)held(at)arrayservicesgrp(dot)com>,pgsql-performance(at)postgresql(dot)org
Subject: Re: Sort and index
Date: 2005-04-23 02:08:06
Message-ID: 4269.1114222086@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-performance
"Jim C. Nasby" <decibel(at)decibel(dot)org> writes:
> I've run some performance tests. The actual test case is at
> http://stats.distributed.net/~decibel/timing.sql, and the results are at
> http://stats.distributed.net/~decibel/timing.log. In a nutshell, doing
> an index scan appears to be about 2x faster than a sequential scan and a
> sort.

... for one test case, on one platform, with a pretty strong bias to the
fully-cached state since you ran the test multiple times consecutively.

Past experience has generally been that an explicit sort is quicker,
so you'll have to pardon me for suspecting that this case may be
atypical.  Is the table nearly in order by pkey, by any chance?

> In any case, it's clear that the planner is making the wrong choice
> here. BTW, changing random_page_cost to 3 or 4 doesn't change the plan.

Feel free to propose better cost equations.

			regards, tom lane

In response to

Responses

pgsql-performance by date

Next:From: Jim C. NasbyDate: 2005-04-23 02:11:07
Subject: Re: Joel's Performance Issues WAS : Opteron vs Xeon
Previous:From: Jim C. NasbyDate: 2005-04-23 02:01:51
Subject: Re: Joel's Performance Issues WAS : Opteron vs Xeon

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group