In case you have your own slow SQL query, you can optimize it automatically here.
For the query above, the following recommendations will be helpful as part of the SQL tuning process.
You'll find 3 sections below:
CREATE INDEX states_idx_custome_end_obsolet_start ON "states" ("customer_id","end","obsolete","start");
SELECT
"states".*
FROM
"states"
WHERE
(
"states"."customer_id" = $1
AND "states"."start" < $2
)
AND (
"states"."end" IS NULL
OR "states"."end" > $3
)
AND (
"states"."obsolete" = $4
)
ORDER BY
"states"."start" DESC