From: Dan Field <dof@llgc.org.uk>
To: pgsql-sql@postgresql.org
Subject: SQL Query Timeouts
Date: Mon, 26 Apr 2004 12:08:11 +0100
Message-ID: <01A7331E-9772-11D8-8586-000A958E367A@llgc.org.uk> (raw)
I have a problem with a select statement that I am using in a web
search engine.
I have the following SQL:
SELECT
da_records.TITLE_EN AS TITLE,
da_records.AUTHOR_EN AS AUTHOR,
da_records.DESCRIPTION_EN AS DESCRIPTION,
da_records.PUBLISHER_EN AS PUBLISHER,
da_records.URL_EN AS URL,
da_records.RECORD_ID,
da_records.KEYWORD_LIST_ID,
da_records.LANGUAGE,
da_records.CONTRIBUTOR_NAME,
da_records.CONTRIBUTOR_EMAIL,
da_records.CONTRIBUTOR_ORGANISATION,
da_records.CONTRIBUTOR_CREDIT,
da_records.DEWEY_LIST_ID,
da_records.LISTING_PRIORITY,
da_records.SUBMITTED_DATE,
da_records.LAST_EDIT_DATE,
da_records.STATUS
FROM
da_records,
lu_dewey,
da_dewey_list
WHERE
da_records.RECORD_ID = da_dewey_list.RECORD_ID AND
lu_dewey.DEWEY_ID = da_dewey_list.DEWEY_ID AND
lu_dewey.DEWEY_LANG = 'en' AND
lu_dewey.DEWEY_TYPE = 't' AND
da_records.DESCRIPTION_EN like '%nasty%' OR
da_records.TITLE_EN like '%nasty%'
"nasty" is obviously the search term and if I search for a word which
is unlikely to be found, the query returns 0 results in a fairly short
time, as would be expected. However, if I search for a common word, the
query times out (process gets killed if running it from the pgsql
commandline). Its as if the query is returning a resultset which is too
big for a buffer or something.
I'm afraid I don't know Postgres that well yet so I can't tell you how
big the DBs are but in MySQL they were under 10MB total size, so even a
complete resultset shouldn't be too much for the machine.
Incidentally the hardware I'm running on is: Dual 2GHz Opteron, 2GB
RAM, SCSI. Hardly a slow system!
Any pointers at either, more efficiend SQL or ways to tweak Postgres
will be gladly recieved.
Many thanks in Advance
--
Dan Field <dof@llgc.org.uk> - Support Programmer: Cymru ar y we
cy_GB: http://www.cymruarywe.org
en_GB: http://www.walesontheweb.org
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: dof@llgc.org.uk
Subject: Re: SQL Query Timeouts
In-Reply-To: <01A7331E-9772-11D8-8586-000A958E367A@llgc.org.uk>
References: <01A7331E-9772-11D8-8586-000A958E367A@llgc.org.uk>
* 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