>>>>> "Fournier" == Fournier Jocelyn <[Presence-PC]"
> <joc@stripped>> writes:
Fournier> I wonder if it would be possible to optimize COUNT, based on cardinality
Fournier> Example :
Fournier> In my application I have the following query :
Fournier> SELECT COUNT(*) FROM inscrit WHERE forum='someid';
Fournier> It's possible that the column 'forum' contains only one value, and in this
Fournier> case it will be much more faster to optimize the query in executing :
Fournier> SELECT COUNT(*) FROM inscrit;
Just looking at cardinality is not enough for deciding this issue, as
the cardinality is not exact.
I don't think this optimization is that easy to worth doing at this
point, as this is not a very likely scenario and doing the extra check
would slow down most index queries a bit, which is likely to slow down
the total server much more than the gain you could get.