pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Gnanavel S <s.gnanavel@gmail.com>
To: karim.nassar@acm.org
Cc: pgsql-performance@postgresql.org
Subject: Re: Two queries are better than one?
Date: Fri, 29 Jul 2005 10:08:49 +0530
Message-ID: <eec3b03c05072821386a068a13@mail.gmail.com> (raw)
In-Reply-To: <1122610899.11862.63.camel@localhost.localdomain>
References: <1122591866.11860.11.camel@localhost.localdomain>
	<eec3b03c050728211116bafdab@mail.gmail.com>
	<1122610899.11862.63.camel@localhost.localdomain>

On 7/29/05, Karim Nassar <karim.nassar@acm.org> wrote:
> 
> On Fri, 2005-07-29 at 09:41 +0530, Gnanavel S wrote:
> 
> >
> > Joined:
> >
> > test=> explain analyze
> > test-> SELECT cli_name,order.*
> > test-> FROM order
> > test-> JOIN client ON (ord_client = cli_code)
> > test-> WHERE ord_batch='343B' AND
> > ord_id='12-645';
> >
> > where is the cli_code condition in the above query?
> 
> I don't understand the question. ord_client is the client code, and
> cli_code is the client code, for their respective tables. batch/id is
> unique, so there is only one record from order, and only one client to
> associate.
> 
> Clearer?


ok.

Reason might be comparing with a literal value (previous case) is cheaper 
than comparing with column(as it has to be evaluated). But with the previous 
case getting and assigning the cli_code in the application and executing in 
db will be time consuming as it includes IPC cost.

--
> Karim Nassar <karim.nassar@acm.org>
> 
> 


-- 
with regards,
S.Gnanavel
Satyam Computer Services Ltd.

view thread (7+ messages)

Message-ID: <eec3b03c05072821386a068a13@mail.gmail.com>
Permalink:  ../eec3b03c05072821386a068a13@mail.gmail.com/
Also on:    postgresql.org/message-id/eec3b03c05072821386a068a13@mail.gmail.com

 · 

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-performance@postgresql.org
  Cc: s.gnanavel@gmail.com, karim.nassar@acm.org
  Subject: Re: Two queries are better than one?
  In-Reply-To: <eec3b03c05072821386a068a13@mail.gmail.com>

* 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