Partitioned table question - Mailing list pgsql-general

From Torsten Förtsch
Subject Partitioned table question
Date
Msg-id 528360F3.6010906@gmx.net
Whole thread Raw
Responses Re: Partitioned table question
Re: Partitioned table question
List pgsql-general
Hi,

we have a table partitioned by time. Each month goes into a separate
child table. Primary key in each table is (underlying, ts). The
resulting index is perfect for ordering like in the query below. Each
child table has a constraint like:

  CHECK(ts>= '2011-1-1' and ts<'2011-1-1'::DATE + interval '1 month')

Now, we have queries of this type:

SELECT * FROM tick
 WHERE underlying = 'R_50' AND ts <= '2013-05-02'
 ORDER BY ts DESC LIMIT 100

The query plan for this is at http://explain.depesz.com/s/fB6

According to this plan it fetches all the result tuples from tick_2013_4
which is fine because tick_2013_5 obviously does not contain matches.

My question is, why does it then try to fetch one row from every other
index? Can that be avoided without a lower bound on ts?

Thanks,
Torsten


pgsql-general by date:

Previous
From: Chris Travers
Date:
Subject: select ... inherits?
Next
From: Alexander Farber
Date:
Subject: Can't find /var/lib/pgsql/9.3/data/global/pg_auth