max invoice number code is slow
-
this sql is pretty slow on large databases,
as I create more invoice with your code, most of the execution time becomes waiting for the calc of max invoice number
perhaps saving it in the options table might be smarter.
SELECT MAX(CAST(pm2.meta_value AS UNSIGNED)) AS last_invoice_number FROM wp_postmeta pm1 INNER JOIN wp_postmeta pm2 ON pm1.post_id = pm2.post_id WHERE pm2.meta_key =’_bewpi_invoice_number’;
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘max invoice number code is slow’ is closed to new replies.