Re: SELECT MIN, MAX took longer time than SELECT

От: K C Lau
Тема: Re: SELECT MIN, MAX took longer time than SELECT
Дата: ,
Msg-id: 6.2.1.2.0.20060121210512.08cc9310@localhost
(см: обсуждение, исходный текст)
Ответ на: Re: SELECT MIN, MAX took longer time than SELECT COUNT, MIN, MAX  ("Jim C. Nasby")
Список: pgsql-performance

Скрыть дерево обсуждения

SELECT MIN, MAX took longer time than SELECT COUNT, MIN, MAX  (K C Lau, )
 Re: SELECT MIN, MAX took longer time than SELECT COUNT, MIN, MAX  ("Jim C. Nasby", )
  Re: SELECT MIN, MAX took longer time than SELECT COUNT, MIN, MAX  (Tom Lane, )
   Re: Stored procedures  (Rikard Pavelic, )
   Re: SELECT MIN, MAX took longer time than SELECT  (K C Lau, )
  Re: SELECT MIN, MAX took longer time than SELECT  (K C Lau, )

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 по дате сообщения:

От: Tom Lane
Дата:
Сообщение: Re: [GENERAL] Creation of tsearch2 index is very
От: Martijn van Oosterhout
Дата:
Сообщение: Re: [GENERAL] Creation of tsearch2 index is very slow