Why use 'DISTINCT' ?

Posts   
 
    
mmmjiang13
User
Posts: 5
Joined: 02-Dec-2009
# Posted on: 02-Dec-2009 16:38:16   

sql: SELECT DISTINCT [LPLA_1].[AddressID] AS [AddressId], [LPLA_1].[UserId], [LPLA_1].[Addressinfo] FROM [LLBLGEN].[dbo].[AddressInfo] [LPLA_1]

I do not know why you want to use this keyword, 'DISTINCT'? I think it will lead to full table scans

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39863
Joined: 17-Aug-2003
# Posted on: 02-Dec-2009 20:49:42   

Distinct doesn't lead to full table scans, it filters duplicates from the resultset. It's emitted to avoid duplicate filtering on the client. The runtime should cleverly decide whether distinct is needed (when duplicates could occur) and doesn't emit it when it's not possible duplicates will occur. Please use the very latest 2.6 runtime library build to make sure you have the fixes made in this area.

Frans Bouma | Lead developer LLBLGen Pro
mmmjiang13
User
Posts: 5
Joined: 02-Dec-2009
# Posted on: 03-Dec-2009 03:00:18   

Thank you for your reply!