Re: [GENERAL] Plan changes from index scan to seq scan after 5 executions

2017-09-30 Thread Tom Lane
Alexander Kukushkin writes: > Original problem has been found on 9.4.9, but I was able to reproduce it on > 10rc1. The problem here is that the generic estimate of the selectivity of "where value = $1" is 1.0, because var_eq_non_const makes the not unreasonable assumption

Re: [GENERAL] Plan changes from index scan to seq scan after 5 executions

2017-09-30 Thread Alexander Kukushkin
Hi David, sorry, absolutely forgot about important stuff like version. Original problem has been found on 9.4.9, but I was able to reproduce it on 10rc1. localhost/postgres=# select version(); version

Re: [GENERAL] Plan changes from index scan to seq scan after 5 executions

2017-09-30 Thread David G. Johnston
On Sat, Sep 30, 2017 at 10:57 AM, Alexander Kukushkin wrote: > Hi, > > Recently I've been investigating a strange behavior of one stored > procedure. > Please provide the output of: SELECT version(); David J. ​

[GENERAL] Plan changes from index scan to seq scan after 5 executions

2017-09-30 Thread Alexander Kukushkin
Hi, Recently I've been investigating a strange behavior of one stored procedure. According to the statistics its execution time was very high (15 seconds), but if I run the same statement from console it was very fast, just a few milliseconds. At the end I was able to prepare a short script,