pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: K C Lau <kclau60@netvigator.com>
To: Jim C. Nasby <jnasby@pervasive.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: SELECT MIN, MAX took longer time than SELECT
Date: Sat, 21 Jan 2006 21:12:47 +0800
Message-ID: <6.2.1.2.0.20060121210512.08cc9310@localhost> (raw)
In-Reply-To: <20060120172026.GF20182@pervasive.com>
References: <6.2.1.2.0.20060120120150.08ab7b00@localhost>
	<20060120172026.GF20182@pervasive.com>

At 01:20 06/01/21, Jim C. Nasby wrote:

>BTW, these queries below are meaningless; they are not equivalent to
>min(logsn).
>
> > esdt=> explain analyze select LogSN from Log where create_time <
> > '2005/10/19' order by create_time limit 1;

Thank you for pointing it out.

It actually returns the min(logsn), as the index is on (create_time, 
logsn). To be more explicit, I have changed to query to:
explain analyze select LogSN from Log where create_time < '2005/10/19' 
order by create_time, logsn limit 1;

esdt=> \d log;
  create_time | character varying(23)   | default 
'1970/01/01~00:00:00.000'::character varying
  logsn       | integer                 | not null
  ...
Indexes:
     "pk_log" PRIMARY KEY, btree (logsn)
     "idx_logtime" btree (create_time, logsn)

Best regards,
KC.




view thread (5+ messages)  latest in thread

Message-ID: <6.2.1.2.0.20060121210512.08cc9310@localhost>
Permalink:  ../6.2.1.2.0.20060121210512.08cc9310@localhost/
Also on:    postgresql.org/message-id/6.2.1.2.0.20060121210512.08cc9310@localhost

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: kclau60@netvigator.com, jnasby@pervasive.com
  Subject: Re: SELECT MIN, MAX took longer time than SELECT
  In-Reply-To: <6.2.1.2.0.20060121210512.08cc9310@localhost>

* 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