issue #21359: Improve query performance.