pg.ddx.io pgsql-performance@postgresql.org mailing list archive
help / color / mirror / Atom feed From: PFC <lists@peufeu.com>
To: pgsql-performance@postgresql.org
Subject: Re: [HACKERS] qsort again (was Re: Strange Create Index
Date: Fri, 17 Feb 2006 00:05:23 +0100
Message-ID: <op.s42829s9cigqcu@apollo13> (raw )
In-Reply-To: <1140128256.9076.254.camel@archimedes >
References: <43F38867.6010701@gpdnet.co.uk >
<19510.1140036968@sss.pgh.pa.us >
<19779.1140038874@sss.pgh.pa.us >
<43F39E53.1020009@gpdnet.co.uk >
<20781.1140046109@sss.pgh.pa.us >
<7.0.1.0.2.20060215194635.03b55da0@earthlink.net >
<21615.1140052893@sss.pgh.pa.us >
<7.0.1.0.2.20060215223710.03a7c618@earthlink.net >
<20060216113522.GA3461@uio.no >
<7.0.1.0.2.20060216071053.0385a1a8@earthlink.net >
<43F481CD.2010509@logix-tt.com >
<43F4A7D8.4050907@modgraph-usa.com >
<29277.1140110108@sss.pgh.pa.us >
<1140128256.9076.254.camel@archimedes >
> 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 !
view thread (6+ messages) latest in thread
Message-ID: <op.s42829s9cigqcu@apollo13>
Permalink: ../op.s42829s9cigqcu@apollo13/
Also on: postgresql.org/message-id/op.s42829s9cigqcu@apollo13
copy link · copy postgr.es
reply Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: lists@peufeu.com
Subject: Re: [HACKERS] qsort again (was Re: Strange Create Index
In-Reply-To: <op.s42829s9cigqcu@apollo13>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox