Subject Is this the most effective way of counting unique rows?
Author un_spoken
Hi guys.

Here is an example:

CREATE TABLE TEST
(
ID1 INTEGER,
ID2 INTEGER,
ID3 INTEGER
)

INSERT INTO TEST VALUES(1,1,1);
INSERT INTO TEST VALUES(1,1,1);
INSERT INTO TEST VALUES(1,2,1);
INSERT INTO TEST VALUES(1,1,3);

SELECT COUNT(*) FROM
(
SELECT
DISTINCT ID1, ID2, ID3
FROM
TEST
)

Is above query the fastest way of counting unique rows?
I was browsing the Internet but could't find the definitive answer.


Thanks for your time.