Problem
Typing a user path into the audit-log search box is slow as the table grows. The box sends search=<text>, which the backend turns into a leading-wildcard %…% ILIKE against 11 columns at once (including the JSON data->>'error_message'), forcing a full table scan that no index can serve. The endpoint already has an indexed user_path= filter (idx_audit_user_path), but the search box never uses it — and it can't, because the box is a single free-text field.
Proposal
Replace the single free-text search box with per-field filter inputs (or a field dropdown + value box) so a path query hits the user_path index instead of the blanket scan — e.g. dedicated inputs for user_path, request_id, model, session_id, error_type. Keep the generic search only as an explicit opt-in, not the default.
Problem
Typing a user path into the audit-log search box is slow as the table grows. The box sends
search=<text>, which the backend turns into a leading-wildcard%…% ILIKEagainst 11 columns at once (including the JSONdata->>'error_message'), forcing a full table scan that no index can serve. The endpoint already has an indexeduser_path=filter (idx_audit_user_path), but the search box never uses it — and it can't, because the box is a single free-text field.Proposal
Replace the single free-text search box with per-field filter inputs (or a field dropdown + value box) so a path query hits the user_path index instead of the blanket scan — e.g. dedicated inputs for
user_path,request_id,model,session_id,error_type. Keep the generic search only as an explicit opt-in, not the default.