Re: Allowing DESC for a PRIMARY KEY column

2024-03-29 Thread Mitar
Hi! On Fri, Mar 29, 2024 at 9:41 PM Tom Lane wrote: > You would need a lot stronger case than "I didn't bother checking > whether I really need this". Thanks! I have tested it this way (based on your example): create table t (id int not null, revision int not null); create unique index on t

Re: Allowing DESC for a PRIMARY KEY column

2024-03-29 Thread Tom Lane
Mitar writes: > And I would like to be able to specify PRIMARY KEY (id, revision DESC) > because the most common query I am making is: > SELECT data FROM values WHERE id=123 ORDER BY revision DESC LIMIT 1 Did you experiment with whether that actually needs a special index? I get regression=#

Allowing DESC for a PRIMARY KEY column

2024-03-29 Thread Mitar
Hi! I have the same problem as [1]. I have table something like: CREATE TABLE values ( id int NOT NULL, revision int NOT NULL, data jsonb NOT NULL, PRIMARY KEY (id, revision) ) And I would like to be able to specify PRIMARY KEY (id, revision DESC) because the most common query I am