I have a table with 130Mill rows in it. When i EXPLAIN the query, it is showing 130Mill in the rowns column.
EXPLAIN SELECT * FROM TABLE1;
rows: 130 Mill
But when it add a where condition with TABLE1.time_dim_id between 1900 and 2000
EXPLAIN SELECT * FROM TABLE1 WHERE time_dim_id between 1900 and 2000 ;
rows: 60Mill
Why am is surprised is because, there are no NULL values for this time_dim_id value and
min(time_dim_id) is 1900 AND
max(time_dim_id) is 2000.
Why is this not showing 130Mill rows again under rows section in the 2nd EXPLAIN plan…?
Try
and then again you EXPLAIN – this assumes there is an index on TABLE1.time_dim_id