我正在查看7/01为 PostgreSQL安排的commit-fest,我看到 Pg 可能很快就会获得“身份列”。
我在information_schema.columns 中发现了一些提及但没什么
is_identity yes_or_no Applies to a feature not available in PostgreSQL
identity_generation character_data Applies to a feature not available in PostgreSQL
identity_start character_data Applies to a feature not available in PostgreSQL
identity_increment character_data Applies to a feature not available in PostgreSQL
identity_maximum character_data Applies to a feature not available in PostgreSQL
identity_minimum character_data Applies to a feature not available in PostgreSQL
identity_cycle yes_or_no Applies to a feature …
Run Code Online (Sandbox Code Playgroud) 我有一个 PostgreSQL 表设置作为队列/事件源。
我非常希望保留事件的“顺序”(即使在处理队列项之后)作为 e2e 测试的来源。
我开始遇到查询性能下降的问题(可能是因为表膨胀),并且我不知道如何有效地查询不断变化的键上的表。
Postgres:v15
CREATE TABLE eventsource.events (
id serial4 NOT NULL,
message jsonb NOT NULL,
status varchar(50) NOT NULL,
createdOn timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT events_pkey PRIMARY KEY (id)
);
CREATE INDEX ON eventsource.events (createdOn)
Run Code Online (Sandbox Code Playgroud)
BEGIN; -- Start transaction
SELECT message, status
FROM eventsource.events ee
WHERE status = 'PENDING'
ORDER BY ee.createdOn ASC
FOR UPDATE SKIP LOCKED
LIMIT 10; -- Get the OLDEST 10 events that are pending
-- I …
Run Code Online (Sandbox Code Playgroud)