hackmdio / codimd

CodiMD - Realtime collaborative markdown notes on all platforms.
https://hackmd.io/c/codimd-documentation
GNU Affero General Public License v3.0
9.1k stars 1.05k forks source link

Add index at revision table for improving system performance 🚀 #1856

Closed yamashush closed 1 month ago

yamashush commented 5 months ago

The SQLs to select records from the revision table is a sequential scan. These SQLs use note id as a search key, but there is no index on the note id column.

I want to change to index scan to improve system performance 🚀 The records in the revision table will become huge during operation, so sequential scans should be avoided. This is especially because the following fetch processing is called frequently.

https://github.com/hackmdio/codimd/blob/d157fde6667185ab09125fa18317152eeef15fb4/app.js#L277

For your reference, the organization I belong to has already changed it. (https://github.com/kufu/hackmd/pull/19)