sde1000 / quicktill

Figure out where all the money and stock went to
GNU General Public License v3.0
43 stars 9 forks source link

Payments table in web interface causes high CPU load #264

Closed sde1000 closed 1 year ago

sde1000 commented 1 year ago

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).

sde1000 commented 1 year ago

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.