mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
What looks like some *major* improvements to btree indexing...
Patches from: aoki@CS.Berkeley.EDU (Paul M. Aoki) i gave jolly my btree bulkload code a long, long time ago but never gave him a bunch of my bugfixes. here's a diff against the 6.0 baseline. for some reason, this code has slowed down somewhat relative to the insertion-build code on very small tables. don't know why -- it used to be within about 10%. anyway, here are some (highly unscientific!) timings on a dec 3000/300 for synthetic tables with 10k, 100k and 1000k tuples (basically, 1mb, 10mb and 100mb heaps). 'c' means clustered (pre-sorted) inputs and 'u' means unclustered (randomly ordered) inputs. the 10k table basically fits in the buffer pool, but the 100k and 1000k tables don't. as you can see, insertion build is fine if you've sorted your heaps on your index key or if your heap fits in core, but is absolutely horrible on unordered data (yes, that's 7.5 hours to index 100mb of data...) because of the zillions of random i/os. if it doesn't work for you for whatever reason, you can always turn it back off by flipping the FastBuild flag in nbtree.c. i don't have time to maintain it. good luck! baseline code: time psql -c 'create index c10 on k10 using btree (c int4_ops)' bttest real 8.6 time psql -c 'create index u10 on k10 using btree (b int4_ops)' bttest real 9.1 time psql -c 'create index c100 on k100 using btree (c int4_ops)' bttest real 59.2 time psql -c 'create index u100 on k100 using btree (b int4_ops)' bttest real 652.4 time psql -c 'create index c1000 on k1000 using btree (c int4_ops)' bttest real 636.1 time psql -c 'create index u1000 on k1000 using btree (b int4_ops)' bttest real 26772.9 bulkloading code: time psql -c 'create index c10 on k10 using btree (c int4_ops)' bttest real 11.3 time psql -c 'create index u10 on k10 using btree (b int4_ops)' bttest real 10.4 time psql -c 'create index c100 on k100 using btree (c int4_ops)' bttest real 59.5 time psql -c 'create index u100 on k100 using btree (b int4_ops)' bttest real 63.5 time psql -c 'create index c1000 on k1000 using btree (c int4_ops)' bttest real 636.9 time psql -c 'create index u1000 on k1000 using btree (b int4_ops)' bttest real 701.0
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: nbtree.h,v 1.5 1997/01/10 09:36:33 vadim Exp $
|
||||
* $Id: nbtree.h,v 1.6 1997/02/12 05:04:28 scrappy Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -131,6 +131,13 @@ typedef BTStackData *BTStack;
|
||||
#define BT_INSERTION 0
|
||||
#define BT_DESCENT 1
|
||||
|
||||
/*
|
||||
* We must classify index modification types for the benefit of
|
||||
* _bt_adjscans.
|
||||
*/
|
||||
#define BT_INSERT 0
|
||||
#define BT_DELETE 1
|
||||
|
||||
/*
|
||||
* In general, the btree code tries to localize its knowledge about
|
||||
* page layout to a couple of routines. However, we need a special
|
||||
@@ -220,11 +227,7 @@ extern void btdelete(Relation rel, ItemPointer tid);
|
||||
*/
|
||||
extern void _bt_regscan(IndexScanDesc scan);
|
||||
extern void _bt_dropscan(IndexScanDesc scan);
|
||||
extern void _bt_adjscans(Relation rel, ItemPointer tid);
|
||||
extern void _bt_scandel(IndexScanDesc scan, BlockNumber blkno,
|
||||
OffsetNumber offno);
|
||||
extern bool _bt_scantouched(IndexScanDesc scan, BlockNumber blkno,
|
||||
OffsetNumber offno);
|
||||
extern void _bt_adjscans(Relation rel, ItemPointer tid, int op);
|
||||
|
||||
/*
|
||||
* prototypes for functions in nbtsearch.c
|
||||
@@ -267,7 +270,7 @@ extern BTItem _bt_formitem(IndexTuple itup);
|
||||
extern void *_bt_spoolinit(Relation index, int ntapes);
|
||||
extern void _bt_spooldestroy(void *spool);
|
||||
extern void _bt_spool(Relation index, BTItem btitem, void *spool);
|
||||
extern void _bt_upperbuild(Relation index, BlockNumber blk, int level);
|
||||
extern void _bt_upperbuild(Relation index);
|
||||
extern void _bt_leafbuild(Relation index, void *spool);
|
||||
|
||||
#endif /* NBTREE_H */
|
||||
|
Reference in New Issue
Block a user