pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Werner Reisberger <wreis@datacomm.ch>
To: pgsql-sql@hub.org
Subject: tuning large selects
Date: Fri, 29 Oct 1999 21:36:03 +0200
Message-ID: <19991029213603.B830@tribe.free.de> (raw)

I am running a db (v. 6.4.2) accessible via DBI/Pg from the internet. 
Recently I observed several running postmaster processes consuming lots of CPU,
resulting in a high load of the machine. There was nobody connected to
the db from the net. Later I saw that my db partition was filled to 100 %
by a huge file (pg_psort.189xx). My db partition is approx. 950 MB. The
db consumes 15 MB and the file consumed the rest. 

I guess the pg_psort file grew to this dimension because the select
possibilities I am offering via the CGI are not well designed. Maybe
someone could give me some advice how to make it more efficient. 

The select in question accesses only one table (notcat) with approx.
6000 rows and 15 columns. The CGI allows to choose how many columns will
be returned as a result and what columns are used to constrain the search.
There are 8 columns which can be used to constrain the search. The values
of each such column are Or-ed together in the where clause. The columns
itself are AND-ed.

Example:

select * from notcat where (col1 ~* 'val1' OR col1 ~* 'val2' ....) AND
         (col2 ~* 'val1' OR col2  ~* 'val2' ....) AND (col3 ~* 'val1' ...


To make things worse there could be several dozens values in each column
used in the where clause.

--Werner



view thread (2+ messages)  latest in thread

Message-ID: <19991029213603.B830@tribe.free.de>
Permalink:  ../19991029213603.B830@tribe.free.de/
Also on:    postgresql.org/message-id/19991029213603.B830@tribe.free.de

 · 

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-sql@postgresql.org
  Cc: wreis@datacomm.ch, pgsql-sql@hub.org
  Subject: Re: tuning large selects
  In-Reply-To: <19991029213603.B830@tribe.free.de>
  References: <19991029213603.B830@tribe.free.de>

* 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