X-Original-To: pgsql-performance@postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by developer.postgresql.org (Postfix) with ESMTP id 2AE019258FF for ; Thu, 29 May 2003 09:58:13 -0400 (EDT) Received: from developer.postgresql.org ([64.117.224.193]) by localhost (developer.postgresql.org [64.117.224.193:10024]) (amavisd-new) with ESMTP id 60858-03 for ; Thu, 29 May 2003 09:58:11 -0400 (EDT) Received: from relay.netcetra.com (unknown [198.65.147.132]) by developer.postgresql.org (Postfix) with ESMTP id 4C1EE92586F for ; Thu, 29 May 2003 09:58:11 -0400 (EDT) Received: from WORKSTATION (frsc-dsldyna-66-228-147-1.advantexcom.net [66.228.147.1]) by relay.netcetra.com (8.11.6/8.11.6) with SMTP id h4TDoVZ19921 for ; Thu, 29 May 2003 09:50:32 -0400 (EDT) Message-ID: <005501c325ea$5879ad10$0200a8c0@WORKSTATION> From: "Kevin Schroeder" To: Subject: Select query takes long to execute Date: Thu, 29 May 2003 08:58:07 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new X-Archive-Number: 200305/262 X-Sequence-Number: 2041 Hello, I'm running a simple query on a table and I'm getting a very long response time. The table has 56,000 rows in it. It has a full text field, but it is not being referenced in this query. The query I'm running is select row_key, column1, column2, column3, column4, column5 from table1 where column6 = 1 order by column3 desc limit 21; There is an index on the table message_index btree (column6, column3, column7) Column 3 is a date type, column 6 is an integer and column 7 is unused in this query. The total query time is 6 seconds, but I can bring that down to 4.5 if I append "offset 0" to the end of the query. By checking query using "explain analyze" it shows that it is using the index. If anyone has any ideas as to why the query is taking so long and what I can do to make it more efficient I would love to know. Thanks Kevin