Re: Comments on subquery performance

From: Richard Huxton <dev(at)archonet(dot)com>
To: T- Bone <jbowen333(at)hotmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Comments on subquery performance
Date: 2005-02-17 19:15:14
Message-ID: 4214ED42.5040802@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

T- Bone wrote:
> (second attempt in two days to post this message...I appologise if for
> some reason a duplicate appears)
>
> Hello all,
>
> I created a query that contains two subqueries and joins and would like
> some feedback on whether:
> 1) this approach is logical; and,
> 2) if this is an optimal approach (performance wise) to return the
> records I seek.

Well you could just do:

SELECT
l.*, c1.catname, c2.catname, c3.catname
FROM
tbl_listing l,
tbl_categories c1,
tbl_categories c2,
tbl_categories c3
WHERE
l.catid1 = c1.catid
AND l.catid2 = c2.catid
AND l.catid3 = c3.catid

--
Richard Huxton
Archonet Ltd

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message pginfo 2005-02-18 04:53:44 Re: pg primary key bug?
Previous Message Tom Lane 2005-02-17 19:01:40 Re: pg primary key bug?