Re: Partial indexes instead of partitions

From: Leonardo F <m_lists(at)yahoo(dot)it>
To: Sergey Konoplev <gray(dot)ru(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Partial indexes instead of partitions
Date: 2010-06-14 09:24:55
Message-ID: 709423.97075.qm@web29004.mail.ird.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> For "inserts" I do not see the reason
> why
> it would be better to use index partitioning because AFAIK
> b-tree
> would behave exactly the same in both cases.

no, when the index gets very big inserting random values gets
very slow.

But still, my approach doesn't work because I thought Postgresql
was able to "merge" different partial indexes (using
BitmapOr/BitmapAnd) when the WHERE condition matches multiple
partial indexes... but that's (I guess) not that easy to do

(basically partial indexes condition should be checked like the
constraint of the inheritance mechanism, and Or/And Bitmapped
as happens in the "regular" partitioning method).

that is, having a table with:

CREATE TABLE test
(
a timestamp without time zone,
b integer
)

CREATE INDEX test1idx
ON test
(b)
WHERE a >= '2008-03-10 14:00:00' AND a < '2008-03-10 16:00:00';

CREATE INDEX test2idx
ON test
(b)
WHERE a >= '2008-03-10 16:00:00' AND a < '2008-03-10 18:00:00';

the select:

select * from test where a > '2008-03-10 15:00:00'
and a < '2008-03-10 17:00:00' and b = 100

should use a BitmapOr between an index scan on test1idx and test2idx...

But I think that's a complicated thing for the planner... even though
it doesn't sound that different from what the planner does for partition
pruning...

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Janning 2010-06-14 09:49:08 Re: checkpoint spikes
Previous Message Magnus Hagander 2010-06-14 08:59:18 Re: Re: Error on Windows server could not open relation base/xxx/xxx Permission denied