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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





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 !


[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux