Re: Optimization idea - Mailing list pgsql-performance

From Cédric Villemain
Subject Re: Optimization idea
Date
Msg-id g2ge94e14cd1004290121rc061f11eo6bbe402634e03227@mail.gmail.com
Whole thread Raw
In response to Re: Optimization idea  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-performance
2010/4/29 Robert Haas <robertmhaas@gmail.com>:
> On Wed, Apr 28, 2010 at 5:37 AM, Vlad Arkhipov <arhipov@dc.baikal.ru> wrote:
>> Even if it will be done it does not solve the original issue. If I
>> understood you right there is now no any decent way of speeding up the query
>>
>> select *
>> from t2
>> join t1 on t1.t = t2.t
>> where t1.id = X;
>>
>> except of the propagating the t1.id value to the table t2 and createing and
>> index for this column?
>
> No, what I'm saying is that if X is any ANY() expression, you can get
> a faster plan in this case by writing:
>
> SELECT * FROM t2 JOIN t1 ON t1.t = t2.t WHERE t2.id = X;

SELECT * FROM t2 JOIN t1 ON t1.t = t2.t WHERE t2.t = X;

side note : You might want/need to improve statistics in the column
t2.t (in situation/distribution like this one)

>
> For me this is about 8x faster.
>
> ...Robert
>



--
Cédric Villemain

pgsql-performance by date:

Previous
From: Robert Haas
Date:
Subject: Re: Optimization idea
Next
From: Josh Berkus
Date:
Subject: Re: autovacuum strategy / parameters