How to use TABLESAMPLE

Hi, I want to select random rows from a table You can achieve this using TABLESAMPLE but there is no resource on how to use this in drizzle. Is this supported or can I implement this by using sql operator reference: https://wiki.postgresql.org/wiki/TABLESAMPLE_Implementation
1 Reply
Highball
Highball8mo ago
Been trying to figure this out myself. Just in case anybody needs. A work around is
const randomSamples = await db.execute(sql`select * from samples TABLESAMPLE system_rows(${rowCount})`)
const randomSamples = await db.execute(sql`select * from samples TABLESAMPLE system_rows(${rowCount})`)
Want results from more Discord servers?
Add your server