The DISTINCT clause will always consider all the columns in a select statement - or in this case your derived view - when determining uniqueness. Using a primary key would require a different approach, as you'd need to specify which values to use in situations where one primary key yields multiple records. If the DISTINCT clause is being fully delegated, however, your data source should be able to leverage its index instead of doing a full table scan. I'd suggest starting by confirming that you've gathered statistics on the base data source, and, if necessary, [Gather Statistics](https://community.denodo.com/docs/html/browse/6.0/vdp/administration/optimizing_queries/cost-based_optimization/gathering_the_statistics_of_views) on the Derived View, then compare the performance from there.
Hope this helps!