Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

Re: [PERFORM] mysterious difference in speed when combining two queries with OR

From: A. Kretschmer <andreas.kretschmer(at)schollglas.com>
Date: Wed Apr 23 2008 - 04:57:04 EDT


am Wed, dem 23.04.2008, um 9:58:10 +0200 mailte A. Kretschmer folgendes:
> > Query A (two queries)
> >
> > select distinct moment.mid from moment,timecard where parent = 45 and (pid=17 and timecard.mid = moment.mid) order by moment.mid;
> > select distinct moment.mid from moment,timecard where parent = 45 and (pbar = 0) order by moment.mid;
> >
> > Query B (combining the two with OR)
> >
> > select distinct moment.mid from moment,timecard where parent = 45 and ((pid=17 and timecard.mid = moment.mid) or (pbar = 0)) order by moment.mid;

Thanks to depesz on #postgresql (irc-channel):

Query A, the second query: there are no join between the 2 tables. Mistake?

Andreas

-- 
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   
http://wwwkeys.de.pgp.net

-- 
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance
Received on Wed Apr 23 04:58:53 2008

This archive was generated by hypermail 2.1.8 : Wed Jul 30 2008 - 19:52:17 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library