about summary refs log tree commit diff
path: root/gn_libs
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi <fredmanglis@gmail.com>2026-11-11 17:14:45 +0000
committerFrederick Muriuki Muriithi <fredmanglis@gmail.com>2026-11-11 13:12:20 -0600
commit1cb56e96f9d748ff7a18a5e845a246ff4ee53b41 (patch)
tree908fee52ef724c752dffe838d7ce8458aab5dc39 /gn_libs
parentcf930d1335d894b468e8e0d8f600a50515ecee36 (diff)
downloadgn-libs-1cb56e96f9d748ff7a18a5e845a246ff4ee53b41.tar.gz
Index the jobs metadata by key and value
Add a `(metadata_key, metadata_value)` index to `jobs_metadata` so jobs can be
looked up by their metadata without scanning the table.

Co-authored-by: pi coding agent <pi@pi.dev>
Diffstat (limited to 'gn_libs')
-rw-r--r--gn_libs/jobs/migrations.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/gn_libs/jobs/migrations.py b/gn_libs/jobs/migrations.py
index 2af16ae..a30a3fd 100644
--- a/gn_libs/jobs/migrations.py
+++ b/gn_libs/jobs/migrations.py
@@ -32,6 +32,11 @@ def __create_table_jobs_metadata__(cursor: DbCursor):
         CREATE INDEX IF NOT EXISTS idx_tbl_jobs_metadata_cols_job_id
         ON jobs_metadata(job_id)
         """)
+    cursor.execute(
+        """
+        CREATE INDEX IF NOT EXISTS idx_tbl_jobs_metadata_cols_key_value
+        ON jobs_metadata(metadata_key, metadata_value)
+        """)
 
 
 def __create_table_jobs_output_streams__(cursor: DbCursor):