CBO, statistics and execution plans
Hi.
Today I have perfomed full database export and import (platform migration). Just as I finished all steps on my to-do list and started objects statistics gathering, one impatient user logged in and he executed some selects - it was (of course) incredibly slow. Just as statistics gathering finished, I called the user to re-execute those selects. It was still incredibly slow.
I have made this conclusion:
first time CBO prepared wrong execution plan, because it hadn't statistics it could use. Second time user executed this select, database didn't make new execution plan, because it already had one - however wrong.
Today I have perfomed full database export and import (platform migration). Just as I finished all steps on my to-do list and started objects statistics gathering, one impatient user logged in and he executed some selects - it was (of course) incredibly slow. Just as statistics gathering finished, I called the user to re-execute those selects. It was still incredibly slow.
I have made this conclusion:
first time CBO prepared wrong execution plan, because it hadn't statistics it could use. Second time user executed this select, database didn't make new execution plan, because it already had one - however wrong.
0