Cache queries, use more accurate data types