postgresql/contrib/pg_trgm
Tom Lane 4a14f13a0a Improve hash_create's API for selecting simple-binary-key hash functions.
Previously, if you wanted anything besides C-string hash keys, you had to
specify a custom hashing function to hash_create().  Nearly all such
callers were specifying tag_hash or oid_hash; which is tedious, and rather
error-prone, since a caller could easily miss the opportunity to optimize
by using hash_uint32 when appropriate.  Replace this with a design whereby
callers using simple binary-data keys just specify HASH_BLOBS and don't
need to mess with specific support functions.  hash_create() itself will
take care of optimizing when the key size is four bytes.

This nets out saving a few hundred bytes of code space, and offers
a measurable performance improvement in tidbitmap.c (which was not
exploiting the opportunity to use hash_uint32 for its 4-byte keys).
There might be some wins elsewhere too, I didn't analyze closely.

In future we could look into offering a similar optimized hashing function
for 8-byte keys.  Under this design that could be done in a centralized
and machine-independent fashion, whereas getting it right for keys of
platform-dependent sizes would've been notationally painful before.

For the moment, the old way still works fine, so as not to break source
code compatibility for loadable modules.  Eventually we might want to
remove tag_hash and friends from the exported API altogether, since there's
no real need for them to be explicitly referenced from outside dynahash.c.

Teodor Sigaev and Tom Lane
2014-12-18 13:36:36 -05:00
..
data
expected
sql
.gitignore
Makefile Add file version information to most installed Windows binaries. 2014-07-14 14:07:52 -04:00
pg_trgm--1.0--1.1.sql
pg_trgm--1.1.sql Fix volatility markings of some contrib I/O functions. 2014-11-05 11:34:11 -05:00
pg_trgm--unpackaged--1.0.sql Fix typos in some error messages thrown by extension scripts when fed to psql. 2014-08-25 18:30:37 +02:00
pg_trgm.control
trgm_gin.c pgindent run for 9.4 2014-05-06 12:12:18 -04:00
trgm_gist.c pgindent run for 9.4 2014-05-06 12:12:18 -04:00
trgm_op.c Switch to CRC-32C in WAL and other places. 2014-11-04 11:39:48 +02:00
trgm_regexp.c Improve hash_create's API for selecting simple-binary-key hash functions. 2014-12-18 13:36:36 -05:00
trgm.h