fix (part of) 3.x performance regression on customers with tons of invoices, RT#29646...