Re: partitioned table and ORDER BY indexed_field DESC LIMIT 1

From: Tomas Tamosaitis <tomas(dot)tamosaitis(at)connecty(dot)lt>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: partitioned table and ORDER BY indexed_field DESC LIMIT 1
Date: 2007-08-27 12:57:29
Message-ID: 1188219449.8210.4.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-performance

Pn, 2007 08 24 14:53 +0600, Anton rašė:
> Hi.
>
> I just created partitioned table, n_traf, sliced by month
> (n_traf_y2007m01, n_traf_y2007m02... and so on, see below). They are
> indexed by 'date_time' column.
> Then I populate it (last value have date 2007-08-...) and do VACUUM
> ANALYZE ON n_traf_y2007... all of it.
>
> Now I try to select latest value (ORDER BY date_time LIMIT 1), but
> Postgres produced the ugly plan:
>
> =# explain SELECT * FROM n_traf ORDER BY date_time DESC LIMIT 1;
> QUERY PL

can you test performance and send explain results of select like this :
select * from n_traf where date_time = (select max(date_time) from
n_traf);

i have similar problem with ~70M rows table (then using ordering), but
my table not partitioned.
I`m interesting how this select will works on partitioned table.

--
Pagarbiai,
Tomas Tamošaitis
Projektų Vadovas
Connecty
Skype://mazgis1009?add
Mob: +370 652 86127
e-pastas: tomas(dot)tamosaitis(at)connecty(dot)lt
web: www.connecty.lt

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Dawid Kuroczko 2007-08-27 13:24:26 Re: LDAP service lookup
Previous Message Gregory Stark 2007-08-27 12:51:38 Problem with locks

Browse pgsql-performance by date

  From Date Subject
Next Message GOERGLER Paul 2007-08-27 13:11:57 Bitmap Heap Scan before using index
Previous Message ruben 2007-08-27 12:52:22 Re: Postgres performance problem