From: | "Jonathan S(dot) Katz" <jonathan(dot)katz(at)excoventures(dot)com> |
---|---|
To: | Bert <biertie(at)gmail(dot)com> |
Cc: | pgsql-sql <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Partition tables to improve select speed? |
Date: | 2013-01-31 16:48:16 |
Message-ID: | 903E19E5-4142-48DE-8EAF-1710D9226EBF@excoventures.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Jan 31, 2013, at 4:43 AM, Bert wrote:
> Hello,
>
> We are using postgres as a datawarehouse.
> We typically use very complex queries, and they seem to work very well.
>
> We have several BIG tables. we chose to partition those tables on a specific key.
>
> We also adapted our selects, and added a 'where' clause which helps postgres's query planner, so only one of the partition needs to be used in stead of 32.
>
> How ever, we get some strange results. For some queries the runtime really is a lot faster. But for the runtime is a even a bit longer.
>
> Can anyone give me insight on why that can happen?
>
> wkr,
>
> Bert
Hi Bert,
Check out section 5.9.4 on this page: http://www.postgresql.org/docs/current/static/ddl-partitioning.html - do you have your constraint exclusion setup appropriately? If so, are your conditions extending outside of the partitions you are looking in.
Using EXPLAIN to see what query plans are being generated should shed some light into this, to see if you are indeed doing table lookups in partitions inadvertently based on your exclusion constraints.
Best,
Jonathan
From | Date | Subject | |
---|---|---|---|
Next Message | Dev Kumkar | 2013-02-05 17:12:16 | Querying multiple database |
Previous Message | Pavel Stehule | 2013-01-31 14:04:49 | Re: How to put multiples results in just one column |