diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-03-29 00:17:27 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-03-29 00:17:27 +0000 |
| commit | 70c9763d4815ac847f0f7694f43eb6a59a236868 (patch) | |
| tree | 7d8aa05f668f1ef7809ff521b6c1e12d31125fd7 /src/backend/access/nbtree/nbtcompare.c | |
| parent | 119191609c507528b20d74c59be69f2129127575 (diff) | |
| download | postgresql-70c9763d4815ac847f0f7694f43eb6a59a236868.tar.gz | |
Convert oidvector and int2vector into variable-length arrays. This
change saves a great deal of space in pg_proc and its primary index,
and it eliminates the former requirement that INDEX_MAX_KEYS and
FUNC_MAX_ARGS have the same value. INDEX_MAX_KEYS is still embedded
in the on-disk representation (because it affects index tuple header
size), but FUNC_MAX_ARGS is not. I believe it would now be possible
to increase FUNC_MAX_ARGS at little cost, but haven't experimented yet.
There are still a lot of vestigial references to FUNC_MAX_ARGS, which
I will clean up in a separate pass. However, getting rid of it
altogether would require changing the FunctionCallInfoData struct,
and I'm not sure I want to buy into that.
Diffstat (limited to 'src/backend/access/nbtree/nbtcompare.c')
| -rw-r--r-- | src/backend/access/nbtree/nbtcompare.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/backend/access/nbtree/nbtcompare.c b/src/backend/access/nbtree/nbtcompare.c index aa0f75e814..a5c3fb567e 100644 --- a/src/backend/access/nbtree/nbtcompare.c +++ b/src/backend/access/nbtree/nbtcompare.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.50 2004/12/31 21:59:22 pgsql Exp $ + * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.51 2005/03/29 00:16:52 tgl Exp $ * * NOTES * @@ -198,15 +198,19 @@ btoidcmp(PG_FUNCTION_ARGS) Datum btoidvectorcmp(PG_FUNCTION_ARGS) { - Oid *a = (Oid *) PG_GETARG_POINTER(0); - Oid *b = (Oid *) PG_GETARG_POINTER(1); + oidvector *a = (oidvector *) PG_GETARG_POINTER(0); + oidvector *b = (oidvector *) PG_GETARG_POINTER(1); int i; - for (i = 0; i < INDEX_MAX_KEYS; i++) + /* We arbitrarily choose to sort first by vector length */ + if (a->dim1 != b->dim1) + PG_RETURN_INT32(a->dim1 - b->dim1); + + for (i = 0; i < a->dim1; i++) { - if (a[i] != b[i]) + if (a->values[i] != b->values[i]) { - if (a[i] > b[i]) + if (a->values[i] > b->values[i]) PG_RETURN_INT32(1); else PG_RETURN_INT32(-1); |
