equivalence class not working?

From: uwcssa <uwcssa(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: equivalence class not working?
Date: 2006-01-16 21:19:59
Message-ID: f2f562510601161319k4b0201a9p8d93a649780df7f1@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

not sure if this is the right place to post...

I am using postgres 8.1. In indxpath.c, it says " Note: if Postgres tried
to optimize queries by forming equivalence
classes over equi-joined attributes (i.e., if it recognized that
aqualification such as "where
a.b=c.d and a.b=5" could make use of
an index on c.d), then we could use that equivalence class info here with
joininfo_list to do more complete tests for the usability
of a partial index. ..... XXX as of 7.1, equivalence class info *is*
available."

Now i have the following two queries on TPC-H, where there is an index built
on "o_totalprice".

explain select * from lineitem, orders where o_totalprice=l_extendedprice
and l_extendedprice<2000;
explain select * from lineitem, orders where o_totalprice=l_extendedprice
and l_extendedprice<2000 and o_totalprice<2000;

The second query uses the index while the first does not. It seems to me
that both queries are the same (the "o_totalprice<2000" in the second query
can be inferred). Is there something that needs to be tuned or ...?

thanks a lot!

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-01-16 21:21:50 Re: Anyone see a need for BTItem/HashItem?
Previous Message David Fetter 2006-01-16 21:08:19 Re: Anyone see a need for BTItem/HashItem?