pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kevin Schroeder <mirage@mirageworks.com>
To: pgsql-performance@postgresql.org
Subject: Select query takes long to execute
Date: Thu, 29 May 2003 08:58:07 -0500
Message-ID: <005501c325ea$5879ad10$0200a8c0@WORKSTATION> (raw)

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




view thread (6+ messages)  latest in thread

Message-ID: <005501c325ea$5879ad10$0200a8c0@WORKSTATION>
Permalink:  ../005501c325ea$5879ad10$0200a8c0@WORKSTATION/
Also on:    postgresql.org/message-id/005501c325ea$5879ad10$0200a8c0@WORKSTATION

 · 

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-performance@postgresql.org
  Cc: mirage@mirageworks.com
  Subject: Re: Select query takes long to execute
  In-Reply-To: <005501c325ea$5879ad10$0200a8c0@WORKSTATION>
  References: <005501c325ea$5879ad10$0200a8c0@WORKSTATION>

* 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