Path: blob/master/src/packages/util/db-schema/pg-system.ts
1447 views
/*1Read access to some PostgreSQL system-level tables for admins.23Right now:45- Virtual tables to count the number of entries in any table.6These counts are instantly computed but are only approximations. See7https://stackoverflow.com/questions/7943233/fast-way-to-discover-the-row-count-of-a-table-in-postgresql/7945274#794527489E.g., from browser in dev mode, this counts the number of patches instantly... but only approximately:1011(await cc.client.async_query({query:{pg_class:{reltuples:null,relname:'patches'}}})).query.pg_class1213*/14import { Table } from "./types";1516Table({17name: "pg_class",18fields: {19reltuples: {20type: "number",21},22relname: {23type: "string",24},25},26rules: {27primary_key: "relname",28desc: "A useful system table for approximate count of size of table",29external: true, // this is a built in external system table30user_query: {31get: {32admin: true,33pg_where: [],34fields: {35reltuples: null,36relname: null,37},38},39},40},41});424344