Skip to main content

FastDistinct

Allow SQL DISTINCT optimization.

Synopsis

[SQL]    FastDistinct=n

n is either 1 or 0. The default value is 1.

Description

When FastDistinct is enabled (n = 1), SQL queries involving DISTINCT or GROUP BY clauses run more efficiently by making better use of indexes (if indexes are available).

Caution:

The values returned by such queries are collated in the same way they are stored within the index. This means the results of such queries may be all uppercase. This may have an effect on case-sensitive applications.

For further details, refer to the GROUP BY clause and the DISTINCT clause of the SELECT statement.

Changing This Parameter

FastDistinct is enabled by default. On the SQL page of the Management Portal (System Administration > Configuration > SQL and Object Settings > SQL), select GROUP BY and DISTINCT queries must produce original values to disable FastDistinct.

To set the desired value for FastDistinct from the Terminal, use the SetOption(“FastDistinct”)Opens in a new tab method of the %SYSTEM.SQL.UtilOpens in a new tab class. See the class reference for details.

You can also change FastDistinct with the Config.SQLOpens in a new tab class (as described in the class reference) or by editing the CPF in a text editor (as described in Editing the Active CPF).

FeedbackOpens in a new tab