Re: some points for FAQ

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: some points for FAQ
Дата
Msg-id 162867790710091436l601838e6v2bf96216528a9f60@mail.gmail.com
обсуждение исходный текст
Ответ на Re: some points for FAQ  (Bruce Momjian <bruce@momjian.us>)
Ответы Re: some points for FAQ  (Bruce Momjian <bruce@momjian.us>)
Список pgsql-hackers
> > >
> >
> > ok. I accept it. Can be some note there? Not this strange select.
>
> Well, with 8.3 having this be faster I am thinking we should wait to see
> if the hacks are needed.
>

difference, on 10K lines (on small think table)

postgres=# select * from test where i = any(array(select
(random()*10000)::int from generate_series(1,20))) limit 1; i  |  v
-----+-----869 | 113
(1 row)

Time: 3,984 ms

postgres=# select * from test order by random() limit 1; i   |  v
------+-----3687 | 293
(1 row)

Time: 21,978 ms

8.2
postgres=# select * from test order by random() limit 1; i   |  v
------+-----4821 | 608
(1 row)

Time: 51,299 ms

postgres=# select * from test where i = any(array(select
(random()*10000)::int from generate_series(1,20))) limit 1; i  |  v
-----+-----762 | 254
(1 row)

Time: 4,530 ms

Results:

8.3  "fast solution' is 6x faster
8.2  'fast solution' is 11x faster  .. it's minimum.

Pavel

for me, it's one from typical beginers mistakes


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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: Locale + encoding combinations
Следующее
От: Dave Page
Дата:
Сообщение: Re: Locale + encoding combinations