4 ms·
In the spirit of the post...instead of: SELECT COUNT(DISTINCT(Some_Column)) FROM Some_Table try: SELECT COUNT(X.Some_Column) FROM ( SELECT Some_Column , MAX(
by snake_plissken 10y ago
In the spirit of the post...instead of:
SELECT COUNT(DISTINCT(Some_Column))
FROM Some_Table
try:
SELECT COUNT(X.Some_Column)
FROM (
SELECT Some_Column
, MAX(Some_Other_Column_Which_Can_Be_Maxed) [MaxValue]
FROM Some_Table
GROUP BY Some_Column
) AS X
- saosebastiao 10y agoWhy? I can't think of any reason that should be faster. If it is, abandon your database for something reasonable.