Tom Lane ha scritto:
Daniele Varrazzo <[EMAIL PROTECTED]> writes:
In my problem I had 2 tables: a small one (accounts), a large one (foo). The
way the query is written doesn't allow the stats from the large table to be
used at all, unless the records from the small table are fetched. This is
i
Daniele Varrazzo <[EMAIL PROTECTED]> writes:
> In my problem I had 2 tables: a small one (accounts), a large one (foo). The
> way the query is written doesn't allow the stats from the large table to be
> used at all, unless the records from the small table are fetched. This is
> independent from
Francisco Reyes writes:
Daniele Varrazzo writes:
I suspect the foo.account_id statistical data are not used at all in
query: the query planner can only estimate the number of accounts to
look for, not
You mentioned you bumped your default_statistics_target.
What did you increase it to?
My d
Daniele Varrazzo writes:
I suspect the foo.account_id statistical data are not used at all in query:
the query planner can only estimate the number of accounts to look for, not
You mentioned you bumped your default_statistics_target.
What did you increase it to?
My data sets are so "strange"
Daniele Varrazzo <[EMAIL PROTECTED]> wrote:
>
>> select count(*) from foo
>> where foo.account_id in (
>> select id from accounts where system = 'abc');
>
>> Total runtime: 13412.226 ms
>
> Out of curiosity, how does it do with the logically equivalent?:
>
> select count(
>>> Daniele Varrazzo <[EMAIL PROTECTED]> wrote:
> select count(*) from foo
> where foo.account_id in (
> select id from accounts where system = 'abc');
> Total runtime: 13412.226 ms
Out of curiosity, how does it do with the logically equivalent?:
select count(*) from f
Tom Lane ha scritto:
Daniele Varrazzo <[EMAIL PROTECTED]> writes:
There is an index in the field "foo.account_id" but is not used. The resulting
query plan is:
Aggregate (cost=300940.70..300940.71 rows=1 width=0) (actual
time=13412.088..13412.089 rows=1 loops=1)
-> Hash IN Join (cost
Daniele Varrazzo <[EMAIL PROTECTED]> writes:
> There is an index in the field "foo.account_id" but is not used. The
> resulting
> query plan is:
> Aggregate (cost=300940.70..300940.71 rows=1 width=0) (actual
> time=13412.088..13412.089 rows=1 loops=1)
> -> Hash IN Join (cost=11.97..2998
Hello,
I am experiencing a query for which an useful index is not being used by
PostgreSQL. The query is in the form:
select count(*) from foo
where foo.account_id in (
select id from accounts where system = 'abc');
and the size of the tables it works on is:
- 270 records i