![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Since I'm developing an SQL based application, I routinely "start from scratch" with a script that deletes all the tables in my database and rebuilds them. A problem started when I upgraded from 7.4.7 to 8.0.1 in that the first run after the clean takes an UNUSUALLY long time to complete, on the order of a few hundred inserts/sec. A normal run takes ~30 seconds. A from scratch run takes ~15 minutes, with the next run completing in 30 seconds with zero changes. |
|
Hopefully this is enough info to track down and recreate the problem |
#3
| |||
| |||
|
|
"John Engelhart" <johne (AT) zang (DOT) com> writes: Since I'm developing an SQL based application, I routinely "start from scratch" with a script that deletes all the tables in my database and rebuilds them. A problem started when I upgraded from 7.4.7 to 8.0.1 in that the first run after the clean takes an UNUSUALLY long time to complete, on the order of a few hundred inserts/sec. A normal run takes ~30 seconds. A from scratch run takes ~15 minutes, with the next run completing in 30 seconds with zero changes. The 8.0 planner is intentionally sensitive to the current actual physical sizes of tables. It sounds like you've managed to get it to plan something on the assumption that the tables are tiny and keep using that plan after they aren't tiny any more. The old planner had the same kind of issue but it was far easier to hit, so "revert that change" isn't an answer that I'm particularly interested in. |
|
Hopefully this is enough info to track down and recreate the problem Not really. |
|
regards, tom lane |
#4
| |||
| |||
|
|
The 8.0 planner is intentionally sensitive to the current actual physical sizes of tables. It sounds like you've managed to get it to plan something on the assumption that the tables are tiny and keep using that plan after they aren't tiny any more. The old planner had the same kind of issue but it was far easier to hit, so "revert that change" isn't an answer that I'm particularly interested in. |
#5
| |||
| |||
|
|
It turns out that the scenario above is trivial to hit in 8.0 using referential constraints; RI triggers cache their plans, and on 8.0 the RI query is planned as a seqscan if the tables are freshly created. (On 7.4 the plan is an index scan, thanks to the default 1000 rows / 10 pages stats.) |
![]() |
| Thread Tools | |
| Display Modes | |
| |