From: | PFC <lists(at)peufeu(dot)com> |
---|---|
To: | pgsql-performance(at)postgresql(dot)org |
Subject: | Re: [HACKERS] qsort again (was Re: Strange Create Index |
Date: | 2006-02-16 23:05:23 |
Message-ID: | op.s42829s9cigqcu@apollo13 |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-performance |
> It seems that instead of maintaining a different sorting code path for
> each data type, you could get away with one generic path and one
> (hopefully faster) path if you allowed data types to optionally support
> a 'sortKey' interface by providing a function f which maps inputs to 32-
> bit int outputs, such that the following two properties hold:
Looks like the decorate-sort-undecorate pattern, which works quite well.
Good idea.
I would have said a 64 bit int, but it's the same idea. However it won't
work for floats, which is a pity, because floats fit in 64 bits. Unless
more types creep in the code path (which would not necessarily make it
that slower).
As for text, the worst case is when all strings start with the same 8
letters, but a good case pops up when a few-letter code is used as a key
in a table. Think about a zipcode, for instance. If a merge join needs to
sort on zipcodes, it might as well sort on 64-bits integers...
By the way, I'd like to declare my zipcode columns as SQL_ASCII while the
rest of my database is in UNICODE, so they are faster to index and sort.
Come on, MySQL does it...
Keep up !
From | Date | Subject | |
---|---|---|---|
Next Message | Mark Lewis | 2006-02-16 23:23:09 | Re: qsort again (was Re: [PERFORM] Strange Create Index |
Previous Message | Greg Stark | 2006-02-16 22:51:02 | Re: qsort again (was Re: [PERFORM] Strange Create Index |
From | Date | Subject | |
---|---|---|---|
Next Message | Mark Lewis | 2006-02-16 23:23:09 | Re: qsort again (was Re: [PERFORM] Strange Create Index |
Previous Message | Greg Stark | 2006-02-16 22:51:02 | Re: qsort again (was Re: [PERFORM] Strange Create Index |