1- pgspqrhash
1+ spqrhash
22=========
33
4- The goal of pgspqrhash is to provide stable hashes for PostgeSQL,
5- "stable" in the sense that their implementation does not change,
6- they are independent from PostgeSQL version.
7-
8- Some string hashes may be dependent on CPU architecture,
9- so that they return different return on big-endian
10- architecture from little-endian architecture.
11- It you want to be architectures-independent, then
12- use algorithms that don't depend on endianess.
4+ The extension provides hash funcitons for SPQR to work with PG.
135
146
157Installation
@@ -25,17 +17,6 @@ You need PostgreSQL developent environment. Then simply::
2517Functions
2618---------
2719
28- hash_string
29- ~~~~~~~~~~~
30-
31- ::
32-
33- hash_string(data text, algo text [, initval int4]) returns int4
34- hash_string(data bytea, algo text [, initval int4]) returns int4
35-
36- This hashes the data with specified algorithm, returns 32-bit result.
37-
38-
3920hash64_string
4021~~~~~~~~~~~~~
4122
@@ -46,27 +27,6 @@ hash64_string
4627
4728Uses same algorithms as `hash_string() ` but returns 64-bit result.
4829
49- hash128_string
50- ~~~~~~~~~~~~~~
51-
52- ::
53-
54- hash64_string(data text, algo text, [, initval int4]) returns int8
55- hash64_string(data byte, algo text, [, initval int4]) returns int8
56-
57- Uses same algorithms as `hash_string() ` but returns 128-bit result.
58-
59-
60- hash_int4
61- ~~~~~~~~~
62-
63- ::
64-
65- hash_int4(val int4) returns int4
66-
67- Hash 32-bit integer.
68-
69-
7030hash_int8
7131~~~~~~~~~
7232
@@ -78,26 +38,15 @@ Hash 64-bit integer.
7838
7939
8040
81- String hashing algorithms
41+ Hashing algorithms
8242-------------------------
8343
8444List of currently provided algorithms.
8545
8646============== ========= ====== ======= ======= ==============================
8747 Algorithm CPU-indep Bits IV bits Partial Description
8848============== ========= ====== ======= ======= ==============================
89- city64 no 64 64 no CityHash64
90- city128 no 128 128 no CityHash128
91- crc32 yes 32 32 yes CRC32
92- lookup2 no 64 32 no Jenkins lookup2
93- lookup3be yes 64 32 no Jenkins lookup3 big-endian
94- lookup3le yes 64 32 no Jenkins lookup3 little-endian
95- lookup3 no 64 32 no Jenkins lookup3 CPU-native
9649 murmur3 no 32 32 no MurmurHash v3, 32-bit variant
97- md5 yes 128 128 no MD5
98- pgsql84 no 64 0 no Hacked lookup3 in Postgres 8.4+
99- siphash24 yes 64 128 no SipHash-2-4
100- spooky no 128 128 no SpookyHash
10150============== ========= ====== ======= ======= ==============================
10251
10352CPU-independence
@@ -117,54 +66,9 @@ Partial hashing
11766 Whether long string can be hashed in smaller parts, by giving last
11867 value as initval to next hash call.
11968
120- Integer hashing algorithms
121- --------------------------
122-
123- ============== ====== ================================ ============================
124- Algorithm Bits Description Notes
125- ============== ====== ================================ ============================
126- wang32 32 Thomas Wang hash32shift
127- wang32mult 32 Thomas Wang hash32shiftmult
128- jenkins 32 Bob Jenkins hash with 6 shifts
129- wang64 64 Thomas Wang hash64shift
130- wang64to32 64 Thomas Wang hash6432shift Result can be cast to int4
131- ============== ====== ================================ ============================
132-
133- All algorithms here have the property that they are "reversible",
134- that means there is 1:1 mapping between input and output.
135-
136- This propery is useful for creating well-defined "random" sort order over
137- unique integer id's. Or picking up random row from table
138- with unique id's.
139-
140-
14169Links
14270-----
14371
144- * `Lookup2/3 hashes `__ by Bob Jenkins.
145-
146- .. __ : http://burtleburtle.net/bob/hash/doobs.html
147-
14872* `MurmurHash `__ by Austin Appleby.
14973
15074.. __ : http://code.google.com/p/smhasher/
151-
152- * `Integer hashes `__ by Bob Jenkins.
153-
154- .. __ : http://burtleburtle.net/bob/hash/integer.html
155-
156- * `Integer hashes `__ by Thomas Wang.
157-
158- .. __ : http://www.cris.com/~Ttwang/tech/inthash.htm
159-
160- * Google's `CityHash `__. 64/128/256-bit output.
161-
162- .. __ : http://code.google.com/p/cityhash/
163-
164- * `SpookyHash `__ by Bob Jenkins. 128-bit output.
165-
166- .. __ : http://www.burtleburtle.net/bob/hash/spooky.html
167-
168- * `SipHash-2-4 `__ by Jean-Philippe Aumasson and Daniel J. Bernstein.
169-
170- .. __ : https://131002.net/siphash/
0 commit comments