replaced index_with_where sql