Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
617dd33b
Commit
617dd33b
authored
20 years ago
by
Tom Lane
Browse files
Options
Downloads
Patches
Plain Diff
Eliminate duplicate hasnulls bit testing in index tuple access, and
clean up itup.h a little bit.
parent
926e8a00
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/backend/access/common/indextuple.c
+4
-5
4 additions, 5 deletions
src/backend/access/common/indextuple.c
src/include/access/ibit.h
+0
-32
0 additions, 32 deletions
src/include/access/ibit.h
src/include/access/itup.h
+29
-27
29 additions, 27 deletions
src/include/access/itup.h
with
33 additions
and
64 deletions
src/backend/access/common/indextuple.c
+
4
−
5
View file @
617dd33b
...
...
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/common/indextuple.c,v 1.7
3
2005/03/2
1 01:23:55
tgl Exp $
* $PostgreSQL: pgsql/src/backend/access/common/indextuple.c,v 1.7
4
2005/03/2
7 18:38:26
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -137,7 +137,7 @@ index_form_tuple(TupleDesc tupleDescriptor,
isnull
,
(
char
*
)
tp
+
hoff
,
&
tupmask
,
(
hasnull
?
(
bits8
*
)
tp
+
sizeof
(
*
tuple
)
:
NULL
));
(
hasnull
?
(
bits8
*
)
tp
+
sizeof
(
IndexTupleData
)
:
NULL
));
#ifdef TOAST_INDEX_HACK
for
(
i
=
0
;
i
<
numberOfAttributes
;
i
++
)
...
...
@@ -230,8 +230,7 @@ nocache_index_getattr(IndexTuple tup,
*
isnull
=
false
;
#endif
data_off
=
IndexTupleHasMinHeader
(
tup
)
?
sizeof
*
tup
:
IndexInfoFindDataOffset
(
tup
->
t_info
);
data_off
=
IndexInfoFindDataOffset
(
tup
->
t_info
);
attnum
--
;
...
...
@@ -256,7 +255,7 @@ nocache_index_getattr(IndexTuple tup,
*/
/* XXX "knows" t_bits are just after fixed tuple header! */
bp
=
(
bits8
*
)
((
char
*
)
tup
+
sizeof
(
*
tup
));
bp
=
(
bits8
*
)
((
char
*
)
tup
+
sizeof
(
IndexTupleData
));
#ifdef IN_MACRO
/* This is handled in the macro */
...
...
This diff is collapsed.
Click to expand it.
src/include/access/ibit.h
deleted
100644 → 0
+
0
−
32
View file @
926e8a00
/*-------------------------------------------------------------------------
*
* ibit.h
* POSTGRES index valid attribute bit map definitions.
*
*
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/access/ibit.h,v 1.23 2004/12/31 22:03:21 pgsql Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef IBIT_H
#define IBIT_H
typedef
struct
IndexAttributeBitMapData
{
bits8
bits
[(
INDEX_MAX_KEYS
+
8
-
1
)
/
8
];
}
IndexAttributeBitMapData
;
typedef
IndexAttributeBitMapData
*
IndexAttributeBitMap
;
#define IndexAttributeBitMapSize sizeof(IndexAttributeBitMapData)
/*
* IndexAttributeBitMapIsValid
* True iff attribute bit map is valid.
*/
#define IndexAttributeBitMapIsValid(bits) PointerIsValid(bits)
#endif
/* IBIT_H */
This diff is collapsed.
Click to expand it.
src/include/access/itup.h
+
29
−
27
View file @
617dd33b
...
...
@@ -7,19 +7,31 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/access/itup.h,v 1.4
2
2005/03/2
1 01:24:04
tgl Exp $
* $PostgreSQL: pgsql/src/include/access/itup.h,v 1.4
3
2005/03/2
7 18:38:27
tgl Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef ITUP_H
#define ITUP_H
#include
"access/ibit.h"
#include
"access/tupdesc.h"
#include
"access/tupmacs.h"
#include
"storage/itemptr.h"
/*
* Index tuple header structure
*
* All index tuples start with IndexTupleData. If the HasNulls bit is set,
* this is followed by an IndexAttributeBitMapData. The index attribute
* values follow, beginning at a MAXALIGN boundary.
*
* Note that the space allocated for the bitmap does not vary with the number
* of attributes; that is because we don't have room to store the number of
* attributes in the header. Given the MAXALIGN constraint there's no space
* savings to be had anyway, for usual values of INDEX_MAX_KEYS.
*/
typedef
struct
IndexTupleData
{
ItemPointerData
t_tid
;
/* reference TID to heap tuple */
...
...
@@ -36,44 +48,40 @@ typedef struct IndexTupleData
unsigned
short
t_info
;
/* various info about tuple */
/*
* please make sure sizeof(IndexTupleData) is MAXALIGN'ed. See
* IndexInfoFindDataOffset() for the reason.
*/
}
IndexTupleData
;
/* MORE DATA FOLLOWS AT END OF STRUCT */
typedef
IndexTupleData
*
IndexTuple
;
typedef
struct
IndexAttributeBitMapData
{
bits8
bits
[(
INDEX_MAX_KEYS
+
8
-
1
)
/
8
];
}
IndexAttributeBitMapData
;
/* ----------------
* externs
* ----------------
*/
typedef
IndexAttributeBitMapData
*
IndexAttributeBitMap
;
/*
* t_info manipulation macros
*/
#define INDEX_SIZE_MASK 0x1FFF
#define INDEX_NULL_MASK
0x
8
000
/* bit
0x
2
000
is not used at present */
#define INDEX_VAR_MASK 0x4000
/* bit
0x
2
000
is not used */
#define INDEX_NULL_MASK
0x
8
000
#define IndexTupleSize(itup) ((Size) (((IndexTuple) (itup))->t_info & INDEX_SIZE_MASK))
#define IndexTupleDSize(itup) ((Size) ((itup).t_info & INDEX_SIZE_MASK))
#define IndexTupleHasNulls(itup) ((((IndexTuple) (itup))->t_info & INDEX_NULL_MASK))
#define IndexTupleHasVarwidths(itup) ((((IndexTuple) (itup))->t_info & INDEX_VAR_MASK))
#define IndexTupleHasMinHeader(itup) (!IndexTupleHasNulls(itup))
/*
* Takes an infomask as argument (primarily because this needs to be usable
* at index_form_tuple time so enough space is allocated).
*
* Change me if adding an attribute to IndexTuples!!!!!!!!!!!
*/
#define IndexInfoFindDataOffset(t_info) \
( \
(!((
unsigned short)(
t_info) & INDEX_NULL_MASK)) ? \
(!((t_info) & INDEX_NULL_MASK)) ? \
( \
(Size)sizeof(IndexTupleData) \
(Size)
MAXALIGN(
sizeof(IndexTupleData)
)
\
) \
: \
( \
...
...
@@ -85,7 +93,7 @@ typedef IndexTupleData *IndexTuple;
* index_getattr
*
* This gets called many times, so we macro the cacheable and NULL
* lookups, and call no
n
cachegetattr() for the rest.
* lookups, and call nocache
_index_
getattr() for the rest.
*
* ----------------
*/
...
...
@@ -98,13 +106,7 @@ typedef IndexTupleData *IndexTuple;
(tupleDesc)->attrs[(attnum)-1]->attcacheoff >= 0 ? \
( \
fetchatt((tupleDesc)->attrs[(attnum)-1], \
(char *) (tup) + \
( \
IndexTupleHasMinHeader(tup) ? \
sizeof (*(tup)) \
: \
IndexInfoFindDataOffset((tup)->t_info) \
) \
(char *) (tup) + IndexInfoFindDataOffset((tup)->t_info) \
+ (tupleDesc)->attrs[(attnum)-1]->attcacheoff) \
) \
: \
...
...
@@ -112,7 +114,7 @@ typedef IndexTupleData *IndexTuple;
) \
: \
( \
(att_isnull((attnum)-1, (char *)(tup) + sizeof(
*(tup)
))) ? \
(att_isnull((attnum)-1, (char *)(tup) + sizeof(
IndexTupleData
))) ? \
( \
*(isnull) = true, \
(Datum)NULL \
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment