Skip to content

Add additional indexes to speed up report #66

@jwalits

Description

@jwalits

Whilst running the report, I found with around 4 million records in the local_csp table, the report would fall over at times.

Drilling down further into the error and sql query - found this one was causing some grief
https://github.com/catalyst/moodle-local_csp/blob/master/classes/table/csp_report.php#L178-L179

It would be good to add an index for both violateddirective and blockeddomain columns to speed up the query

Tested locally, Postgres was fine and was able to add index to those fields. However, when trying to add an index to those fields in MySQL came across this error
Specified key was too long; max key length is 3072 bytes.

After a chat with Brendan, a thought was converting the column to text to add an index.

I need to re-import the data again locally from prod and will test converting the columns to text and adding an index. Will create a PR with that shortly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions