CLSN-1747 improve liner/writeoff queries