Re: SELECT MIN, MAX took longer time than SELECT - Mailing list pgsql-performance

From K C Lau
Subject Re: SELECT MIN, MAX took longer time than SELECT
Date
Msg-id 6.2.1.2.0.20060121210512.08cc9310@localhost
Whole thread Raw
In response to Re: SELECT MIN, MAX took longer time than SELECT COUNT, MIN, MAX  ("Jim C. Nasby" <jnasby@pervasive.com>)
List pgsql-performance
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.


pgsql-performance by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: [GENERAL] Creation of tsearch2 index is very slow
Next
From: Oleg Bartunov
Date:
Subject: Re: [GENERAL] Creation of tsearch2 index is very slow