From: A. Kretschmer <andreas.kretschmer@schollglas.com>
To: pgsql-performance@postgresql.org
Subject: Re: mysterious difference in speed when combining two queries with OR
Date: Wed, 23 Apr 2008 10:57:04 +0200
Message-ID: <20080423085704.GG8401@a-kretschmer.de> (raw)
In-Reply-To: <20080423075810.GB8401@a-kretschmer.de>
References: <20080423072303.GF11886@amin>
<20080423075810.GB8401@a-kretschmer.de>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: andreas.kretschmer@schollglas.com
Subject: Re: mysterious difference in speed when combining two queries with OR
In-Reply-To: <20080423085704.GG8401@a-kretschmer.de>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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