Files
usenet-indexer/database/migrations/1770000001600_tsm_system_rows.ts
T
Daan MeijerandClaude Opus 5.5 99fffe30f4
Test and deploy / test (push) Successful in 23s
Test and deploy / deploy (push) Skipped
Rebuild: stats from a fixed-size sample, refreshed every 5 minutes, given up after 2
TABLESAMPLE SYSTEM (0.5) read 30 s of random pages on the HDD at 7M
releases, growing with the catalog; a refresh that never finished kept
the header's totals 3.5 hours old (it blocked every later refresh).
Now TABLESAMPLE SYSTEM_ROWS (5000) (tsm_system_rows), every 5 minutes,
and a refresh is given up after 2 minutes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 17:49:45 +02:00

13 lines
421 B
TypeScript

import { BaseSchema } from '@adonisjs/lucid/schema'
/** TABLESAMPLE SYSTEM_ROWS: the stats' sample of the catalog at a fixed size (a percentage read 30 s of random pages on the HDD at 7M releases). */
export default class extends BaseSchema {
async up() {
this.schema.raw(`CREATE EXTENSION IF NOT EXISTS tsm_system_rows`)
}
async down() {
this.schema.raw(`DROP EXTENSION IF EXISTS tsm_system_rows`)
}
}