pgsql: Improve hash_create's API for selecting simple-binary-key hash f
От | Tom Lane |
---|---|
Тема | pgsql: Improve hash_create's API for selecting simple-binary-key hash f |
Дата | |
Msg-id | E1Y1fwL-0001Fv-Lw@gemulon.postgresql.org обсуждение исходный текст |
Список | pgsql-committers |
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 Branch ------ master Details ------- http://git.postgresql.org/pg/commitdiff/4a14f13a0abfbf7e7d44a3d2689444d1806aa9dc Modified Files -------------- contrib/pg_trgm/trgm_regexp.c | 3 +- contrib/postgres_fdw/connection.c | 3 +- src/backend/access/gist/gistbuild.c | 4 +-- src/backend/access/gist/gistbuildbuffers.c | 6 ++-- src/backend/access/heap/rewriteheap.c | 8 ++--- src/backend/access/transam/xlogutils.c | 3 +- src/backend/commands/sequence.c | 3 +- src/backend/nodes/tidbitmap.c | 3 +- src/backend/optimizer/util/predtest.c | 3 +- src/backend/parser/parse_oper.c | 3 +- src/backend/postmaster/autovacuum.c | 6 ++-- src/backend/postmaster/checkpointer.c | 3 +- src/backend/postmaster/pgstat.c | 21 +++++-------- src/backend/replication/logical/reorderbuffer.c | 9 ++---- src/backend/storage/buffer/buf_table.c | 3 +- src/backend/storage/buffer/bufmgr.c | 3 +- src/backend/storage/buffer/localbuf.c | 3 +- src/backend/storage/lmgr/lock.c | 12 ++------ src/backend/storage/lmgr/lwlock.c | 3 +- src/backend/storage/lmgr/predicate.c | 20 +++++------- src/backend/storage/smgr/md.c | 3 +- src/backend/storage/smgr/smgr.c | 3 +- src/backend/utils/adt/array_typanalyze.c | 3 +- src/backend/utils/adt/pg_locale.c | 3 +- src/backend/utils/adt/ri_triggers.c | 9 ++---- src/backend/utils/cache/attoptcache.c | 3 +- src/backend/utils/cache/evtcache.c | 3 +- src/backend/utils/cache/relcache.c | 6 ++-- src/backend/utils/cache/relfilenodemap.c | 3 +- src/backend/utils/cache/spccache.c | 3 +- src/backend/utils/cache/ts_cache.c | 9 ++---- src/backend/utils/cache/typcache.c | 6 ++-- src/backend/utils/fmgr/fmgr.c | 3 +- src/backend/utils/hash/dynahash.c | 34 ++++++++++++++++++++- src/backend/utils/hash/hashfn.c | 8 ++--- src/backend/utils/time/combocid.c | 3 +- src/include/utils/hsearch.h | 37 ++++++++++++++--------- src/pl/plperl/plperl.c | 6 ++-- src/pl/plpgsql/src/pl_comp.c | 3 +- src/pl/plpython/plpy_plpymodule.c | 3 +- src/pl/plpython/plpy_procedure.c | 3 +- src/pl/tcl/pltcl.c | 6 ++-- 42 files changed, 127 insertions(+), 155 deletions(-)
В списке pgsql-committers по дате отправления:
Предыдущее
От: Heikki LinnakangasДата:
Сообщение: pgsql: Change how first WAL segment on new timeline after promotion is
Следующее
От: Alvaro HerreraДата:
Сообщение: pgsql: Have VACUUM log number of skipped pages due to pins