Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YWx1Z-0001Tl-2V for pgsql-bugs@arkaria.postgresql.org; Sun, 15 Mar 2015 01:07:25 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YWx1X-0002dV-JR for pgsql-bugs@arkaria.postgresql.org; Sun, 15 Mar 2015 01:07:23 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YWx1V-0002dM-LU for pgsql-bugs@postgresql.org; Sun, 15 Mar 2015 01:07:21 +0000 Received: from wrigleys.postgresql.org ([204.145.124.246]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YWx1D-0001Fx-Ju for pgsql-bugs@postgresql.org; Sun, 15 Mar 2015 01:07:19 +0000 MIME-Version: 1.0 Subject: BUG #12866: Another performance problem with intarray extenstion operators To: pgsql-bugs@postgresql.org From: maxim.boguk@gmail.com Date: Sun, 15 Mar 2015 01:06:08 +0000 Message-ID: <20150315010608.14913.94682@wrigleys.postgresql.org> X-Pg-Spam-Score: -0.3 (/) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org The following bug has been logged on the website: Bug reference: 12866 Logged by: Maksym Boguk Email address: maxim.boguk@gmail.com PostgreSQL version: 9.3.5 Operating system: Linux Description: Hi, I found second case where intarray operators have serious performance issues: create table test1 as select array_agg(id) as _array from generate_series(100000,1, -1) as g(id); analyze verbose test; generic version: # EXPLAIN ANALYZE SELECT 1 FROM test1 WHERE ARRAY[16997] OPERATOR(pg_catalog.<@) _array; QUERY PLAN ------------------------------------------------------------------------------------------------ Seq Scan on test1 (cost=0.00..17.38 rows=7 width=0) (actual time=1.286..1.287 rows=1 loops=1) Filter: ('{16997}'::integer[] OPERATOR(pg_catalog.<@) _array) Total runtime: 1.301 ms intarray version: =# EXPLAIN ANALYZE SELECT 1 FROM test1 WHERE ARRAY[16997] OPERATOR(public.<@) _array; QUERY PLAN ------------------------------------------------------------------------------------------------------ Seq Scan on test1 (cost=0.00..17.38 rows=1 width=0) (actual time=2738.589..2738.591 rows=1 loops=1) Filter: ('{16997}'::integer[] <@ _array) Total runtime: 2738.607 ms Whats made situation worse - intarray version could not be terminated by ctrl-c or pg_terminate_backend (so don't try it with 1M or more array elements). PS: filling array in descending order is critical to reproducing the issue. PPS: my previous bug report about issues with intarray (wrong selectivity estimator functions used) seems stuck in the moderation queue. -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs