onepica / avatax

One Pica Magento extension for sales tax calculation performed by Avatax
http://www.magentocommerce.com/magento-connect/6760.html
29 stars 34 forks source link

Severe Performance Issue Caused By 920ebe9901be1866b7764749a2408734ad8e3e3e #285

Open mpchadwick opened 5 years ago

mpchadwick commented 5 years ago

In the benchmarking I've done the new query is ~200X slower. It also locks and has caused production downtime on a site I'm working on.

Specs

Before:

mysql> DELETE FROM op_avatax_log WHERE created_at < DATE_SUB(UTC_DATE(), INTERVAL 1 DAY);
Query OK, 4924 rows affected (0.15 sec)

After:

mysql> DELETE FROM op_avatax_log WHERE created_at < DATE_SUB(UTC_DATE(), INTERVAL 1 DAY) AND not exists (select queue_id FROM op_avatax_queue as q where q.quote_id = op_avatax_log.quote_id);
Query OK, 4729 rows affected, 1 warning (20.69 sec)

Note that this is just staging data. Issue is much more severe in production...