Skip to content
/ pg_etag Public

Fast ETag generation for rows and result sets with BLAKE2 hashes.

License

Notifications You must be signed in to change notification settings

ergo70/pg_etag

Repository files navigation

pg_etag

Fast ETag generation for rows and result sets with BLAKE2 hashes.

Installation

pg_etag needs libb2

Example

Fast client (SQL Tabs)

CREATE TABLE omr AS SELECT t.t AS id, clock_timestamp() AS ts, NULL::TEXT AS etag FROM generate_series(1,1000000) t

UPDATE omr SET etag=etag(id::TEXT || ts::TEXT)

ALTER TABLE omr
  ADD CONSTRAINT pk_omr PRIMARY KEY (id);

Query:

SELECT * FROM omr WHERE id BETWEEN 500 AND 1700 ORDER BY id ASC;

~ 5 ms

ETag of query result:

SELECT etag_agg(t.etag) FROM (SELECT etag FROM omr WHERE id BETWEEN 500 AND 1700 ORDER BY id ASC) t;

~ 1.5 ms

Slow client (pgAdmin3)

Query:

SELECT * FROM omr WHERE id BETWEEN 500 AND 1700 ORDER BY id ASC;

~ 145 ms

ETag of query result:

SELECT etag_agg(t.etag) FROM (SELECT etag FROM omr WHERE id BETWEEN 500 AND 1700 ORDER BY id ASC) t;

~ 11 ms

About

Fast ETag generation for rows and result sets with BLAKE2 hashes.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published