Re: Query problem fixed

From: SZUCS Gábor <surrano(at)mailbox(dot)hu>
To: <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Query problem fixed
Date: 2003-05-29 14:27:10
Message-ID: 009f01c325ee$63fbdb00$0403a8c0@fejleszt4
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

The thing I can't really understand why can't the planner find out something
like this:

1. Index scan using column6
2. Backward search on subset using column3

Any guru to explain?

G.
------------------------------- cut here -------------------------------
----- Original Message -----
From: "Kevin Schroeder" <mirage(at)mirageworks(dot)com>
Sent: Thursday, May 29, 2003 4:09 PM

> I figured out how to make the query faster. There should be a mailing
list
> set up for wasted questions since I always seem to figure out the problem
> after I've bugged everyone for help.
>
> In the query
>
> select row_key, column1, column2, column3, column4, column5 from table1
> where column6 = 1 order by column3 desc limit 21;
>
> I changed the index to
>
> message_index btree (column3, column6)
>
> rather than
>
> message_index btree (column6, column3, column7)
>
> Since the data was being ordered by column3 it seems to have sped the
query
> up to 1 ms from 6000ms by making column 3 the first part of the index
rather
> than the second.
>
> Kevin

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2003-05-29 14:49:43 Re: Query problem fixed
Previous Message Shridhar Daithankar 2003-05-29 14:24:43 Re: Select query takes long to execute