pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ross J. Reedstrom <reedstrm@rice.edu>
To: Rainer Mager <rmager@vgkk.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: PostgreSQL Admin <pgsql-admin@postgresql.org>
Subject: Re: High memory usage
Date: Wed, 20 Jun 2001 10:35:55 -0500
Message-ID: <20010620103554.C1496@rice.edu> (raw)
In-Reply-To: <NEBBJBCAFMMNIHGDLFKGCEFOEFAA.rmager@vgkk.com>
References: <NEBBJBCAFMMNIHGDLFKGCEFOEFAA.rmager@vgkk.com>

Ranier - 
Can you explain in words what this query is supposed to be doing?

I'm guessing, from the DISTINCT, and the use of multiple occurances of
the same table, that the result you want can be gotten at in some other
way, that lets the backend be smarter about how it does it. Since it _is_
releasing the memory, i.e., it's not a new leak, I'm guessing that Tom
just got a whole lot less interested ;-) But helping you use PostgreSQL
better is part of what the community does, as well.

Hmm, you mention that _planning_ this query sucks up the memory, as well.
My guess is it's an interaction of the optimizer with the plan for this
query, which might have many, nearly identical cost plans, since 8 of
the 9 tables are actually the same table.

Ross

SELECT DISTINCT product.product_id 
FROM 	product, 
	pr_prop_str alias_table_0,
	pr_prop_str alias_table_1,
	pr_prop_str alias_table_2, 
	pr_prop_str alias_table_3, 
	pr_prop_str alias_table_4, 
	pr_prop_str alias_table_5, 
	pr_prop_str alias_table_6, 
	pr_prop_str alias_table_7, 
	pr_prop_str alias_table_8 
WHERE 	    product.product_id = alias_table_0.product_id 
	AND product.product_id = alias_table_1.product_id 
	AND product.product_id = alias_table_2.product_id 
	AND product.product_id = alias_table_3.product_id 
	AND product.product_id = alias_table_4.product_id 
	AND product.product_id = alias_table_5.product_id 
	AND product.product_id = alias_table_6.product_id 
	AND product.product_id = alias_table_7.product_id 
	AND product.product_id = alias_table_8.product_id 
	AND ( alias_table_0.pr_property_id = 147 
		AND alias_table_0.str = '3E362cb' ) 
	AND ( alias_table_1.pr_property_id = 18 
		AND alias_table_1.str > '000999999' ) 
	AND ( alias_table_2.pr_property_id = 18 
		AND alias_table_2.str < '004999999' ) 
	AND ( alias_table_3.pr_property_id = 51 
		AND alias_table_3.str = '?$Bi_O?$B%&e_C~O?$Be_C?$B%&e_C~I?$Be_C?$B%)' ) 
	AND ( alias_table_4.pr_property_id = 115 
		AND alias_table_4.str = '1' ) 
	AND ( alias_table_5.pr_property_id = 68 
		AND alias_table_5.str = '05' ) 
	AND ( alias_table_6.pr_property_id = 113 
		AND alias_table_6.str < '030001' ) 
	AND ( alias_table_7.pr_property_id = 57 
		AND alias_table_7.str < '19980101' ) 
	AND ( alias_table_8.pr_property_id = 158 
		AND alias_table_8.str = '1' );

On Wed, Jun 20, 2001 at 04:18:52PM +0900, Rainer Mager wrote:
> Hi,
> 
> 	Here is a query that demonstrates the problem. Running this takes about
> 60MB until it is done at which time it is freed (I was wrong when I said
> otherwise earlier). Interestingly, the same amount of memory is used when
> doing an EXPLAIN on this query. Also it happens to return 0 rows. Please
> excuse the weird characters in the middle this is a Japanese (UTF8)
> database. Also please excuse Outlook breaking the query, it is just one long
> line.
> 
> 



view thread (11+ messages)  latest in thread

Message-ID: <20010620103554.C1496@rice.edu>
Permalink:  ../20010620103554.C1496@rice.edu/
Also on:    postgresql.org/message-id/20010620103554.C1496@rice.edu

 · 

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: reedstrm@rice.edu, rmager@vgkk.com, tgl@sss.pgh.pa.us
  Subject: Re: High memory usage
  In-Reply-To: <20010620103554.C1496@rice.edu>
  References: <NEBBJBCAFMMNIHGDLFKGCEFOEFAA.rmager@vgkk.com> <20010620103554.C1496@rice.edu>

* 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