pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomasz Myrta <jasiek@klaster.net>
To: Paul McKay <paul_mckay@clearwater-it.co.uk>
Cc: pgsql-performance@postgresql.org
Subject: Re: Slow query performance on large table
Date: Tue, 04 Mar 2003 16:09:51 +0100
Message-ID: <3E64C1BF.4080704@klaster.net> (raw)
References: <000001c2e25c$ad506170$0c64a8c0@paulspc>

Paul McKay wrote:
> Hi,
> 
>  
> 
> I am executing a query on a table:
> 
>  
> 
>            Table "public.measurement"
> 
>    Column   |         Type          | Modifiers
> 
> ------------+-----------------------+-----------
> 
>  assessment | integer               |
> 
>  time       | integer               |
> 
>  value      | character varying(50) |
> 
> Indexes: idx_measurement_assessment btree (assessment),
> 
>          idx_measurement_time btree ("time")
> 
>  
> 
> The primary key of the table is a combination of assessment and time, 
> and there are indexes on both assessment and time.
> 
>  
> 
> The query I am executing is
> 
>  
> 
> Select time,value
> 
>  From measurement
> 
> Where assessment = ?
> 
> And time between ? and ?
Changing 2 indexes into one both-fields index should improve 
performance much.

create index ind_meas on measurement (assessment,time).

Regards,
Tomasz Myrta





view thread (18+ messages)  latest in thread

Message-ID: <3E64C1BF.4080704@klaster.net>
Permalink:  ../3E64C1BF.4080704@klaster.net/
Also on:    postgresql.org/message-id/3E64C1BF.4080704@klaster.net

 · 

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: jasiek@klaster.net, paul_mckay@clearwater-it.co.uk
  Subject: Re: Slow query performance on large table
  In-Reply-To: <3E64C1BF.4080704@klaster.net>
  References: <000001c2e25c$ad506170$0c64a8c0@paulspc> <3E64C1BF.4080704@klaster.net>

* 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