pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Steven Lane <stevelcmc@mindspring.com>
To: pgsql-admin@postgresql.org
Subject: RE: High memory usage
Date: Wed, 20 Jun 2001 23:09:28 -0500
Message-ID: <v03007801b75723f4f2f3@[65.15.153.184]> (raw)

>Date: Wed, 20 Jun 2001 23:06:56 -0500
>To: "Rainer Mager" <rmager@vgkk.com>
>From: Steven Lane <stevelcmc@mindspring.com>
>Subject: RE: High memory usage
>Cc: pgsql-admin@postgresql.orgl
>Bcc:
>X-Attachments:
>
>>Hi,
>>
>>	Hmm, I'm not sure I understand how I could use EXISTS in my query.
>>Can you
>>give me an example?
>>
>>Thanks,
>>
>>--Rainer
>>
>
>>> I hope this is not a massively stupid response, but creating a new
>>> self-join condition for each additional criterion seems a rather expensive
>>> approach. Can this be done more quickly using multiple EXISTS
>>> conditions to
>>> check for each of the specified criteria?
>>>
>>> -- sgl
>>>
>>>
>
>Something like
>
>SELECT DISTINCT product.product_id FROM product p
>WHERE
>EXISTS ( SELECT pr_prop_str.pr_property_id FROM pr_prop_str prs
>                  WHERE p.product_id = prs.product_id
>                  AND prs.pr_property_id = 147 AND prs.str = '3E362cb' )
>AND
>EXISTS ( SELECT pr_prop_str.pr_property_id FROM pr_prop_str prs
>                  WHERE p.product_id = prs.product_id
>                  AND prs.pr_property_id = 18 AND prs.str BETWEEN
>'000999999'  AND '004999999' )
>AND
>EXISTS ( SELECT pr_prop_str.pr_property_id FROM pr_prop_str prs
>                  WHERE p.product_id = prs.product_id
>                  AND prs.pr_property_id = 51 AND prs.str =
>'蛬Oウ瘢雹縷C~O縷Cウ瘢雹縷C~I縷Cォ' )
>AND
>EXISTS ( SELECT pr_prop_str.pr_property_id FROM pr_prop_str prs
>                  WHERE p.product_id = prs.product_id
>                  AND prs.pr_property_id = 115 AND prs.str =1 )
>AND
>EXISTS ( SELECT pr_prop_str.pr_property_id FROM pr_prop_str prs
>                  WHERE p.product_id = prs.product_id
>                  AND prs.pr_property_id = 68 AND prs.str =5 )
>AND
>EXISTS ( SELECT pr_prop_str.pr_property_id FROM pr_prop_str prs
>                  WHERE p.product_id = prs.product_id
>                  AND prs.pr_property_id = 113 AND prs.str < '030001' )
>AND
>EXISTS ( SELECT pr_prop_str.pr_property_id FROM pr_prop_str prs
>                  WHERE p.product_id = prs.product_id
>                  AND prs.pr_property_id = 57 AND prs.str < '19980101' )
>AND
>EXISTS ( SELECT pr_prop_str.pr_property_id FROM pr_prop_str prs
>                  WHERE p.product_id = prs.product_id
>                  AND prs.pr_property_id = 158 AND prs.str=1 )
>
>
>was kind of what I had in mind.
>





view thread (11+ messages)

Message-ID: <v03007801b75723f4f2f3@[65.15.153.184]>
Permalink:  ../v03007801b75723f4f2f3@%5B65.15.153.184%5D/
Also on:    postgresql.org/message-id/v03007801b75723f4f2f3@[65.15.153.184]

 · 

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 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-admin@postgresql.org
  Cc: stevelcmc@mindspring.com
  Subject: Re: High memory usage
  In-Reply-To: <v03007801b75723f4f2f3@[65.15.153.184]>
  References: <v03007801b75723f4f2f3@[65.15.153.184]>

* 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