Accessing the Payments table through the web interface (eg. on a payment method page) causes high CPU usage by Postgres.
What query is actually being run, and is there anything we can do to speed it up? It's painfully slow even on tables with moderate numbers of payments (eg. 23000 Square payments at the Dev at the moment).
It was doing a sequential scan over the sessions table inside a loop for a left join. Running VACUUM ANALYZE; fixed it and it is now using the sessions_pkey index.
Accessing the Payments table through the web interface (eg. on a payment method page) causes high CPU usage by Postgres.
What query is actually being run, and is there anything we can do to speed it up? It's painfully slow even on tables with moderate numbers of payments (eg. 23000 Square payments at the Dev at the moment).