| From: | Frank Heikens <frankheikens(at)mac(dot)com> |
|---|---|
| To: | Richard Broersma <richard(dot)broersma(at)gmail(dot)com> |
| Cc: | Yang Zhang <yanghatespam(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org |
| Subject: | Re: Sorting performance vs. MySQL |
| Date: | 2010-02-22 18:42:46 |
| Message-ID: | 55EDC372-1A11-42E7-A72E-D2D688702E6A@mac.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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(at)mac(dot)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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Alban Hertroys | 2010-02-22 18:48:20 | Re: Sorting performance vs. MySQL |
| Previous Message | Pavel Stehule | 2010-02-22 18:42:32 | Re: Questions regarding SET option. |