Skip to main content
Previous section   Next section

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 indices (if indices 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 SetFastDistinct() method of the %SYSTEM.SQL class. See the class reference for details.

You can also change FastDistinct with the Config.SQL class (as described in the class reference) or by editing the CPF in a text editor (as described in the Editing the Active CPF section of the “Introduction to the Configuration Parameter File” chapter in this book).