From: | Kyle Bateman <kyle(at)actarg(dot)com> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Subject: | PG 8.2beta reordering working for this case? |
Date: | 2006-10-08 01:00:44 |
Message-ID: | 45284DBC.3060901@actarg.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Kyle Bateman wrote:
> Tom Lane wrote:
>
>>
>> Before 8.2 the optimizer has no ability to rearrange the order of outer
>> joins. Do you have time to try your test case against CVS HEAD?
>>
>>
I've done some more refinement on my accounting ledger system that has
clarified some of the problems I was having with performance joining to
a union. Here's an interesting test case. I just tried it with PG
8.2beta1. I don't claim to understand the new feature of reordering
queries very well, but it seems like this is related to that feature.
Since its still a performance problem in 8.2, I thought this might be a
helpful test case during beta.
To see this demo, run create.sql on a clean database. It will create
all the needed tables, views and test data.
Then run q1 and q2 which are very efficient. Then q3 is the slow one.
The reason is, it does the union, producing 300,000 records before
trying to select by project. It seems like the optimizer should
internally rewrite the query to look more like what is in q4 (which is
very fast).
Is there a way to make the optimizer do this?
Kyle Bateman
Attachment | Content-Type | Size |
---|---|---|
create.sql | text/x-sql | 6.3 KB |
q1.sql | text/x-sql | 310 bytes |
q2.sql | text/x-sql | 290 bytes |
q3.sql | text/x-sql | 409 bytes |
q4.sql | text/x-sql | 454 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2006-10-08 17:49:31 | Re: PG 8.2beta reordering working for this case? |
Previous Message | Bruno Wolff III | 2006-10-06 18:27:26 | Re: timestamps over the web - suggestions |