BUG #12866: Another performance problem with intarray extenstion operators

From: maxim(dot)boguk(at)gmail(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #12866: Another performance problem with intarray extenstion operators
Date: 2015-03-15 01:06:08
Message-ID: 20150315010608.14913.94682@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 12866
Logged by: Maksym Boguk
Email address: maxim(dot)boguk(at)gmail(dot)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.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2015-03-15 17:20:11 Re: BUG #12866: Another performance problem with intarray extenstion operators
Previous Message jaime soler 2015-03-14 13:05:46 Re: BUG #12836: pljava.dll for postgres 9.4.1-64 bit