mirror of
https://github.com/postgres/postgres.git
synced 2025-10-25 13:17:41 +03:00
Rewrite hashbulkdelete() to make it amenable to new bucket locking
scheme. A pleasant side effect is that it is *much* faster when deleting a large fraction of the indexed tuples, because of elimination of redundant hash_step activity induced by hash_adjscans. Various other continuing code cleanup.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: hash.h,v 1.50 2003/09/01 20:26:34 tgl Exp $
|
||||
* $Id: hash.h,v 1.51 2003/09/02 02:18:38 tgl Exp $
|
||||
*
|
||||
* NOTES
|
||||
* modeled after Margo Seltzer's hash implementation for unix.
|
||||
@@ -25,13 +25,12 @@
|
||||
|
||||
/*
|
||||
* Mapping from hash bucket number to physical block number of bucket's
|
||||
* starting page. Beware of multiple evaluations of argument! Also notice
|
||||
* macro's implicit dependency on "metap".
|
||||
* starting page. Beware of multiple evaluations of argument!
|
||||
*/
|
||||
typedef uint32 Bucket;
|
||||
|
||||
#define BUCKET_TO_BLKNO(B) \
|
||||
((BlockNumber) ((B) + ((B) ? metap->hashm_spares[_hash_log2((B)+1)-1] : 0)) + 1)
|
||||
#define BUCKET_TO_BLKNO(metap,B) \
|
||||
((BlockNumber) ((B) + ((B) ? (metap)->hashm_spares[_hash_log2((B)+1)-1] : 0)) + 1)
|
||||
|
||||
/*
|
||||
* Special space for hash index pages.
|
||||
@@ -243,8 +242,8 @@ extern Buffer _hash_addovflpage(Relation rel, Buffer metabuf, Buffer buf);
|
||||
extern BlockNumber _hash_freeovflpage(Relation rel, Buffer ovflbuf);
|
||||
extern void _hash_initbitmap(Relation rel, HashMetaPage metap,
|
||||
BlockNumber blkno);
|
||||
extern void _hash_squeezebucket(Relation rel, HashMetaPage metap,
|
||||
Bucket bucket);
|
||||
extern void _hash_squeezebucket(Relation rel,
|
||||
Bucket bucket, BlockNumber bucket_blkno);
|
||||
|
||||
/* hashpage.c */
|
||||
extern void _hash_metapinit(Relation rel);
|
||||
|
||||
Reference in New Issue
Block a user