Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

037_ProjectionTurnsKeysetIndex.ts

11 lines433 Bytes

1import * as Effect from "effect/Effect";
2import * as SqlClient from "effect/sql/SqlClient";
3​
4/** Keyset pagination needs both requested_at and turn_id indexed to avoid sorting all turns before LIMIT. */
5export default Effect.gen(function* () {
6 const sql = yield* SqlClient.SqlClient;
7 yield* sql`
8 CREATE INDEX IF NOT EXISTS idx_projection_turns_thread_keyset
9 ON projection_turns(thread_id, requested_at, turn_id)
10 `;
11});