Skip site navigation (1) Skip section navigation (2)

Re: [HACKERS] qsort again (was Re: Strange Create Index

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 (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-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 !

In response to

Responses

pgsql-performance by date

Next:From: Mark LewisDate: 2006-02-16 23:23:09
Subject: Re: qsort again (was Re: [PERFORM] Strange Create Index
Previous:From: Greg StarkDate: 2006-02-16 22:51:02
Subject: Re: qsort again (was Re: [PERFORM] Strange Create Index

pgsql-hackers by date

Next:From: Mark LewisDate: 2006-02-16 23:23:09
Subject: Re: qsort again (was Re: [PERFORM] Strange Create Index
Previous:From: Greg StarkDate: 2006-02-16 22:51:02
Subject: Re: qsort again (was Re: [PERFORM] Strange Create Index

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group