add index on wire_targets

- better performance on local db
- many queries use wire_target_serial_id as join condition -> discussion use this as shard key?
This commit is contained in:
Marco Boss 2022-02-26 17:37:52 +01:00
parent f11cab90ff
commit 99dd36f7f6
No known key found for this signature in database
GPG Key ID: 89A3EC33C625C3DF

View File

@ -88,6 +88,14 @@ CREATE TABLE IF NOT EXISTS wire_targets_default
PARTITION OF wire_targets
FOR VALUES WITH (MODULUS 1, REMAINDER 0);
-- FIXME partition by serial_id rather than h_payto,
-- it is used more in join conditions - crucial for sharding to select this.
-- Author: (Boss Marco)
CREATE INDEX IF NOT EXISTS wire_targets_serial_id_index
ON wire_targets
(wire_target_serial_id
);
CREATE TABLE IF NOT EXISTS reserves
(reserve_uuid BIGINT GENERATED BY DEFAULT AS IDENTITY
,reserve_pub BYTEA PRIMARY KEY CHECK(LENGTH(reserve_pub)=32)