pangolin/server/db/sqlite
Parikshith 41139f2fd0
perf: add secondary FK indexes to core OSS schemas
Add 13 secondary indexes across 10 tables in the SQLite schema and
5 missing indexes to the PostgreSQL schema.

All list endpoints (listSites, listResources, listClients, listRoles,
listTargets, listUserOrgs) filter and join on these FK columns. In the
SQLite schema, no secondary indexes existed at all on these foreign keys,
forcing full sequential scans on every paginated request and session lookup.

SQLite changes (13 new indexes):
  - sites.orgId
  - resources.orgId
  - targets.resourceId, targets.siteId
  - newt.siteId
  - clients.orgId, clients.userId
  - labels.orgId
  - olms.userId
  - session.userId
  - userOrgs.userId, userOrgs.orgId
  - roles.orgId

PG changes (5 new indexes, rest already present):
  - labels.orgId
  - session.userId
  - userOrgs.userId, userOrgs.orgId
  - roles.orgId
  - olms.userId
2026-08-31 17:04:01 -04:00
..
schema perf: add secondary FK indexes to core OSS schemas 2026-08-31 17:04:01 -04:00
driver.ts Match the pg query logging 2026-08-10 14:55:44 -04:00
index.ts Make alias cross compatable 2026-06-03 17:58:59 -07:00
logsDriver.ts Try to route logs requests to a different database 2026-02-20 17:20:01 -08:00
migrate.ts Change back to lokowitz db method 2026-02-12 12:13:13 -08:00
safeRead.ts add safeRead 2026-02-21 16:38:51 -08:00