pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: SZUCS Gábor <surrano@mailbox.hu>
To: pgsql-performance@postgresql.org
Subject: Re: Query problem fixed
Date: Thu, 29 May 2003 16:27:10 +0200
Message-ID: <009f01c325ee$63fbdb00$0403a8c0@fejleszt4> (raw)
References: <006d01c325eb$eb72fdf0$0200a8c0@WORKSTATION>

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@mirageworks.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




view thread (3+ messages)  latest in thread

Message-ID: <009f01c325ee$63fbdb00$0403a8c0@fejleszt4>
Permalink:  ../009f01c325ee$63fbdb00$0403a8c0@fejleszt4/
Also on:    postgresql.org/message-id/009f01c325ee$63fbdb00$0403a8c0@fejleszt4

 · 

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: surrano@mailbox.hu
  Subject: Re: Query problem fixed
  In-Reply-To: <009f01c325ee$63fbdb00$0403a8c0@fejleszt4>
  References: <006d01c325eb$eb72fdf0$0200a8c0@WORKSTATION> <009f01c325ee$63fbdb00$0403a8c0@fejleszt4>

* 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