[rt-devel] SearchBuilder DISTINCTs

Robert Spier rspier at pobox.com
Thu Feb 20 12:58:31 EST 2003


> Having stared at this a little harder I am now of the opinion that
> the DISTINCT argument is redundant in SELECT DISTINCT main.* FROM
> table main [, ....]  because every table has a column 'id' which
> contains an integer unique to that row in that table. This is
> sufficient to make every row distinct. As far as I can see this the
> only place in SearchBuilder.pm where it's a problem for SQL Server.

Ian-

	The reason you cannot get rid of the DISTINCTs is because of
	the joins.  They will lead to multiple duplicate rows.

	If you can come up with a solution to this problem that works
	on complicated queries, (of which I can provide you many),
	then we can get rid of DISTINCT.  

	By subclassing the query building stuff, you can eliminate the
	DISTINCTs for SQL Server, and take a performance hit by doing
	dupe checking on the perl side.  But every other database
	doesn't have to deal with it.  

	If you have 2GB attachments in the database things are going
	to be slow anyway-  Maybe SQL Server has another data type
	that can be used?

-R



More information about the Rt-devel mailing list