From: Jérome Knöbl <jknobl@mandanet.ch>
To: pgsql-sql@hub.org
Subject: Prolem wiht long query?
Date: Wed, 14 Jul 1999 14:31:09 +0000
Message-ID: <378C9F2D.495FB4A0@mandanet.ch> (raw)
Hi,
I have some trouble with a very long query.
This Query run well :
----------------
select *
from
adresses, liaison_adresse_rubrique as lar0,
liaison_adresse_rubrique as lar1,
liaison_adresse_rubrique as lar2
where
lar0.refadresse=adresses.ref
and lar0.refrubrique=73
and lar1.refadresse=adresses.ref
and lar1.refrubrique=151
and lar2.refadresse=adresses.ref
and lar2.refrubrique=170
This Query take a lot of time :
-----------------------
select *
from
adresses, liaison_adresse_rubrique as lar0,
liaison_adresse_rubrique as lar1,
liaison_adresse_rubrique as lar2,
liaison_adresse_rubrique as lar3,
liaison_adresse_rubrique as lar4
where
lar0.refadresse=adresses.ref
and lar0.refrubrique=73
and lar1.refadresse=adresses.ref
and lar1.refrubrique=150
and lar2.refadresse=adresses.ref
and lar2.refrubrique=160
and lar3.refadresse=adresses.ref
and lar3.refrubrique=151
and lar4.refadresse=adresses.ref
and lar4.refrubrique=170
This Query never finish, and take all my memory (and I have 384Mb)
---------------------------------------------------
select *
from
adresses, liaison_adresse_rubrique as lar0,
liaison_adresse_rubrique as lar1,
liaison_adresse_rubrique as lar2,
liaison_adresse_rubrique as lar3,
liaison_adresse_rubrique as lar4,
liaison_adresse_rubrique as lar5,
liaison_adresse_rubrique as lar6
where
lar0.refadresse=adresses.ref
and lar0.refrubrique=73
and lar1.refadresse=adresses.ref
and lar1.refrubrique=148
and lar2.refadresse=adresses.ref
and lar2.refrubrique=153
and lar3.refadresse=adresses.ref
and lar3.refrubrique=150
and lar4.refadresse=adresses.ref
and lar4.refrubrique=160
and lar5.refadresse=adresses.ref
and lar5.refrubrique=151
and lar6.refadresse=adresses.ref
and lar6.refrubrique=170
Every think is index using hash table.
Is it a limitation of pg?
Do you know another method to do that?
Is it exist an intersect operator in pg (like in oracle)?
Jérome knobl, Lausanne, Switzerland
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: jknobl@mandanet.ch, pgsql-sql@hub.org
Subject: Re: Prolem wiht long query?
In-Reply-To: <378C9F2D.495FB4A0@mandanet.ch>
References: <378C9F2D.495FB4A0@mandanet.ch>
* 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