Site icon Web Development Zone

Postgesql / Which way is faster DISTINC or GROUP BY?

There are 2 ways to do the same thing – Example: get distinct names from persons database

The first way is:

SELECT name FROM person GROUP BY name

Has the same result as:

SELECT DISTINCT name FROM person

What I am curious of, is there anything different in the way an Postgresql SQL engine processes the command and which way is faster, or are they doing the same thing?

Exit mobile version