From: | Gnanavel S <s(dot)gnanavel(at)gmail(dot)com> |
---|---|
To: | karim(dot)nassar(at)acm(dot)org |
Cc: | pgsql-performance(at)postgresql(dot)org |
Subject: | Re: Two queries are better than one? |
Date: | 2005-07-29 04:38:49 |
Message-ID: | eec3b03c05072821386a068a13@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
On 7/29/05, Karim Nassar <karim(dot)nassar(at)acm(dot)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(dot)nassar(at)acm(dot)org>
>
>
--
with regards,
S.Gnanavel
Satyam Computer Services Ltd.
From | Date | Subject | |
---|---|---|---|
Next Message | Matthew Schumacher | 2005-07-29 05:10:07 | Re: Performance problems testing with Spamassassin 3.1.0 |
Previous Message | Neil Conway | 2005-07-29 04:26:29 | Re: Left joining against two empty tables makes a query |