On Fri, Oct 2, 2015 at 8:41 AM, Bart Smissaert <bart.smissaert at gmail.com> wrote:
> > you're just throwing random terms around and hoping something sticks. > > Not sure where you got that idea from, but let me explain better: > AFAICT this is the first posting where you said "I want to count all the unique rows of this table". Previously, you said that you wanted to count all the rows of the table (without the qualifier "unique") and you also said this was faster if you had a unique index. That didn't make sense, because the only case where an index should make that faster is if the index narrows the table rather than containing the table. I agree, if this is what you want: > SELECT COUNT(*) AS UNIQUE_ROWS > FROM (SELECT DISTINCT * FROM TABLE1) > Then it could in some cases be reduced to just counting the rows in the table: SELECT COUNT(*) FROM TABLE1 > and that would be faster. But the latter statement would not itself become faster with a schema change. This is why I suggested posting schema and query examples. Then we're talking about the same thing. This could have been a two- or three-post thread. -scott