From cabd894779c2d2e453c8ed7771fdbd17c881bc2c Mon Sep 17 00:00:00 2001
From: Dan Goodliffe <dan@randomdan.homeip.net>
Date: Tue, 19 May 2026 00:53:27 +0100
Subject: Add index for uninsertable lines with no failure detail

This index would be empty under normal conditions.
---
 src/schema.sql | 4 ++++
 1 file changed, 4 insertions(+)

(limited to 'src/schema.sql')

diff --git a/src/schema.sql b/src/schema.sql
index e09be28..0d9fcb4 100644
--- a/src/schema.sql
+++ b/src/schema.sql
@@ -42,6 +42,10 @@ CREATE TABLE entities(
 
 CREATE UNIQUE INDEX uni_entities_value ON entities(MD5(value));
 
+CREATE INDEX idx_entities_retryinsert ON entities(id)
+WHERE
+	type = 'uninsertable_line' AND detail IS NULL;
+
 CREATE OR REPLACE FUNCTION entity(newValue text, newType entity)
 	RETURNS TABLE(
 		id integer,
-- 
cgit v1.3

