[hibernate-dev] Question regarding DISTINCT

Steve Ebersole steve at hibernate.org
Mon Feb 19 09:43:17 EST 2007


> Could you point me to the JIRA tasks, I would be interesting in seeing 
> what the ultimate solution looks like?
JIRA is searchable.  Look for things marked as 'query-hql' as the 
component...  The basic idea is to drop the collection-valued fetches.
> The thing that confuses me is that distinct generally doesn't come for 
> free (generally resuls in a sort by the DB).  If the result set is 
> going to be the same anyway, isn't there an advantage to excluding the 
> distinct clause, or is it simply not possible to determine which 
> queries will benefit from it and which won't?
It depends on the quite a few things like the particular database, db 
server options, the width and depth of the selected dataset, the JDBC 
driver, the network, etc.  All-in-all, it is not feasible to detect when 
to do it and when not to do it.



More information about the hibernate-dev mailing list