Re: SELECTing every Nth record for better performance

Поиск
Список
Период
Сортировка
От Ivan Voras
Тема Re: SELECTing every Nth record for better performance
Дата
Msg-id hfanfh$909$1@ger.gmane.org
обсуждение исходный текст
Ответ на Re: SELECTing every Nth record for better performance  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
Ответы Re: SELECTing every Nth record for better performance  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
Re: SELECTing every Nth record for better performance  (Grzegorz Jaśkiewicz <gryzman@gmail.com>)
Список pgsql-general
A. Kretschmer wrote:
> In response to Tom :
>> I have a big table that is used for datalogging. I'm designing
>> graphing interface that will visualise the data. When the user is
>> looking at a small daterange I want the database to be queried for all
>> records, but when the user is 'zoomed out', looking at an overview, I
>> want run a query that skips every nth record and returns a managable
>> dataset that still gives a correct overview of the data without
>> slowing the programme down. Is there an easy way to do this that I
>> have overlooked? I looked at:
>
>
> Do you have 8.4? If yes:
>
> test=# create table data as select s as s from generate_Series(1,1000) s;
> SELECT
>
>
>
> test=*# select s from (select *, row_number() over (order by s) from
> data) foo where row_number % 3 = 0 limit 10;

Won't this still read in the entire table and only then filter the
records out?

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

Предыдущее
От: Andrew Gierth
Дата:
Сообщение: Re: [HACKERS] Installing PL/pgSQL by default
Следующее
От: "A. Kretschmer"
Дата:
Сообщение: Re: SELECTing every Nth record for better performance