mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Support parallel btree index builds.
To make this work, tuplesort.c and logtape.c must also support parallelism, so this patch adds that infrastructure and then applies it to the particular case of parallel btree index builds. Testing to date shows that this can often be 2-3x faster than a serial index build. The model for deciding how many workers to use is fairly primitive at present, but it's better than not having the feature. We can refine it as we get more experience. Peter Geoghegan with some help from Rushabh Lathia. While Heikki Linnakangas is not an author of this patch, he wrote other patches without which this feature would not have been possible, and therefore the release notes should possibly credit him as an author of this feature. Reviewed by Claudio Freire, Heikki Linnakangas, Thomas Munro, Tels, Amit Kapila, me. Discussion: http://postgr.es/m/CAM3SWZQKM=Pzc=CAHzRixKjp2eO5Q0Jg1SoFQqeXFQ647JiwqQ@mail.gmail.com Discussion: http://postgr.es/m/CAH2-Wz=AxWqDoVvGU7dq856S4r6sJAj6DBn7VMtigkB33N5eyg@mail.gmail.com
This commit is contained in:
@ -21,6 +21,7 @@
|
||||
#include "catalog/pg_index.h"
|
||||
#include "lib/stringinfo.h"
|
||||
#include "storage/bufmgr.h"
|
||||
#include "storage/shm_toc.h"
|
||||
|
||||
/* There's room for a 16-bit vacuum cycle ID in BTPageOpaqueData */
|
||||
typedef uint16 BTCycleId;
|
||||
@ -430,8 +431,6 @@ typedef BTScanOpaqueData *BTScanOpaque;
|
||||
/*
|
||||
* external entry points for btree, in nbtree.c
|
||||
*/
|
||||
extern IndexBuildResult *btbuild(Relation heap, Relation index,
|
||||
struct IndexInfo *indexInfo);
|
||||
extern void btbuildempty(Relation index);
|
||||
extern bool btinsert(Relation rel, Datum *values, bool *isnull,
|
||||
ItemPointer ht_ctid, Relation heapRel,
|
||||
@ -547,13 +546,8 @@ extern bool btvalidate(Oid opclassoid);
|
||||
/*
|
||||
* prototypes for functions in nbtsort.c
|
||||
*/
|
||||
typedef struct BTSpool BTSpool; /* opaque type known only within nbtsort.c */
|
||||
|
||||
extern BTSpool *_bt_spoolinit(Relation heap, Relation index,
|
||||
bool isunique, bool isdead);
|
||||
extern void _bt_spooldestroy(BTSpool *btspool);
|
||||
extern void _bt_spool(BTSpool *btspool, ItemPointer self,
|
||||
Datum *values, bool *isnull);
|
||||
extern void _bt_leafbuild(BTSpool *btspool, BTSpool *spool2);
|
||||
extern IndexBuildResult *btbuild(Relation heap, Relation index,
|
||||
struct IndexInfo *indexInfo);
|
||||
extern void _bt_parallel_build_main(dsm_segment *seg, shm_toc *toc);
|
||||
|
||||
#endif /* NBTREE_H */
|
||||
|
Reference in New Issue
Block a user