You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The DISTINCT clause instructs the database to ensure that all returned
rows are distinct; so the database compares all returned columns. In
most cases we simply want to prevent duplicate entries in the result set
which can be achieved by a DISTINCT ON (id) clause that does the
comparison on the 'id' column only and is much more efficient (i.e. for
large final or even intermediate result sets the database might need to
write them to disk to perform the comparison).
MySQL does not support DISTINCT ON, but Sequel translates this
transparently to GROUP BY.
PostgreSQL has the following restriction: SELECT DISTINCT ON expressions
must match initial ORDER BY expressions. Thus the SequelPaginator has
been enhanced to use the ORDER BY columns also for the DISTINCT ON
clause if they are unique (i.e. 'id' or 'guid' included). In case the
ORDER BY clause is not unique, DISTINCT is used instead.
DISTINCT statements with a single selected column have not been changed.
0 commit comments