Skip to content

Commit 1f7ef54

Browse files
committed
Changes
* new split algorithm (as proposed in http://archives.postgresql.org/pgsql-hackers/2006-06/msg00254.php) * possible call pickSplit() for second and below columns * add spl_(l|r)datum_exists to GIST_SPLITVEC - pickSplit should check its values to use already defined spl_(l|r)datum for splitting. pickSplit should set spl_(l|r)datum_exists to 'false' (if they was 'true') to signal to caller about using spl_(l|r)datum. * support for old pickSplit(): not very optimal but correct split * remove 'bytes' field from GISTENTRY: in any case size of value is defined by it's type. * split GIST_SPLITVEC to two structures: one for using in picksplit and second - for internal use. * some code refactoring * support of subsplit to rtree opclasses TODO: add support of subsplit to contrib modules
1 parent a1dc5c6 commit 1f7ef54

File tree

23 files changed

+266
-645
lines changed

23 files changed

+266
-645
lines changed

contrib/btree_gist/btree_inet.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ gbt_inet_compress(PG_FUNCTION_ARGS)
100100
r->upper = r->lower;
101101
gistentryinit(*retval, PointerGetDatum(r),
102102
entry->rel, entry->page,
103-
entry->offset, sizeof(inetKEY), FALSE);
103+
entry->offset, FALSE);
104104
}
105105
else
106106
retval = entry;

contrib/btree_gist/btree_interval.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ gbt_intv_compress(PG_FUNCTION_ARGS)
129129
}
130130
gistentryinit(*retval, PointerGetDatum(r),
131131
entry->rel, entry->page,
132-
entry->offset, 2 * INTERVALSIZE, FALSE);
132+
entry->offset, FALSE);
133133
}
134134

135135
PG_RETURN_POINTER(retval);
@@ -153,7 +153,7 @@ gbt_intv_decompress(PG_FUNCTION_ARGS)
153153

154154
gistentryinit(*retval, PointerGetDatum(r),
155155
entry->rel, entry->page,
156-
entry->offset, sizeof(intvKEY), FALSE);
156+
entry->offset, FALSE);
157157
}
158158
PG_RETURN_POINTER(retval);
159159
}

contrib/btree_gist/btree_text.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ gbt_bpchar_compress(PG_FUNCTION_ARGS)
115115

116116
gistentryinit(trim, d,
117117
entry->rel, entry->page,
118-
entry->offset, VARSIZE(DatumGetPointer(d)), TRUE);
118+
entry->offset, TRUE);
119119
retval = gbt_var_compress(&trim, &tinfo);
120120
}
121121
else

contrib/btree_gist/btree_time.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ gbt_timetz_compress(PG_FUNCTION_ARGS)
137137
r->lower = r->upper = tmp;
138138
gistentryinit(*retval, PointerGetDatum(r),
139139
entry->rel, entry->page,
140-
entry->offset, sizeof(timeKEY), FALSE);
140+
entry->offset, FALSE);
141141
}
142142
else
143143
retval = entry;

contrib/btree_gist/btree_ts.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ gbt_tstz_compress(PG_FUNCTION_ARGS)
159159
r->lower = r->upper = gmt;
160160
gistentryinit(*retval, PointerGetDatum(r),
161161
entry->rel, entry->page,
162-
entry->offset, sizeof(tsKEY), FALSE);
162+
entry->offset, FALSE);
163163
}
164164
else
165165
retval = entry;

contrib/btree_gist/btree_utils_num.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ gbt_num_compress(GISTENTRY *retval, GISTENTRY *entry, const gbtree_ninfo * tinfo
4646
memcpy((void *) &r[tinfo->size], leaf, tinfo->size);
4747
retval = palloc(sizeof(GISTENTRY));
4848
gistentryinit(*retval, PointerGetDatum(r), entry->rel, entry->page,
49-
entry->offset, (2 * tinfo->size), FALSE);
49+
entry->offset, FALSE);
5050
}
5151
else
5252
retval = entry;

contrib/btree_gist/btree_utils_var.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ gbt_var_decompress(PG_FUNCTION_ARGS)
1919

2020
gistentryinit(*retval, PointerGetDatum(key),
2121
entry->rel, entry->page,
22-
entry->offset, VARSIZE(key), FALSE);
22+
entry->offset, FALSE);
2323

