mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-25 03:17:38 -07:00
[backend] Add multi column index for userHost to note table
This drastically improves local and social timeline performance
This commit is contained in:
parent
eff0f32dc1
commit
6e82e18eea
2 changed files with 14 additions and 0 deletions
|
@ -0,0 +1,13 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class AddNoteIdUserhostIdx1700623165718 implements MigrationInterface {
|
||||
name = 'AddNoteIdUserhostIdx1700623165718'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`CREATE INDEX "IDX_note_id_userHost" ON "note" ("id", "userHost") `);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`DROP INDEX "public"."IDX_note_id_userHost"`);
|
||||
}
|
||||
}
|
|
@ -17,6 +17,7 @@ import { Channel } from "./channel.js";
|
|||
@Index("IDX_NOTE_MENTIONS", { synchronize: false })
|
||||
@Index("IDX_NOTE_VISIBLE_USER_IDS", { synchronize: false })
|
||||
@Index("IDX_note_userId_id", ["userId", "id"])
|
||||
@Index("IDX_note_id_userHost", ["id", "userHost"])
|
||||
export class Note {
|
||||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
|
Loading…
Reference in a new issue