pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Quick question
2+ messages / 2 participants
[nested] [flat]

* Quick question
@ 2003-09-09 03:02  Josh Berkus <josh@agliodbs.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Josh Berkus @ 2003-09-09 03:02 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-performance

Tom,

Back in the 7.0 days, 

WHERE EXISTS (SELECT * FROM a WHERE condition)

was significantly slower on broad tables than

WHERE EXISTS (SELECT small_col FROM a WHERE condition)

Is this still true, or something that's been fixed in the last 3 versions?  
Joe Celko is making fun of me because Oracle doesn't have this performance 
issue.

-- 
Josh Berkus
Aglio Database Solutions
San Francisco



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Quick question
@ 2003-09-09 03:14  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Josh Berkus <josh@agliodbs.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2003-09-09 03:14 UTC (permalink / raw)
  To: Josh Berkus <josh@agliodbs.com>; +Cc: pgsql-performance

Josh Berkus <josh@agliodbs.com> writes:
> Back in the 7.0 days, 
> WHERE EXISTS (SELECT * FROM a WHERE condition)
> was significantly slower on broad tables than
> WHERE EXISTS (SELECT small_col FROM a WHERE condition)
> Is this still true, or something that's been fixed in the last 3 versions?  

It's still true that all the sub-select's output columns will be
evaluated.  Given that this happens for at most one row, I'm not sure
how significant the hit really is.  But it's annoying, seeing that the
outer EXISTS doesn't care what the column values are.

> Joe Celko is making fun of me because Oracle doesn't have this performance 
> issue.

Perhaps Joe can tell us exactly which part of SQL92 says it's okay not
to evaluate side-effect-producing functions in the targetlist of an
EXISTS subselect.

I would like to make the system change the targetlist to just "SELECT 1"
in an EXISTS subquery.  But I'm slightly concerned about changing the
semantics of existing queries.  If someone can produce proof that this
is allowed (or even better, required) by the SQL spec, it'd be easier...

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2003-09-09 03:14 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-09-09 03:02 Quick question Josh Berkus <josh@agliodbs.com>
2003-09-09 03:14 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox