From: Michael Olivier <molivier@yahoo.com>
To: Herouth Maoz <herouth@oumail.openu.ac.il>
To: pgsql-sql postgresql.org <pgsql-sql@postgreSQL.org>
Subject: Re: [SQL] optimizing 2-table join w/millions of rows
Date: Sun, 22 Nov 1998 19:05:14 -0800 (PST)
Message-ID: <19981123030514.15338.rocketmail@send106.yahoomail.com> (raw)
---Herouth Maoz <herouth@oumail.openu.ac.il> wrote:
>
> At 4:26 +0200 on 20/11/98, Michael Olivier wrote:
>
>
> >
> > select U.acctname from usertest U, bgndtest B where
> > B.part_needed=3 and B.loc_needed=5 and
> > B.acctname=U.acctname and U.acctname in
> > (select acctname from usertest where part=2 and loc=3)
>
> Can you explain *verbally* what you meant to do here? It seems as if
the
> subselect is redundant.
It's not redundant, but an attempt to optimize the overall query
performance by using a subquery. What this does is compare two users
parameters against each other: "find all users who need part 3 and
need loc 5 and who have part 2 and loc 3"
> How about:
>
> SELECT U.acctname
> FROM usertest U, bgndtest B
> WHERE B.acctname = U.acctname
> AND B.part_needed=3 AND B.loc_needed=5
> AND U.part=2 AND U.loc=3;
Yes, that looks equivalent. My problem is this is too slow an
operation as I'm benchmarking it right now. And if I add less-than or
greater-than comparisons, the performance goes _way_ down from there.
How can I get the best performance out of this kind of operation?
Is there any way to force postgres to hold certain tables in memory
all the time? As I said, cost of memory isn't an issue, but
performance is.
thanks,
Michael
_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com
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-sql@postgresql.org
Cc: molivier@yahoo.com, herouth@oumail.openu.ac.il
Subject: Re: [SQL] optimizing 2-table join w/millions of rows
In-Reply-To: <19981123030514.15338.rocketmail@send106.yahoomail.com>
References: <19981123030514.15338.rocketmail@send106.yahoomail.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