Re: partitioned table and ORDER BY indexed_field DESC LIMIT 1

From: "Luke Lonergan" <llonergan(at)greenplum(dot)com>
To: "Gregory Stark" <stark(at)enterprisedb(dot)com>, "Mark Kirkwood" <markir(at)paradise(dot)net(dot)nz>
Cc: "Heikki Linnakangas" <heikki(at)enterprisedb(dot)com>, "Anton" <anton200(at)gmail(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: partitioned table and ORDER BY indexed_field DESC LIMIT 1
Date: 2007-11-08 06:40:20
Message-ID: C357EF54.44FA2%llonergan@greenplum.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On 11/7/07 10:21 PM, "Gregory Stark" <stark(at)enterprisedb(dot)com> wrote:

>> part=# explain SELECT * FROM n_traf ORDER BY date_time LIMIT 1;
>> QUERY PLAN
>> -----------------------------------------------------------------------------
>> --------------------------------------------------------------------
>> Limit (cost=198367.14..198367.15 rows=1 width=20)
>> -> Sort (cost=198367.14..200870.92 rows=1001510 width=20)
>> Sort Key: public.n_traf.date_time
>> -> Result (cost=0.00..57464.92 rows=1001510 width=20)
>> -> Append (cost=0.00..57464.92 rows=1001510 width=20)
>> -> Index Scan using n_traf_date_time_login_id on n_traf
>> (cost=0.00..66.90 rows=1510 width=20)
>
> That looks suspicious. There's likely no good reason to be using the index
> scan unless it avoids the sort node above the Append node. That's what I hope
> to do by having the Append executor code do what's necessary to maintain the
> order.

Yah - the way it works in GPDB is that you get a non-sorting plan with an
index scan below the parent - that was the point of the fix. Hmm.

- Luke

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Mark Kirkwood 2007-11-08 07:18:47 Re: partitioned table and ORDER BY indexed_field DESC LIMIT 1
Previous Message Gregory Stark 2007-11-08 06:21:10 Re: partitioned table and ORDER BY indexed_field DESC LIMIT 1