komoot interview question

How do you optimise a slow SLQ query?