From 15c7221f9ab1cbdca87a3bcb13975ec8099b3f9b Mon Sep 17 00:00:00 2001 From: Kevin Cotugno Date: Sun, 10 Sep 2017 13:06:53 -0700 Subject: [PATCH] Better database index --- config/postgres.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/postgres.sql b/config/postgres.sql index 580a7a3..8824e87 100644 --- a/config/postgres.sql +++ b/config/postgres.sql @@ -8,8 +8,8 @@ CREATE TABLE trades ( sell BOOLEAN NOT NULL DEFAULT FALSE, timestamp TIMESTAMPTZ NOT NULL); -CREATE UNIQUE INDEX trade_id_product_INDEX ON trades ( - trade_id, - product); +CREATE UNIQUE INDEX product_trade_id_index ON trades ( + product, + trade_id); CREATE INDEX timestamp_index ON trades (timestamp);