Skip site navigation (1) Skip section navigation (2)

RE: High memory usage

From: Steven Lane <stevelcmc(at)mindspring(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: RE: High memory usage
Date: 2001-06-21 04:09:28
Message-ID: v03007801b75723f4f2f3@[65.15.153.184] (view raw, whole thread or download thread mbox)
Thread:
Lists: pgsql-admin
>Date: Wed, 20 Jun 2001 23:06:56 -0500
>To: "Rainer Mager" <rmager(at)vgkk(dot)com>
>From: Steven Lane <stevelcmc(at)mindspring(dot)com>
>Subject: RE: High memory usage
>Cc: pgsql-admin(at)postgresql(dot)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.
>



pgsql-admin by date

Next:From: Yasuo OhgakiDate: 2001-06-21 06:22:56
Subject: Re: Gradual increase in CPU utilization by postmaster
Previous:From: Tom LaneDate: 2001-06-21 03:51:31
Subject: Re: Gradual increase in CPU utilization by postmaster

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group