Skip to content
  • Daniel Vrátil's avatar
    Add sorting indexes for PimItemTable and friends · ae787c64
    Daniel Vrátil authored
    FetchHelper always retrieves data from DB as "ORDER BY PimItemTable.id DESC",
    which is costly, because PKs are always assumed to be ascending, thus DB has
    to costly calculate the sorting. This patch creates new DESC index on relevant
    columns to speed up the sorting. In some cases this reduces query runtime by
    50% (measured on PSQL).
    
    Note that while all 3 backends support the syntax, only PostgreSQL and partially
    SQLite actually make use of the DESC sorting index. MySQL just ignores the
    keywords. SQLite support depends on version and database file format.
    
    See T628 on Phabricator for more details and measurements.
    ae787c64