[Lift] Excessive select DISTINCT

2010-01-14 Thread aw
I enabled SQL logging recently, and started looking at the generated
SQL from Mapper.  I was surprised to see that select DISTINCT was
generally being done for queries when it is not necessary.  Is that
really necessary?

For example:
Team.findAll(OrderBy(Team.name, Ascending))
translated to:
SELECT  DISTINCT team.code, team.name, team.id FROM team   ORDER
BY name  ASC

Queries should perform better without a redundant DISTINCT operation.

I must say that I am surprised to see the DISTINCT added when a
Distinct object/class exists -- I would have expected that I would
have needed to use the Distinct object/class in order to generate the
DISTINCT keyword.
-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.




Re: [Lift] Excessive select DISTINCT

2010-01-14 Thread David Pollak
Okay... I found the problem and fixed it.  The fix will be on review board
in a little while.

On Thu, Jan 14, 2010 at 12:33 AM, aw anth...@whitford.com wrote:

 I enabled SQL logging recently, and started looking at the generated
 SQL from Mapper.  I was surprised to see that select DISTINCT was
 generally being done for queries when it is not necessary.  Is that
 really necessary?

 For example:
Team.findAll(OrderBy(Team.name, Ascending))
 translated to:
SELECT  DISTINCT team.code, team.name, team.id FROM team   ORDER
 BY name  ASC

 Queries should perform better without a redundant DISTINCT operation.

 I must say that I am surprised to see the DISTINCT added when a
 Distinct object/class exists -- I would have expected that I would
 have needed to use the Distinct object/class in order to generate the
 DISTINCT keyword.

 --
 You received this message because you are subscribed to the Google Groups
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to
 liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=en.






-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Surf the harmonics
-- 

You received this message because you are subscribed to the Google Groups "Lift" group.

To post to this group, send email to lift...@googlegroups.com.

To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.