2424
PG_RETURN_POINTER(retval);
2525
}
@@ -292,7 +292,7 @@ gbt_var_compress(GISTENTRY *entry, const gbtree_vinfo * tinfo)
292292
retval = palloc(sizeof(GISTENTRY));
293293
gistentryinit(*retval, PointerGetDatum(r),
294294
entry->rel, entry->page,
295-
entry->offset, VARSIZE(r), TRUE);
295+
entry->offset, TRUE);
296296
}
297297
else
298298
retval = entry;

contrib/cube/cube.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/******************************************************************************
2-
$PostgreSQL: pgsql/contrib/cube/cube.c,v 1.25 2006/05/30 22:12:12 tgl Exp $
2+
$PostgreSQL: pgsql/contrib/cube/cube.c,v 1.26 2006/06/28 11:59:59 teodor Exp $
33
44
This file contains routines that can be bound to a Postgres backend and
55
called by the backend in the process of processing queries. The calling
@@ -300,8 +300,8 @@ g_cube_picksplit(GistEntryVector *entryvec,
300300
double size_l,
301301
size_r;
302302
int nbytes;
303-
OffsetNumber seed_1 = 0,
304-
seed_2 = 0;
303+
OffsetNumber seed_1 = 1,
304+
seed_2 = 2;
305305
OffsetNumber *left,
306306
*right;
307307
OffsetNumber maxoff;

contrib/intarray/_int_gist.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ g_int_compress(PG_FUNCTION_ARGS)
154154

155155
retval = palloc(sizeof(GISTENTRY));
156156
gistentryinit(*retval, PointerGetDatum(r),
157-
entry->rel, entry->page, entry->offset, VARSIZE(r), FALSE);
157+
entry->rel, entry->page, entry->offset, FALSE);
158158

159159
PG_RETURN_POINTER(retval);
160160
}
@@ -201,7 +201,7 @@ g_int_compress(PG_FUNCTION_ARGS)
201201
r = resize_intArrayType(r, len);
202202
retval = palloc(sizeof(GISTENTRY));
203203
gistentryinit(*retval, PointerGetDatum(r),
204-
entry->rel, entry->page, entry->offset, VARSIZE(r), FALSE);
204+
entry->rel, entry->page, entry->offset, FALSE);
205205
PG_RETURN_POINTER(retval);
206206
}
207207
else
@@ -238,7 +238,7 @@ g_int_decompress(PG_FUNCTION_ARGS)
238238
{
239239
retval = palloc(sizeof(GISTENTRY));
240240
gistentryinit(*retval, PointerGetDatum(in),
241-
entry->rel, entry->page, entry->offset, VARSIZE(in), FALSE);
241+
entry->rel, entry->page, entry->offset, FALSE);
242242

243243
PG_RETURN_POINTER(retval);
244244
}
@@ -260,7 +260,7 @@ g_int_decompress(PG_FUNCTION_ARGS)
260260
pfree(in);
261261
retval = palloc(sizeof(GISTENTRY));
262262
gistentryinit(*retval, PointerGetDatum(r),
263-
entry->rel, entry->page, entry->offset, VARSIZE(r), FALSE);
263+
entry->rel, entry->page, entry->offset, FALSE);
264264

265265
PG_RETURN_POINTER(retval);
266266
}

contrib/intarray/_intbig_gist.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ g_intbig_compress(PG_FUNCTION_ARGS)
172172
retval = (GISTENTRY *) palloc(sizeof(GISTENTRY));
173173
gistentryinit(*retval, PointerGetDatum(res),
174174
entry->rel, entry->page,
175-
entry->offset, res->len, FALSE);
175+
entry->offset, FALSE);
176176

177177
if (in != (ArrayType *) PG_DETOAST_DATUM(entry->key))
178178
pfree(in);
@@ -198,7 +198,7 @@ g_intbig_compress(PG_FUNCTION_ARGS)
198198
retval = (GISTENTRY *) palloc(sizeof(GISTENTRY));
199199
gistentryinit(*retval, PointerGetDatum(res),
200200
entry->rel, entry->page,
201-
entry->offset, res->len, FALSE);
201+
entry->offset, FALSE);
202202

203203
PG_RETURN_POINTER(retval);
204204
}

0 commit comments

Comments
 (0)