edoceo / pg-ulid Goto Github PK
View Code? Open in Web Editor NEWULID Functions for PostgreSQL
ULID Functions for PostgreSQL
Creates a ULID datatype as a 128bit integer, which we hope operates faster than text.
When in pg_ulid--0.0.4.sql
CREATE FUNCTION ulid_create()
RETURNS text
LANGUAGE C
VOLATILE STRICT
AS '$libdir/pg_ulid';
Hello,
Following the readme, execution of ulid_create with a timestamp returns the following error:
SELECT ulid_create(now() - '37 days'::interval);
ERROR: function ulid_create(timestamp with time zone) does not exist
LINE 1: SELECT ulid_create(now() - '37 days'::interval);
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
SQL state: 42883
Character: 8
Hello,
In case you would like to update the README with some benchmarks, I compared them as follows.
--
-- AMD Ryzen 3400G, PG13, WSL Ubuntu 20.04
--
-- Generation
-- uuid-ossp
-- "Execution Time: 2712.880 ms"
explain analyze SELECT uuid_generate_v4()
FROM generate_series(1, 499000) t(i);
-- "Execution Time: 5083.430 ms"
explain analyze SELECT ulid_create()
FROM generate_series(1, 499000) t(i);
-- "Execution Time: 5927.542 ms"
explain analyze SELECT generate_ulid()
FROM generate_series(1, 499000) t(i);
-- Inserts
-- INSERT 0 499000 uuid_generate_v4()
-- Query returned successfully in 6 secs 748 msec.
-- INSERT 0 499000 ulid_create()
-- Query returned successfully in 8 secs 529 msec.
-- INSERT 0 499000 generate_ulid()
-- Query returned successfully in 12 secs 99 msec.
Linux version 5.10.76-linuxkit (root@buildkitsandbox) (gcc (Alpine 10.2.1_pre1) 10.2.1 20201203, GNU ld (GNU Binutils) 2.35.2) #1 SMP Mon Nov 8 10:21:19 UTC 2021
root@0046bd9d2463:/usr/src/ulid-c# git clone https://github.com/skeeto/ulid-c.git
Cloning into 'ulid-c'...
remote: Enumerating objects: 116, done.
remote: Total 116 (delta 0), reused 0 (delta 0), pack-reused 116
Receiving objects: 100% (116/116), 22.24 KiB | 437.00 KiB/s, done.
Resolving deltas: 100% (68/68), done.
root@0046bd9d2463:/usr/src# apt install build-essential postgresql-server-dev-14
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
.....
root@0046bd9d2463:/usr/src/ulid-c# make install-strip
make: *** No rule to make target 'install-strip'. Stop.
I'm sorry, but it's unclear how to build and install the extension
Hello,
Thank you for the extension.
build.txt
I followed the instruction to build the extension, but while creating the test table, I get this error
ERROR: type "ulid" does not exist
LINE 2: id ulid not null default ulid_create(),
SELECT ulid_create();
works fine, and returns the ulid.
Attached is the build log.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.