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

Very slow queries - please help.

From: "Bealach-na Bo" <bealach_na_bo(at)hotmail(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Very slow queries - please help.
Date: 2005-11-24 13:06:48
Message-ID: BAY101-F89F00F81CBAF5B66A6EE0AD540@phx.gbl (view raw, whole thread or download thread mbox)
Lists: pgsql-performance
Hi Folks,

I'm new to Postgresql.

I'm having great difficulties getting the performance I had hoped for
from Postgresql 8.0. The typical query below takes ~20 minutes !!

I hope an expert out there will tell me what I'm doing wrong - I hope
*I* am doing something wrong.

Single processor, Intel Xeon 3.06 GHz machine running Red Hat
Ent. 4. with 1.5 GB of RAM.

The machine is dedicated to running Postgresql 8.0 and Apache/mod_perl
etc. The database is being accessed for report generation via a web
form. The web server talks to Pg over TCP/IP (I know, that I don't
need to do this if they are all on the same machine, but I have good
reasons for this and don't suspect that this is where my problems are
- I have the same poor performance when running from psql on the

Very simple, not fully normalized set of two tables. The first table,
very small (2000 lines of 4 cols with very few chars and integers in
in col). The other quite a bit larger (500000 lines with 15
cols. with the largest fields ~ 256 chars)

Typical query

FROM node n
LIKE '56x%'
AND n.type='H'
AND n.usage='TEST'
AND n.node_id
(select n.node_id
FROM job_log j
ON j.node_id = n.node_id
LIKE '56x%'
AND n.type='H'
AND n.usage='TEST'
AND j.job_name = 'COPY FILES'
AND j.job_start >= '2005-11-14 00:00:00'
AND (j.job_stop <= '2005-11-22 09:31:10' OR j.job_stop IS NULL))

The node table is the small table and the job_log table is the large

I've tried all the basic things that I found in the documentation like
VACUUM ANALYZE, EXPLAIN etc., but I suspect there is something
terribly wrong with what I'm doing and these measures will not shave
off 19 min and 50 seconds off the query time.

Any help and comments would be very much appreciated.



pgsql-performance by date

Next:From: Claus GuttesenDate: 2005-11-24 13:23:38
Subject: Re: Very slow queries - please help.
Previous:From: Vipul.GuptaDate: 2005-11-24 12:24:32
Subject: xlog flush request error

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