I'm currently working on a postgresql 15 database.
I've created a data table named "measures" with following schema
CREATE TABLE measures ( timestamp TIMESTAMPTZ NOT NULL, value double precision, variable_id INTEGER REFERENCES variables(id) ON DELETE CASCADE, PRIMARY KEY (variable_id, timestamp) ) When iI create this table, the primary key (variable_id, timestamp) createcreates a unique constraint with a unique index.
My problem is that the default index is ordered ASC. I have a need to add another index like this
CREATE UNIQUE INDEX IF NOT EXISTS _index_measure_timestamp_variable ON measures (timestamp DESC, variable_id DESC ); It createcreates another index which is duplicated with the constraint index. The only difference is the order.
My questions are:
- after the creation of the second index, can iI remove the constraint index ?
- If iI can't remove the constraint index is it possible to change the order of aan index ?
- If not should iI keep the two index indexes?
Thx for your help.