getFilteredRows() now builds single SQL query if possible (but doesn't
return keys in that case).