In PostgreSQL, the query SELECT DISTINCT x, y FROM z returns unique rows based on the combination of x and y.

This means that the distinctness is applied to the entire row (x, y)—a combination of the two columns—rather than separately to each column. For example:

If your table z has the following data:

x | y
-----
1 | 2
1 | 3
2 | 2
2 | 3
1 | 2

The query SELECT DISTINCT x, y FROM z will return:

x | y
-----
1 | 2
1 | 3
2 | 2
2 | 3

Notice that the row (1, 2) only appears once in the result because distinctness applies to the combination of x and y. Rows with the same values for both columns will not be duplicated in the result set.