Re: Query optimization problem
От | Robert Haas |
---|---|
Тема | Re: Query optimization problem |
Дата | |
Msg-id | AANLkTi=UTjEsnjcfz=C2kkf65ufq7-6+fQ97yMKeMWyk@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Query optimization problem (Yeb Havinga <yebhavinga@gmail.com>) |
Ответы |
Re: Query optimization problem
|
Список | pgsql-hackers |
On Wed, Jul 28, 2010 at 7:24 AM, Yeb Havinga <yebhavinga@gmail.com> wrote: >>> Sorry? I though what Equivalence Class provides is the "proving" that >>> using this qualification or another will *not* affect the output. >> >> In a query like... >> >> SELECT d1.ID, d2.ID >> FROM DocPrimary d1 >> JOIN DocPrimary d2 ON d2.BasedOn=d1.ID >> WHERE (d1.ID=234409763) or (d2.ID=234409763) >> >> ...you're going to scan d1, scan d2, and then join the results. The >> scan of d1 is going to produce different results depending on whether >> you evaluate or not d1.ID=234409763, and the scan of d2 is going to >> produce different results depending on whether or not you evaluate >> d2.BasedOn=234409763. > > Wouldn't it be relatively easy, to rewrite the filter expression by adding > expressions, instead of replacing constants, in the disjunctive case, so the > example at hand would become: > > WHERE (d1.ID=234409763) or (d2.ID=234409763) > AND (d2.BasedOnID=234409763) or (d2.ID=234409763) Yeah, that could be done, but it's not necessarily a win from a performance standpoint. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise Postgres Company
В списке pgsql-hackers по дате отправления: