Skip to content

Albums: Add an index on album_filter to improve performance #1953

@lastzero

Description

@lastzero

Adding an index on albums.album_filter can improve update performance:

Added PR #1804. For now only addressed the three UPDATE IN SELECT queries that popped up the most. Everything else seems more involved and might require changes to the DB scheme or at least other tricks, not sure how you feel about this at the current stage.

Regarding the DELETE query from my last comment, the performance issues get much better as soon as you add an index on album_filter to the albums table. For me it drops from 4.7s to 200ms without changing the query.

See GitHub Discussions:

The reason why there is/was no index is that there is a general length limit of 767 bytes for indexes in InnoDB tables that use the REDUNDANT or COMPACT row format.1

To display the current default row format:

SELECT @@innodb_default_row_format;

ToDo / Questions:

  • @srett: The key question now is if anyone could be using the REDUNDANT or COMPACT row format?
  • If yes, the only way is to put the filters in a separate table and index its primary key
  • Alternatively, we could limit the size of filters or add a album_filter_hash column and index that instead
  • Do SQLite and PostgreSQL have any (relevant) index size limitations? If yes: which?

Footnotes

  1. https://docs.oracle.com/cd/E17952_01/mysql-8.0-en/innodb-limits.html

Metadata

Metadata

Assignees

Labels

enhancementEnhancement or improvement of an existing featureperformancePerformance OptimizationreleasedAvailable in the stable release

Type

No type

Projects

Status

Release 🌈

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions