summaryrefslogtreecommitdiff
path: root/src/server/api/endpoints/admin
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/api/endpoints/admin')
-rw-r--r--src/server/api/endpoints/admin/get-index-stats.ts26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/server/api/endpoints/admin/get-index-stats.ts b/src/server/api/endpoints/admin/get-index-stats.ts
new file mode 100644
index 0000000000..f2b06d0ef2
--- /dev/null
+++ b/src/server/api/endpoints/admin/get-index-stats.ts
@@ -0,0 +1,26 @@
+import define from '../../define';
+import { getConnection } from 'typeorm';
+
+export const meta = {
+ requireCredential: true as const,
+ requireModerator: true,
+
+ tags: ['admin'],
+
+ params: {
+ },
+};
+
+export default define(meta, async () => {
+ const stats = await
+ getConnection().query(`SELECT * FROM pg_indexes;`)
+ .then(recs => {
+ const res = [] as { tablename: string; indexname: string; }[];
+ for (const rec of recs) {
+ res.push(rec);
+ }
+ return res;
+ });
+
+ return stats;
+});