timestamp9

timestamp nanosecond resolution

Overview

PackageVersionCategoryLicenseLanguage
timestamp91.4.0TYPEMITC
IDExtensionBinLibLoadCreateTrustRelocSchema
3890timestamp9NoYesNoYesNoNo-
Relatedprefix semver unit pgpdf pglite_fusion md5hash asn1oid roaringbitmap

Version

TypeRepoVersionPG VerPackageDeps
EXTMIXED1.4.01817161514timestamp9-
RPMPGDG1.4.01817161514timestamp9_$v-
DEBPIGSTY1.4.01817161514postgresql-$v-timestamp9-
OS / PGPG18PG17PG16PG15PG14
el8.x86_64
el8.aarch64
el9.x86_64
el9.aarch64
el10.x86_64
el10.aarch64
d12.x86_64
d12.aarch64
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
d13.x86_64
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
d13.aarch64
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
u22.x86_64
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
u22.aarch64
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
u24.x86_64
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
u24.aarch64
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0

Build

You can build the DEB packages for timestamp9 using pig build:

pig build pkg timestamp9         # build DEB packages

Install

You can install timestamp9 directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:

pig repo add pgsql -u          # Add repo and update cache

Install the extension using pig or apt/yum/dnf:

pig install timestamp9;          # Install for current active PG version
pig ext install -y timestamp9 -v 18  # PG 18
pig ext install -y timestamp9 -v 17  # PG 17
pig ext install -y timestamp9 -v 16  # PG 16
pig ext install -y timestamp9 -v 15  # PG 15
pig ext install -y timestamp9 -v 14  # PG 14
dnf install -y timestamp9_18       # PG 18
dnf install -y timestamp9_17       # PG 17
dnf install -y timestamp9_16       # PG 16
dnf install -y timestamp9_15       # PG 15
dnf install -y timestamp9_14       # PG 14
apt install -y postgresql-18-timestamp9   # PG 18
apt install -y postgresql-17-timestamp9   # PG 17
apt install -y postgresql-16-timestamp9   # PG 16
apt install -y postgresql-15-timestamp9   # PG 15
apt install -y postgresql-14-timestamp9   # PG 14

Create Extension:

CREATE EXTENSION timestamp9;

Usage

timestamp9: nanosecond precision timestamp type for PostgreSQL

The timestamp9 extension provides a nanosecond-precision timestamp type stored as a 64-bit integer (nanoseconds since UNIX epoch).

CREATE EXTENSION timestamp9;

Data Type

The timestamp9 type supports timestamps from 1970-01-01 to 2262-04-12 with nanosecond precision.

Input Formats

-- Standard PostgreSQL format
SELECT '2019-09-19 08:30:05'::timestamp9;

-- Full nanosecond precision with timezone
SELECT '2019-09-19 08:30:05.123456789 +0200'::timestamp9;

-- Cast from bigint (nanoseconds since epoch)
SELECT 1568878205123456789::bigint::timestamp9;

Type Conversions

  • Cast to/from timestamp and timestamptz
  • Cast to/from date

Nanosecond precision is preserved throughout conversions.

Operators

-- Comparison
SELECT '2019-09-19'::timestamp9 > '2019-09-18'::timestamp9;  -- true

-- Arithmetic with intervals
SELECT '2019-09-19 23:00:00.123456789'::timestamp9 + interval '1 day';

-- Subtraction
SELECT '2019-09-20'::timestamp9 - '2019-09-19'::timestamp9;

Functions

SELECT greatest('2019-09-19'::timestamp9, '2019-09-20'::timestamp9);

Index Support

Btree and hash indexes are supported.


Last Modified 2026-03-12: add pg extension catalog (95749bf)