diff options
author | Bruce Momjian <bruce@momjian.us> | 2006-07-02 02:23:23 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2006-07-02 02:23:23 +0000 |
commit | 277807bd9eba1645d8dfc9252fa29220c4a83751 (patch) | |
tree | fb3dca975d8371bd42e9e58d0b841db3fd6c4654 /src/backend/access/gist/gist.c | |
parent | 5d5c1416bf03efcf13cfd3b8f68a0bba199d70af (diff) | |
download | postgresql-277807bd9eba1645d8dfc9252fa29220c4a83751.tar.gz postgresql-277807bd9eba1645d8dfc9252fa29220c4a83751.zip |
Add FILLFACTOR to CREATE INDEX.
ITAGAKI Takahiro
Diffstat (limited to 'src/backend/access/gist/gist.c')
-rw-r--r-- | src/backend/access/gist/gist.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/backend/access/gist/gist.c b/src/backend/access/gist/gist.c index 39ff702c3d1..4137ab4426f 100644 --- a/src/backend/access/gist/gist.c +++ b/src/backend/access/gist/gist.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/gist/gist.c,v 1.139 2006/06/28 12:00:14 teodor Exp $ + * $PostgreSQL: pgsql/src/backend/access/gist/gist.c,v 1.140 2006/07/02 02:23:18 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -44,6 +44,7 @@ static void gistbuildCallback(Relation index, void *state); static void gistdoinsert(Relation r, IndexTuple itup, + Size freespace, GISTSTATE *GISTstate); static void gistfindleaf(GISTInsertState *state, GISTSTATE *giststate); @@ -197,7 +198,8 @@ gistbuildCallback(Relation index, * you're inserting single tups, but not when you're initializing the * whole index at once. */ - gistdoinsert(index, itup, &buildstate->giststate); + gistdoinsert(index, itup, IndexGetPageFreeSpace(index), + &buildstate->giststate); buildstate->indtuples += 1; MemoryContextSwitchTo(oldCtx); @@ -236,7 +238,7 @@ gistinsert(PG_FUNCTION_ARGS) values, isnull, true /* size is currently bogus */); itup->t_tid = *ht_ctid; - gistdoinsert(r, itup, &giststate); + gistdoinsert(r, itup, 0, &giststate); /* cleanup */ freeGISTstate(&giststate); @@ -253,7 +255,7 @@ gistinsert(PG_FUNCTION_ARGS) * so it does not bother releasing palloc'd allocations. */ static void -gistdoinsert(Relation r, IndexTuple itup, GISTSTATE *giststate) +gistdoinsert(Relation r, IndexTuple itup, Size freespace, GISTSTATE *giststate) { GISTInsertState state; @@ -263,6 +265,7 @@ gistdoinsert(Relation r, IndexTuple itup, GISTSTATE *giststate) state.itup[0] = (IndexTuple) palloc(IndexTupleSize(itup)); memcpy(state.itup[0], itup, IndexTupleSize(itup)); state.ituplen = 1; + state.freespace = freespace; state.r = r; state.key = itup->t_tid; state.needInsertComplete = true; @@ -294,7 +297,11 @@ gistplacetopage(GISTInsertState *state, GISTSTATE *giststate) */ - if (gistnospace(state->stack->page, state->itup, state->ituplen, (is_leaf) ? InvalidOffsetNumber : state->stack->childoffnum)) + /* + * XXX: If we want to change fillfactors between node and leaf, + * fillfactor = (is_leaf ? state->leaf_fillfactor : state->node_fillfactor) + */ + if (gistnospace(state->stack->page, state->itup, state->ituplen, (is_leaf) ? InvalidOffsetNumber : state->stack->childoffnum, state->freespace)) { /* no space for insertion */ IndexTuple *itvec; |