MySQL Forums :: Performance :: Wrong estimation of Rows in explain


Advanced Search

Wrong estimation of Rows in explain
Posted by: Rathi Rao ()
Date: July 27, 2016 06:19AM

Hi,

I have the following query,

select ai.activityid,ai.farmercropid,fca.ActivityID,fca.farmercropid
from activityinformation ai
inner join FarmerCropActivity fca
on ai.farmercropid = fca.farmercropid
and fca.activityid = ai.activityid

select count(*) from FarmerCropActivity; -- 2806792
select count(*) from activityinformation; -- 3269567

Indexes are

create index idx_ai_activityid on activityinformation(activityid)
create index idx_ai_farmercropid on activityinformation(farmercropid)

create index idx_fca_activityid on FarmerCropActivity(activityid)
create index idx_fca_farmercropid on FarmerCropActivity(farmercropid)

The activityinformation table is partitioned on a column called isactive. And isactive has only 2 values 0 and 1

The problem is the query takes forever to run. And when I look into the explain plan, the rows for FarmerCropActivity shows 2, which is wrong

Any thoughts on this would be greatly appreciated

Thanks in advance
Rathi

Options: ReplyQuote


Subject Views Written By Posted
Wrong estimation of Rows in explain 554 Rathi Rao 07/27/2016 06:19AM
Re: Wrong estimation of Rows in explain 276 Peter Brawley 07/27/2016 08:55AM
Re: Wrong estimation of Rows in explain 310 Rathi Rao 07/27/2016 11:58PM
Re: Wrong estimation of Rows in explain 294 Peter Brawley 07/28/2016 09:14AM
Re: Wrong estimation of Rows in explain 296 Rathi Rao 07/29/2016 05:11AM
Re: Wrong estimation of Rows in explain 287 Peter Brawley 07/29/2016 01:10PM
Re: Wrong estimation of Rows in explain 298 Rick James 07/29/2016 06:58PM
Re: Wrong estimation of Rows in explain 272 Rathi Rao 08/02/2016 05:48AM
Re: Wrong estimation of Rows in explain 293 Rick James 08/02/2016 06:23PM
Re: Wrong estimation of Rows in explain 269 Rathi Rao 08/02/2016 05:38AM
Re: Wrong estimation of Rows in explain 298 james wang 08/04/2016 05:31AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.