Re: [PERFORM] Very slow inner join query Unacceptable latency.

Поиск
Список
Период
Сортировка
Искать

Re: [PERFORM] Very slow inner join query Unacceptable latency.

От:
<fburgess@radiantblue.com>
Дата:
PostgreSQL 9.1.6 on linux

-------- Original Message --------
Subject: Re: [PERFORM] Very slow inner join query Unacceptable latency.
From: Jaime Casanova <jaime@2ndquadrant.com>
Date: Tue, May 21, 2013 2:59 pm
To: Freddie Burgess <fburgess@radiantblue.com>
Cc: psql performance list <pgsql-performance@postgresql.org>, Postgres
General <pgsql-general@postgresql.org>

On Tue, May 21, 2013 at 4:53 PM, <fburgess@radiantblue.com> wrote:
> The SARS_ACTS table currently has 37,115,515 rows
>
> we have indexed: idx_sars_acts_acts_run_id ON SARS_ACTS USING btree
> (sars_run_id)
> we have pk constraint on the SARS_ACTS_RUN table; sars_acts_run_pkey PRIMARY
> KEY (id )
>
> serverdb=# explain select count(*) as y0_ from SARS_ACTS this_ inner join
> SARS_ACTS_RUN tr1_ on this_.SARS_RUN_ID=tr1_.ID where tr1_.ALGORITHM='SMAT';

can you please show us an EXPLAIN ANALYZE of this query (not only
EXPLAIN). please paste it in a file and attach it so it doesn't get
reformatted by the mail client.

what version of postgres is this?

--
Jaime Casanova www.2ndQuadrant.com
Professional PostgreSQL: Soporte 24x7 y capacitación
Phone: +593 4 5107566 Cell: +593 987171157

Re: [PERFORM] Very slow inner join query Unacceptable latency.

От:
Jeff Janes <jeff.janes@gmail.com>
Дата:
On Wed, May 22, 2013 at 7:41 AM, <fburgess@radiantblue.com> wrote:
PostgreSQL 9.1.6 on linux


From the numbers in your attached plan, it seems like it should be doing a nested loop from the 580 rows (it thinks) that match in SARS_ACTS_RUN against the index on sars_run_id to pull out the 3297 rows (again, it think, though it is way of there). I can't see why it would not do that. There were some planner issues in the early 9.2 releases that caused very large indexes to be punished, but I don't think those were in 9.1

Could you "set enable_hashjoin to off" and post the "explain analyze" that that gives?


Cheers,

Jeff
 

Re: [PERFORM] Very slow inner join query Unacceptable latency.

От:
Scott Marlowe <scott.marlowe@gmail.com>
Дата:
Looking at the execution plan makes me wonder what your work_mem is
set to.  Try cranking it up to test and lowering random_page_cost:

set work_mem='500MB';
set random_page_cost=1.2;
explain analyze select ...

and see what you get.

FAQ