Re: [SQL] Good Optimization

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: secret <secret(at)kearneydev(dot)com>
Cc: PG-SQL <pgsql-sql(at)postgreSQL(dot)org>, John Ridout <johnridout(at)ctasystems(dot)co(dot)uk>
Subject: Re: [SQL] Good Optimization
Date: 1999-07-07 15:42:37
Message-ID: 26200.931362157@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

secret <secret(at)kearneydev(dot)com> writes:
> There is a simple way to optimize SQL queries involving joins to
> PostgreSQL that I think should be handled by Postgre? If one is joining
> a tables a,b on attribute "x" and if one has something like x=3 then it
> helps A LOT to say: a.x=3 and b.x=3 in addition to saying a.x=b.x ...
> The example below shoulds the radical speed gain of doing this, and I
> think it isn't something real obvious to most people...

How much *actual* speedup is there? I don't trust the optimizer's
numbers as anything more than relative measures ;-)

I'm a bit surprised that you are getting a nested-loop plan and not
a merge or hash join. With a merge join, at least, there ought not be
a large difference from providing the additional qual clause (I think).
What Postgres version are you using?

regards, tom lane

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 1999-07-07 15:44:58 Re: [SQL] Good Optimization
Previous Message Roderick A. Anderson 1999-07-07 15:22:31 Re: [SQL] Good Optimization