pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: eyal@impactsoft.co.il
To: pgsql-bugs@postgresql.org
Subject: BUG #13995: Inconsistent exucution plan while using enable_nestloop
Date: Mon, 29 Feb 2016 09:24:28 +0000
Message-ID: <20160229092428.10548.42478@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

The following bug has been logged on the website:

Bug reference:      13995
Logged by:          Eyal
Email address:      eyal@impactsoft.co.il
PostgreSQL version: 9.5.1
Operating system:   centos 6.7
Description:        

Hi, 

I checked the TODO list and in the FAQ, there are some items that looks
similar, but I do not really know if any of them are actually the same as
the following.

This may sound like a typical performance issue, but it's actually a bug,
because the plan chosen by the optimizer is inconsistent: right after
creating the function, it's execution time is ~0.05 seconds. EXACTLY 5
time's it's ~0.05, and than, from the 6th execution onwards, it executes
~1.3 seconds (and sometimes ~46 seconds, probably right after VACUUM
ANALYZE). 

We created a database that reproduce this bug.

We first faced this bug in pg9.3.10 on centos6.7 (16GB ram, shared_buffers =
3072MB ). but we actually reproduced it on other systems:
a. oracle virtualbox: centos6.7 pg9.3.10 and pg9.5.1
b. windows 7 pg9.3.10, pg9.4.6 and pg9.5.1

To reproduce the bug:
1. restore this databse:
https://drive.google.com/file/d/0Byp05k27v6xzUWktNm9ySk1uNVk/view?usp=sharing
2. anslyze all tables (please DO NOT VACUUM. see remark below)
3. create the function:
https://drive.google.com/file/d/0Byp05k27v6xzOFlVRUFPenkyZ1k/view?usp=sharing
4. execute the function 6 times: select
runtest_with_ENABLE_NESTLOOP(320,cast(1 as
smallint),0,200001865232,3202111102000000,cast(-1 as smallint),7045,4);


Remark:
After VACUUM FULL ANALYZE it's always ~46 seconds (from the first run).
than, right after VACUUM ANALYZE (not FULL), it's exactly 5 times ~0.02
seconds, and than, form the 6th onwards, it's ~27seconds

Best regards,
Eyal.


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



Message-ID: <20160229092428.10548.42478@wrigleys.postgresql.org>
Permalink:  ../20160229092428.10548.42478@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/20160229092428.10548.42478@wrigleys.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: eyal@impactsoft.co.il
  Subject: Re: BUG #13995: Inconsistent exucution plan while using enable_nestloop
  In-Reply-To: <20160229092428.10548.42478@wrigleys.postgresql.org>
  References: <20160229092428.10548.42478@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox