Unix Technical Forum

Operator COMMUTATOR - how does postgresql use this information

This is a discussion on Operator COMMUTATOR - how does postgresql use this information within the Pgsql General forums, part of the PostgreSQL category; --> Does PostgreSQL use the COMMUTATOR property of an operator to determine if flip-flopped arguments can be collapsed. I used ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-12-2008, 02:05 AM
Obe, Regina
 
Posts: n/a
Default Operator COMMUTATOR - how does postgresql use this information

Does PostgreSQL use the COMMUTATOR property of an operator to determine
if flip-flopped arguments can be collapsed.

I used to think it did until someone pointed it doesn't - For example
in the below

SELECT b.*
FROM boszip b INNER JOIN landparcels l
ON (b.the_geom && l.the_geom AND l.the_geom && b.the_geom AND
l.the_geom && b.the_geom )
WHERE l.gid = b.gid and b.gid = l.gid
limit 1


If I look at the query plan -I see the plan has reduced things down to

l.gid = b.gid AND (b.the_geom && l.the_geom AND l.the_geom &&
b.the_geom)

Why is (b.the_geom && l.the_geom AND l.the_geom && b.the_geom) not
reduced down to just

b.the_geom && l.the_geom

even though && is defined as the commutator of &&?

Thanks,
Regina




-----------------------------------------
The substance of this message, including any attachments, may be
confidential, legally privileged and/or exempt from disclosure
pursuant to Massachusetts law. It is intended
solely for the addressee. If you received this in error, please
contact the sender and delete the material from any computer.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-12-2008, 02:05 AM
Tom Lane
 
Posts: n/a
Default Re: Operator COMMUTATOR - how does postgresql use this information

"Obe, Regina" <robe.dnd@cityofboston.gov> writes:
> Does PostgreSQL use the COMMUTATOR property of an operator to determine
> if flip-flopped arguments can be collapsed.


No. In recent releases we don't even bother to look for simple
duplicate clauses (it's seldom worth the cycles), let alone clauses that
would be duplicates after some transformation or other.

> I used to think it did until someone pointed it doesn't - For example
> in the below


> SELECT b.*
> FROM boszip b INNER JOIN landparcels l
> ON (b.the_geom && l.the_geom AND l.the_geom && b.the_geom AND
> l.the_geom && b.the_geom )
> WHERE l.gid = b.gid and b.gid = l.gid
> limit 1


> If I look at the query plan - I see the plan has reduced things down to


> l.gid = b.gid AND (b.the_geom && l.the_geom AND l.the_geom &&
> b.the_geom)


8.3 will do that (prior releases will often fail to recognize the
redundancy) but it's an outgrowth of mergejoin equivalence-class
processing. && isn't a mergejoinable equality operator so nothing much
happens to those clauses.

regards, tom lane

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:42 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com