diff options
| author | Hazelnoot <acomputerdog@gmail.com> | 2025-06-06 23:35:25 -0400 |
|---|---|---|
| committer | Hazelnoot <acomputerdog@gmail.com> | 2025-06-06 23:35:25 -0400 |
| commit | d0cf1cc15f998603c95ffca21c0d3feadc240a9d (patch) | |
| tree | 1b92e6a792c12131fcd8ef06243869b38e49a2cb | |
| parent | merge: Fix performance regression in URL previews (resoles #1091) (!1096) (diff) | |
| download | sharkey-d0cf1cc15f998603c95ffca21c0d3feadc240a9d.tar.gz sharkey-d0cf1cc15f998603c95ffca21c0d3feadc240a9d.tar.bz2 sharkey-d0cf1cc15f998603c95ffca21c0d3feadc240a9d.zip | |
remove IDX_instance_host_filters as it slowed down queries more than it helped
| -rw-r--r-- | packages/backend/migration/1749267016885-remove-IDX_instance_host_filters.js | 17 | ||||
| -rw-r--r-- | packages/backend/src/models/Instance.ts | 1 |
2 files changed, 17 insertions, 1 deletions
diff --git a/packages/backend/migration/1749267016885-remove-IDX_instance_host_filters.js b/packages/backend/migration/1749267016885-remove-IDX_instance_host_filters.js new file mode 100644 index 0000000000..d0a4e4f91e --- /dev/null +++ b/packages/backend/migration/1749267016885-remove-IDX_instance_host_filters.js @@ -0,0 +1,17 @@ +/* + * SPDX-FileCopyrightText: hazelnoot and other Sharkey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +export class RemoveIDXInstanceHostFilters1749267016885 { + async up(queryRunner) { + await queryRunner.query(`DROP INDEX IF EXISTS "IDX_instance_host_filters"`); + } + + async down(queryRunner) { + await queryRunner.query(` + create index "IDX_instance_host_filters" + on "instance" ("host", "isBlocked", "isSilenced", "isMediaSilenced", "isAllowListed", "isBubbled", "suspensionState")`); + await queryRunner.query(`comment on index "IDX_instance_host_filters" is 'Covering index for host filter queries'`); + } +} diff --git a/packages/backend/src/models/Instance.ts b/packages/backend/src/models/Instance.ts index c9200e1e35..0cde4b75fc 100644 --- a/packages/backend/src/models/Instance.ts +++ b/packages/backend/src/models/Instance.ts @@ -7,7 +7,6 @@ import { Entity, PrimaryColumn, Index, Column } from 'typeorm'; import { id } from './util/id.js'; @Index('IDX_instance_host_key', { synchronize: false }) // ((lower(reverse("host"::text)) || '.'::text) -@Index('IDX_instance_host_filters', { synchronize: false }) // ("host", "isBlocked", "isSilenced", "isMediaSilenced", "isAllowListed", "isBubbled", "suspensionState") @Entity('instance') export class MiInstance { @PrimaryColumn(id()) |