From 9294f3663712dbc60da1dc575278b47e9e56c6fa Mon Sep 17 00:00:00 2001
From: Christian Grothoff <grothoff@gnunet.org>
Date: Tue, 17 Oct 2023 10:52:06 +0200
Subject: -remove dead index, add comment on live index

---
 src/exchangedb/0002-reserves_in.sql | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

(limited to 'src/exchangedb/0002-reserves_in.sql')

diff --git a/src/exchangedb/0002-reserves_in.sql b/src/exchangedb/0002-reserves_in.sql
index 1dfc5db69..197a815b3 100644
--- a/src/exchangedb/0002-reserves_in.sql
+++ b/src/exchangedb/0002-reserves_in.sql
@@ -83,22 +83,18 @@ BEGIN
     'ON ' || table_name || ' '
     '(reserve_in_serial_id);'
   );
-  -- FIXME: where do we need this index? Can we do better?
-  EXECUTE FORMAT (
-    'CREATE INDEX ' || table_name || '_by_exch_accnt_section_execution_date_idx '
-    'ON ' || table_name || ' '
-    '(exchange_account_section '
-    ',execution_date'
-    ');'
-  );
-  -- FIXME: where do we need this index? Can we do better?
   EXECUTE FORMAT (
     'CREATE INDEX ' || table_name || '_by_exch_accnt_reserve_in_serial_id_idx '
     'ON ' || table_name || ' '
     '(exchange_account_section'
-    ',reserve_in_serial_id DESC'
+    ',reserve_in_serial_id ASC'
     ');'
   );
+  EXECUTE FORMAT (
+    'COMMENT ON INDEX ' || table_name || '_by_exch_accnt_reserve_in_serial_id_idx '
+    'IS ' || quote_literal ('for pg_select_reserves_in_above_serial_id_by_account') || ';'
+  ); 
+
 END
 $$;
 
-- 
cgit v1.2.3

