↑↓ select ↵ open ⌫ change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

Wiki / Operator Families / B-tree classes

btree/timestamp_ops (class)

B-tree operator class for timestamp; member of datetime_ops.

Reading PostgreSQL 18.6.

Description

B-tree operator class for timestamp; member of datetime_ops.

Object kind
Operator class
Index AM
B-tree
Input type
timestamp
Stored key type
Same as input type (catalog zero)
Default class
yes

Usage

btree/timestamp_ops

Operator classes and families

An index definition can specify an operator class for each column of an index.

The operator class identifies the operators to be used by the index for that column. For example, a B-tree index on the type int4 would use the int4_ops class; this operator class includes comparison functions for values of type int4 . In practice the default operator class for the column's data type is usually sufficient. The main reason for having operator classes is that for some data types, there could be more than one meaningful index behavior. For example, we might want to sort a complex-number data type either by absolute value or by real part. We could do this by defining two operator classes for the data type and then selecting the proper class when making an index. The operator class determines the basic sort ordering (which can then be modified by adding sort options COLLATE , ASC / DESC and/or NULLS FIRST / NULLS LAST ).

There are also some built-in operator classes besides the default ones:

Family operator strategies

Operator overloadStrategyPurposeOrdering familyMembership scopeSource description
<(date,date)1searchFamily memberless than
<=(date,date)2searchFamily memberless than or equal
=(date,date)3searchFamily memberequal
>=(date,date)4searchFamily membergreater than or equal
>(date,date)5searchFamily membergreater than
<(date,timestamp)1searchFamily memberless than
<=(date,timestamp)2searchFamily memberless than or equal
=(date,timestamp)3searchFamily memberequal
>=(date,timestamp)4searchFamily membergreater than or equal
>(date,timestamp)5searchFamily membergreater than
<(date,timestamptz)1searchFamily memberless than
<=(date,timestamptz)2searchFamily memberless than or equal
=(date,timestamptz)3searchFamily memberequal
>=(date,timestamptz)4searchFamily membergreater than or equal
>(date,timestamptz)5searchFamily membergreater than
<(timestamp,timestamp)1searchClass input pairless than
<=(timestamp,timestamp)2searchClass input pairless than or equal
=(timestamp,timestamp)3searchClass input pairequal
>=(timestamp,timestamp)4searchClass input pairgreater than or equal
>(timestamp,timestamp)5searchClass input pairgreater than
<(timestamp,date)1searchFamily memberless than
<=(timestamp,date)2searchFamily memberless than or equal
=(timestamp,date)3searchFamily memberequal
>=(timestamp,date)4searchFamily membergreater than or equal
>(timestamp,date)5searchFamily membergreater than
<(timestamp,timestamptz)1searchFamily memberless than
<=(timestamp,timestamptz)2searchFamily memberless than or equal
=(timestamp,timestamptz)3searchFamily memberequal
>=(timestamp,timestamptz)4searchFamily membergreater than or equal
>(timestamp,timestamptz)5searchFamily membergreater than
<(timestamptz,timestamptz)1searchFamily memberless than
<=(timestamptz,timestamptz)2searchFamily memberless than or equal
=(timestamptz,timestamptz)3searchFamily memberequal
>=(timestamptz,timestamptz)4searchFamily membergreater than or equal
>(timestamptz,timestamptz)5searchFamily membergreater than
<(timestamptz,date)1searchFamily memberless than
<=(timestamptz,date)2searchFamily memberless than or equal
=(timestamptz,date)3searchFamily memberequal
>=(timestamptz,date)4searchFamily membergreater than or equal
>(timestamptz,date)5searchFamily membergreater than
<(timestamptz,timestamp)1searchFamily memberless than
<=(timestamptz,timestamp)2searchFamily memberless than or equal
=(timestamptz,timestamp)3searchFamily memberequal
>=(timestamptz,timestamp)4searchFamily membergreater than or equal
>(timestamptz,timestamp)5searchFamily membergreater than

Family support functions

Support numberLeft typeRight typeFunction signatureResult type
1datedatedate_cmp(date,date)int4
2datedatedate_sortsupport(internal)void
4datedatebtequalimage(oid)bool
6datedatedate_skipsupport(internal)void
1datetimestampdate_cmp_timestamp(date,timestamp)int4
1datetimestamptzdate_cmp_timestamptz(date,timestamptz)int4
1timestamptimestamptimestamp_cmp(timestamp,timestamp)int4
2timestamptimestamptimestamp_sortsupport(internal)void
4timestamptimestampbtequalimage(oid)bool
6timestamptimestamptimestamp_skipsupport(internal)void
1timestampdatetimestamp_cmp_date(timestamp,date)int4
1timestamptimestamptztimestamp_cmp_timestamptz(timestamp,timestamptz)int4
1timestamptztimestamptztimestamptz_cmp(timestamptz,timestamptz)int4
2timestamptztimestamptztimestamp_sortsupport(internal)void
4timestamptztimestamptzbtequalimage(oid)bool
6timestamptztimestamptztimestamp_skipsupport(internal)void
1timestamptzdatetimestamptz_cmp_date(timestamptz,date)int4
1timestamptztimestamptimestamptz_cmp_timestamp(timestamptz,timestamp)int4
3dateintervalin_range(date,date,interval,bool,bool)bool
3timestampintervalin_range(timestamp,timestamp,interval,bool,bool)bool
3timestamptzintervalin_range(timestamptz,timestamptz,interval,bool,bool)bool

Classes in this family

ClassInput typeKey typeDefault
date_opsdateSame as input typeyes
timestamptz_opstimestamptzSame as input typeyes
timestamp_opstimestampSame as input typeyes

Related entries

Documentation and source

Source build
Version
18.6
Build
https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2
Source fingerprint
555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f

Compare versions

PostgreSQL 17 → 18: changed.

--- PostgreSQL 17
+++ PostgreSQL 18
@@ -648,6 +648,33 @@
       "number": "4",
       "result_type": "bool",
       "right_type": "timestamptz"
+    },
+    {
+      "family": "datetime_ops",
+      "function": "date_skipsupport(internal)",
+      "left_type": "date",
+      "method": "btree",
+      "number": "6",
+      "result_type": "void",
+      "right_type": "date"
+    },
+    {
+      "family": "datetime_ops",
+      "function": "timestamp_skipsupport(internal)",
+      "left_type": "timestamp",
+      "method": "btree",
+      "number": "6",
+      "result_type": "void",
+      "right_type": "timestamp"
+    },
+    {
+      "family": "datetime_ops",
+      "function": "timestamp_skipsupport(internal)",
+      "left_type": "timestamptz",
+      "method": "btree",
+      "number": "6",
+      "result_type": "void",
+      "right_type": "timestamptz"
     }
   ]
 }

Compares recorded interfaces and attributes. Source fingerprints and build metadata are excluded; an absent sample is not proof of the introduction or removal release.

Related entries

Export JSON · Back to Operator Families · Recorded in PostgreSQL 10 through 20; the first sample is not necessarily its introduction.