From: Joshua D. Drake <jd@commandprompt.com>
To: Ben <midfield@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: partitioning question 1
Date: Thu, 28 Oct 2010 10:31:32 -0700
Message-ID: <1288287092.22359.23.camel@jd-desktop> (raw)
In-Reply-To: <A9A748D8-A52F-4C16-A303-3A4AA1EC1BD2@gmail.com>
References: <A9A748D8-A52F-4C16-A303-3A4AA1EC1BD2@gmail.com>
On Thu, 2010-10-28 at 09:36 -0700, Ben wrote:
> hello --
>
> my last email was apparently too long to respond to so i'll split it up into shorter pieces. my first question :
>
> my understanding of how range partitioning and constraint exclusion works leads me to believe that it does not buy any query performance that a clustered index doesn't already give you -- the advantages are all in maintainability. an index is able to eliminate pages just as well as constraint exclusion is able to eliminate table partitions. the I/O advantages of having queries target small subtables are the same as the I/O advantages of clustering the index : result pages in a small range are very close to each other on disk.
Not entirely true. One a clustered index will not stay clustered if you
are still updating data that is in the partition. You shouldn't
underestimate the benefit of smaller relations in terms of maintenance
either.
>
> finally, since constraint exclusion isn't as flexible as indexing (i've seen old mailing list posts that say that constraint exclusion only works with static constants in where clauses, and only works with simple operators like >, < which basically forces btree indexes when i want to use gist) it is indeed likely that partitioning can be slower than one big table with a clustered index.
Yes the constraints have to be static. Not sure about the operator
question honestly.
> is my intuition completely off on this?
You may actually want to look into expression indexes, not clustered
ones.
Sincerely,
Joshua D. Drake
--
PostgreSQL.org Major Contributor
Command Prompt, Inc: http://www.commandprompt.com/ - 509.416.6579
Consulting, Training, Support, Custom Development, Engineering
http://twitter.com/cmdpromptinc | http://identi.ca/commandprompt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: jd@commandprompt.com, midfield@gmail.com
Subject: Re: partitioning question 1
In-Reply-To: <1288287092.22359.23.camel@jd-desktop>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox