Unlike dynahash
,
dshash
is always in
shared memory (dynahash can be put in shared memory) it allows the hashtable
to grow (though be careful, it can't shrink).
While the behaviours below are documented in dshash
, it's worth highlighting
them as they are notably different from those of dynahash
.
dshash_seq_term
must be called when the scan is finished (in dynahash,
its hash_seq_term
counterpart must only be called if the scan is
abandoned before the termination of the scan).
Note
Postgres versions before 15 do not have support for sequential scans. Current
version's comments suggest that it still doesn't: "Future versions may
support iterators" but this appears to be untrue considering presence of
dshash_seq_
family of functions
When you are done with an entry returned by dshash_find
or similar functions,
make sure you release the lock held by entry using dshash_release_lock
.