pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Keith Gray <keith@heart.com.au>
To: Masaru Sugawara <rk73@sea.plala.or.jp>
Cc: Alvar Freude <alvar@a-blast.org>
Cc: pgsql-sql@postgresql.org
Subject: Re: 2 Selects 1 is faster, why?
Date: Fri, 28 Jun 2002 09:40:46 +1000
Message-ID: <3D1BA27E.9000802@heart.com.au> (raw)
References: <afag3c$kce$1@news.hub.org>
	<1371510000.1025105687@gnarzelwicht.delirium-arts.de>
	<20020627234531.7ECB.RK73@sea.plala.or.jp>

Masaru Sugawara wrote:

> 
>  You are right. And this type of optimising are not yet implemented.
>  Tom said it in the prior discussions. 
> 

...but is it true that if you place the filter clause first,
the join will not have to complete the whole table?

eg.

SELECT item.description, stock.available
FROM item, stock
WHERE item.itemid = '1234'
AND item.itemid=stock.itemid;

...would be more efficient than,

SELECT item.description, stock.available
FROM item, stock
WHERE item.itemid=stock.itemid
AND item.itemid = '1234';


-- 
Keith Gray

Technical Services Manager
Heart Consulting Services P/L
mailto:keith@heart.com.au






view thread (5+ messages)  latest in thread

Message-ID: <3D1BA27E.9000802@heart.com.au>
Permalink:  ../3D1BA27E.9000802@heart.com.au/
Also on:    postgresql.org/message-id/3D1BA27E.9000802@heart.com.au

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: keith@heart.com.au, rk73@sea.plala.or.jp, alvar@a-blast.org
  Subject: Re: 2 Selects 1 is faster, why?
  In-Reply-To: <3D1BA27E.9000802@heart.com.au>

* 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