Skip to content

Add indexes to speed up queries #17

@ghost

Description

After a fresh new install of Lessn More 2.2.0 on a MySQL based system the table 'urls' has three indices:

  • Primary Key on field 'id'
  • checksum_index on field 'checksum'
  • redir_type_index on field 'redir_type'

Due to the query issued in /index.php, which uses the field 'custom_url' in the WHERE clause, I suggest to put an additional index there. An alternative is to use the existing and indexed checksum field as the first part in the WHERE clause and after that - due to possible crc32 collisions - the original clause as the second part:
'...WHERE checksum = CRC32(:slug) AND (BINARY) custom_url = ...'
so that MySQL may reduce the possible result set based on the checksum field first and then match against the original WHERE clause in case of checksum collisions.

best rgds,
Alex.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions