From 9074f614876a755aa0d43b3de6d50626c9eed9dd Mon Sep 17 00:00:00 2001 From: Jacopo Farina Date: Tue, 26 Mar 2024 22:49:22 +0100 Subject: [PATCH] Create an index on can_start_at too --- postgrestq/task_queue.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/postgrestq/task_queue.py b/postgrestq/task_queue.py index cb16761..f6deb17 100644 --- a/postgrestq/task_queue.py +++ b/postgrestq/task_queue.py @@ -98,6 +98,14 @@ def _create_queue_table(self) -> None: )""" ).format(sql.Identifier(self._table_name)) ) + cur.execute( + sql.SQL( + """CREATE INDEX IF NOT EXISTS + task_queue_can_start_at_idx + ON {} (can_start_at) + """ + ).format(sql.Identifier(self._table_name)) + ) def __len__(self) -> int: """