support "distinct" queries