sure select distinct customer_id ... customer_id is first part of partition key you really don't need to do a tablescan to resolve that do you ?