-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
タイムライン取得時にdrive_fileへのクエリ回数を減らす #10129
Comments
既存のレコードのマイグレーションが大変かもしれないですね |
テーブルの構造を変えない方法としては |
とりあえずpackManyでhintとして全ドライブファイルpackManyして渡すのが良いかも? |
というかdriveFileのpackManyが適当なのを何とかした方がいいな https://github.com/misskey-dev/misskey/blob/develop/packages/backend/src/core/entities/DriveFileEntityService.ts#L261 |
ちなみにこうする場合ファイルの並び順ってどのように表現されますか? |
@syuilo とりあえず俺のコメントのやつだけやってみていい? |
👍 |
クエリは単純なので画像付き投稿数以上の予想外に時間がかかるというのはないと思います。
中間テーブルにノート内での順番としてrank を持たせます。 TypeORMで書きやすいかは未確認です。 |
これ fileIds に貼ってある index 使う方法ありますかね?一応 fileIds に array_ops のインデックスは貼ってはありますが、このインデックスだと中身がある場合のみ取得みたいなことはできなさそうなので https://www.postgresql.jp/document/14/html/gin-builtin-opclasses.html notes テーブルかたっぱしから舐めることになりませんか? |
(あと配列からテーブルにする話は #10134 でやりたい) |
わざわざ中間テーブルを作る(fileIdsの配列をノートに直接突っ込みたくない)理由がわかっていない (packManyでファイルごとに要求しているのは直した方がいいとは思うけど) |
なんの方法でもホームTLが絵師フォロー中なので軽くなれば助かります 🙏 |
https://github.com/misskey-dev/misskey/blob/develop/packages/backend/src/core/entities/NoteEntityService.ts#L392 から
Noteをレスポンス用に整形するために
https://github.com/misskey-dev/misskey/blob/develop/packages/backend/src/core/entities/NoteEntityService.ts#L307 で
drive_fileへのクエリが画像数分走る
noteテーブルに添付ファイル情報を複数カラムの配列で持っているのは扱いにくいのでdrive_fileへの中間テーブルを作ってJOINしたい。
手っ取り早いのは絵文字でやっている
await this.customEmojiService.prefetchEmojis(this.customEmojiService.aggregateNoteEmojis(notes));
のような処理追加ですが、配列型保持にしている理由が無ければ思い切ってテーブルを正規化した方がいい気がします。
問題なければAssigneeにしてほしいです
The text was updated successfully, but these errors were encountered: