pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: twanger@smartvia.de
To: tgl@sss.pgh.pa.us
Cc: pgsql-admin@postgresql.org
Subject: Re: simpler query significantly slower
Date: Mon, 21 May 2001 17:04:48 +0200 (MET DST)
Message-ID: <-1393202712.990457642148.JavaMail.root@mouse.unimessage.net> (raw)
In-Reply-To: <25232.990455860@sss.pgh.pa.us>

> twanger@smartvia.de writes:
> > 	select 
> > 		distinct
> > 		gruppen_produkte.produktgruppen_id 
> > 	from 
> > 		r_gruppen_produkte 
> > 	where 
> > 		r_gruppen_produkte.gruppen_id = gruppen.
> gruppen_id 			// this and the next cond are 
> removed in 2nd query
> > 	and 
> > 		gruppen.parent_id=1 
> > 	and 
> > 		r_gruppen_produkte.gruppen_id = 
> r_personen_bereiche.g_id 
> > 	and 
> > 		r_personen_bereiche.p_id = 1234
> This SQL seems rather seriously confused.  It 
> looks to me like you will
> get back one copy of each distinct 
> produktgruppen_id value appearing in
> gruppen_produkte.  Since no gruppen_produkte 
> field is constrained by
> WHERE, none will be eliminated.  All that the 
> rest of the query does is
> cause a completely useless Cartesian-product 
> join against some subset
> of r_gruppen_produkte * gruppen * 
> r_personen_bereiche.
> Possibly you meant to select from 
> r_gruppen_produkte.
> BTW, PG 7.1 would have complained about the 
> lack of FROM entries for
> gruppen_produkte, gruppen, and 
> r_personen_bereiche, which might have
> clued you to your error ...
> 			regards, tom lane

Yeah sorry, you are right, but the typo is only in my posting. The query does actually query r_gruppen_produkte.



view thread (3+ messages)

Message-ID: <-1393202712.990457642148.JavaMail.root@mouse.unimessage.net>
Permalink:  ../-1393202712.990457642148.JavaMail.root@mouse.unimessage.net/
Also on:    postgresql.org/message-id/-1393202712.990457642148.JavaMail.root@mouse.unimessage.net

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: twanger@smartvia.de, tgl@sss.pgh.pa.us
  Subject: Re: simpler query significantly slower
  In-Reply-To: <-1393202712.990457642148.JavaMail.root@mouse.unimessage.net>
  References: <25232.990455860@sss.pgh.pa.us> <-1393202712.990457642148.JavaMail.root@mouse.unimessage.net>

* 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