Re: Sorting performance vs. MySQL

Поиск
Список
Период
Сортировка
От Frank Heikens
Тема Re: Sorting performance vs. MySQL
Дата
Msg-id 55EDC372-1A11-42E7-A72E-D2D688702E6A@mac.com
обсуждение исходный текст
Ответ на Re: Sorting performance vs. MySQL  (Richard Broersma <richard.broersma@gmail.com>)
Список pgsql-general
Op 22 feb 2010, om 19:30 heeft Richard Broersma het volgende geschreven:

> On Mon, Feb 22, 2010 at 10:17 AM, Frank Heikens
> <frankheikens@mac.com> wrote:
>
>> There is no index on the column transactionid in your PostgreSQL-
>> table, as
>> there is in your MySQL-table. This explains the difference.
>>
>> CREATE INDEX i_transactionid ON public.metarelcloud_transactionlog
>> (transactionid);
>
> Does an index help a sort operation in PostgreSQL?

Yes it does, see the manual: http://www.postgresql.org/docs/8.4/interactive/indexes-ordering.html

Example without index:
"Sort  (cost=804.39..829.39 rows=10000 width=4) (actual
time=16.006..17.171 rows=10000 loops=1)"
"  Sort Key: bar"
"  Sort Method:  quicksort  Memory: 491kB"
"  ->  Seq Scan on bla  (cost=0.00..140.00 rows=10000 width=4) (actual
time=0.015..2.236 rows=10000 loops=1)"
"Total runtime: 18.098 ms"

Same query with index (btree):
"Index Scan Backward using i_bar on bla  (cost=0.00..406.25 rows=10000
width=4) (actual time=0.093..4.408 rows=10000 loops=1)"
"Total runtime: 5.381 ms"

>
>
> --
> Regards,
> Richard Broersma Jr.
>
> Visit the Los Angeles PostgreSQL Users Group (LAPUG)
> http://pugs.postgresql.org/lapug


Regards,
Frank Heikens




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

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: Questions regarding SET option.
Следующее
От: Alban Hertroys
Дата:
Сообщение: Re: Sorting performance vs. MySQL