Re: fastes way to retrieve segmented without using loop

Поиск
Список
Период
Сортировка
От Melvin Davidson
Тема Re: fastes way to retrieve segmented without using loop
Дата
Msg-id CANu8FiwE-E6ZwhAMNt5vaF5Zft0ZAmkzdZPu5GO66sjoPVYsiw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: fastes way to retrieve segmented without using loop  (Melvin Davidson <melvin6925@gmail.com>)
Список pgsql-general
Correction:

SELECT  DISTINCT ON EXTRACT(HOUR FROM you_time_column)
                *
  FROM table
WHERE  t >=1
LIMIT  99998;

On Sun, Aug 23, 2015 at 5:38 PM, Melvin Davidson <melvin6925@gmail.com> wrote:
Well, I would say the following might work:

SELECT  *
  FROM table
WHERE  t >=1
LIMIT  99998;

On Sun, Aug 23, 2015 at 5:05 PM, Tom Smith <tomsmith1989sk@gmail.com> wrote:
Hello:

I have a time series table,
using below sql, loop (psque code), I can get one row for each hour

for( H=1: H< 99999; H++){
   select  * from table where  t >= H and t < H+1   limit 1
}

t (time column) is indexed).

Is there a better way to use a issue a SINGLE SQL
with  an array of time start/end pair
so it will be executed once to send back result, which would be much faster
than issuing sql again and again (even with prepared statement and using sql function).

Thanks in Advance



--
Melvin Davidson
I reserve the right to fantasize.  Whether or not you
wish to share my fantasy is entirely up to you.




--
Melvin Davidson
I reserve the right to fantasize.  Whether or not you
wish to share my fantasy is entirely up to you.

В списке pgsql-general по дате отправления:

Предыдущее
От: Melvin Davidson
Дата:
Сообщение: Re: fastes way to retrieve segmented without using loop
Следующее
От: John McKown
Дата:
Сообщение: Re: fastes way to retrieve segmented without using loop