From: Vitalii Tymchyshyn <tivv00@gmail.com>
To: Anssi Kääriäinen <anssi.kaariainen@thl.fi>
Cc: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: Re: Disabling nested loops - worst case performance
Date: Fri, 18 Mar 2011 12:52:03 +0200
Message-ID: <4D833953.7080607@gmail.com> (raw)
In-Reply-To: <4D8306A7.7020205@thl.fi>
References: <4D8306A7.7020205@thl.fi>
18.03.11 09:15, Anssi Kääriäinen написав(ла):
> Hello list,
>
> I am working on a Entity-Attribute-Value (EAV) database using
> PostgreSQL 8.4.7. The basic problem is that when joining multiple
> times different entities the planner thinks that there is vastly less
> rows to join than there is in reality and decides to use multiple
> nested loops for the join chain. This results in queries where when
> nested loops are enabled, query time is somewhere around 35 seconds,
> but with nested loops disabled, the performance is somewhere around
> 100ms. I don't think there is much hope for getting better statistics,
> as EAV is just not statistics friendly. The values of an attribute
> depend on the type of the attribute, and different entities have
> different attributes defined. The planner has no idea of these
> correlations.
Hello.
If your queries work on single attribute, you can try adding partial
indexes for different attributes. Note that in this case parameterized
statements may prevent index usage, so check also with attribute id inlined.
Best regards, Vitalii Tymchyshyn
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 using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: tivv00@gmail.com, anssi.kaariainen@thl.fi
Subject: Re: Disabling nested loops - worst case performance
In-Reply-To: <4D833953.7080607@gmail.com>
* 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