X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 0882BD1B55E for ; Mon, 26 Apr 2004 08:08:14 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 78120-08 for ; Mon, 26 Apr 2004 08:08:14 -0300 (ADT) Received: from post.llgc.org.uk (post.llgc.org.uk [193.61.220.51]) by svr1.postgresql.org (Postfix) with ESMTP id B39E8D1B47F for ; Mon, 26 Apr 2004 08:08:10 -0300 (ADT) Received: from [193.61.220.62] (helo=[193.61.220.62]) by post.llgc.org.uk with esmtp (Exim 4.20) id 1BI3vi-0006JF-Kg for pgsql-sql@postgresql.org; Mon, 26 Apr 2004 12:05:42 +0100 Mime-Version: 1.0 (Apple Message framework v613) To: pgsql-sql@postgresql.org Message-Id: <01A7331E-9772-11D8-8586-000A958E367A@llgc.org.uk> Content-Type: multipart/alternative; boundary=Apple-Mail-12--556206979 From: Dan Field Subject: SQL Query Timeouts Date: Mon, 26 Apr 2004 12:08:11 +0100 X-Mailer: Apple Mail (2.613) X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200404/274 X-Sequence-Number: 17649 --Apple-Mail-12--556206979 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed 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 - Support Programmer: Cymru ar y we cy_GB: http://www.cymruarywe.org en_GB: http://www.walesontheweb.org --Apple-Mail-12--556206979 Content-Transfer-Encoding: 7bit Content-Type: text/enriched; charset=US-ASCII VerdanaI 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 < - Support Programmer: Cymru ar y we cy_GB: http://www.cymruarywe.org en_GB: http://www.walesontheweb.org --Apple-Mail-12--556206979--