Lists: | pgsql-hackers |
---|
From: | Oleg Bartunov <oleg(at)sai(dot)msu(dot)su> |
---|---|
To: | Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | autovacuum and temp tables support |
Date: | 2010-04-08 18:21:38 |
Message-ID: | Pine.LNX.4.64.1004082216260.8023@sn.sai.msu.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Hi there,
our client complained about slow query, which involves temporary tables.
Analyzing them manually solved the problem. I don't remember arguments
against temporary tables support by autovacuum. I'd appreciate any
pointers.
Also, it's worth to add autovacuum_enable_temp_tables variable to control
autovacuum behaviour ?
Regards,
Oleg
_____________________________________________________________
Oleg Bartunov, Research Scientist, Head of AstroNet (www.astronet.ru),
Sternberg Astronomical Institute, Moscow University, Russia
Internet: oleg(at)sai(dot)msu(dot)su, http://www.sai.msu.su/~megera/
phone: +007(495)939-16-83, +007(495)939-23-83
From: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
---|---|
To: | Oleg Bartunov <oleg(at)sai(dot)msu(dot)su> |
Cc: | Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: autovacuum and temp tables support |
Date: | 2010-04-08 18:53:51 |
Message-ID: | 20100408185351.GH4126@alvh.no-ip.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Oleg Bartunov wrote:
> our client complained about slow query, which involves temporary tables.
> Analyzing them manually solved the problem. I don't remember
> arguments against temporary tables support by autovacuum. I'd
> appreciate any
> pointers.
Autovacuum can't process temp tables; they could reside in a backend's
private temp buffers (local memory, not shared).
--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.
From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
Cc: | Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: autovacuum and temp tables support |
Date: | 2010-04-08 19:06:52 |
Message-ID: | o2m603c8f071004081206p3a7d9287w5f51cee057595e38@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Thu, Apr 8, 2010 at 2:53 PM, Alvaro Herrera
<alvherre(at)commandprompt(dot)com> wrote:
> Oleg Bartunov wrote:
>
>> our client complained about slow query, which involves temporary tables.
>> Analyzing them manually solved the problem. I don't remember
>> arguments against temporary tables support by autovacuum. I'd
>> appreciate any
>> pointers.
>
> Autovacuum can't process temp tables; they could reside in a backend's
> private temp buffers (local memory, not shared).
On general thought I've had is that it would be nice if the first
attempt to SELECT against a table with no statistics would trigger an
automatic ANALYZE by the backend on which the query was executed.
It's pretty common to populate a table using INSERT, or CTAS, or COPY
and then try to immediately run a query against it, and I've often
found that it's necessary to insert manual analyze statements in there
to get decent query plans.
...Robert
From: | "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov> |
---|---|
To: | "Alvaro Herrera" <alvherre(at)commandprompt(dot)com>, "Robert Haas" <robertmhaas(at)gmail(dot)com> |
Cc: | "Pgsql Hackers" <pgsql-hackers(at)postgresql(dot)org>, "Oleg Bartunov" <oleg(at)sai(dot)msu(dot)su> |
Subject: | Re: autovacuum and temp tables support |
Date: | 2010-04-08 19:13:01 |
Message-ID: | 4BBDE46D02000025000305F7@gw.wicourts.gov |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> On Thu, Apr 8, 2010 at 2:53 PM, Alvaro Herrera
>> Autovacuum can't process temp tables; they could reside in a
>> backend's private temp buffers (local memory, not shared).
>
> it would be nice if the first attempt to SELECT against a table
> with no statistics would trigger an automatic ANALYZE by the
> backend on which the query was executed.
+1 as an RFE
-Kevin
From: | Oleg Bartunov <oleg(at)sai(dot)msu(dot)su> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: autovacuum and temp tables support |
Date: | 2010-04-08 19:22:08 |
Message-ID: | Pine.LNX.4.64.1004082317300.8023@sn.sai.msu.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Thu, 8 Apr 2010, Robert Haas wrote:
> On Thu, Apr 8, 2010 at 2:53 PM, Alvaro Herrera
> <alvherre(at)commandprompt(dot)com> wrote:
>> Oleg Bartunov wrote:
>>
>>> our client complained about slow query, which involves temporary tables.
>>> Analyzing them manually solved the problem. I don't remember
>>> arguments against temporary tables support by autovacuum. I'd
>>> appreciate any
>>> pointers.
>>
>> Autovacuum can't process temp tables; they could reside in a backend's
>> private temp buffers (local memory, not shared).
>
> On general thought I've had is that it would be nice if the first
> attempt to SELECT against a table with no statistics would trigger an
> automatic ANALYZE by the backend on which the query was executed.
> It's pretty common to populate a table using INSERT, or CTAS, or COPY
> and then try to immediately run a query against it, and I've often
> found that it's necessary to insert manual analyze statements in there
> to get decent query plans.
Oracle does this. So, is't worth to add support (configurable, like
Oracle's optimizer_dynamic_sampling) ?
Regards,
Oleg
_____________________________________________________________
Oleg Bartunov, Research Scientist, Head of AstroNet (www.astronet.ru),
Sternberg Astronomical Institute, Moscow University, Russia
Internet: oleg(at)sai(dot)msu(dot)su, http://www.sai.msu.su/~megera/
phone: +007(495)939-16-83, +007(495)939-23-83
From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | Oleg Bartunov <oleg(at)sai(dot)msu(dot)su> |
Cc: | Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: autovacuum and temp tables support |
Date: | 2010-04-08 19:40:35 |
Message-ID: | q2r603c8f071004081240qb1f1ed9cw5e9ee5deda494ff1@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Thu, Apr 8, 2010 at 3:22 PM, Oleg Bartunov <oleg(at)sai(dot)msu(dot)su> wrote:
>> On general thought I've had is that it would be nice if the first
>> attempt to SELECT against a table with no statistics would trigger an
>> automatic ANALYZE by the backend on which the query was executed.
>> It's pretty common to populate a table using INSERT, or CTAS, or COPY
>> and then try to immediately run a query against it, and I've often
>> found that it's necessary to insert manual analyze statements in there
>> to get decent query plans.
>
> Oracle does this. So, is't worth to add support (configurable, like
> Oracle's optimizer_dynamic_sampling) ?
Well, dynamic sampling is considerably more complicated than what I
proposed, which is just to force an ordinary ANALYZE before the first
query against the table. It would be a very powerful feature if we
could use it to ameliorate, for example, the gross statistical errors
that sometimes occur when multiple, correlated filter conditions are
applied to the same base table; but I don't think it's in the direct
path of solving the present complaint.
...Robert
From: | Bruce Momjian <bruce(at)momjian(dot)us> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: autovacuum and temp tables support |
Date: | 2010-04-16 02:22:38 |
Message-ID: | 201004160222.o3G2Mcm09238@momjian.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Robert Haas wrote:
> On Thu, Apr 8, 2010 at 3:22 PM, Oleg Bartunov <oleg(at)sai(dot)msu(dot)su> wrote:
> >> On general thought I've had is that it would be nice if the first
> >> attempt to SELECT against a table with no statistics would trigger an
> >> automatic ANALYZE by the backend on which the query was executed.
> >> It's pretty common to populate a table using INSERT, or CTAS, or COPY
> >> and then try to immediately run a query against it, and I've often
> >> found that it's necessary to insert manual analyze statements in there
> >> to get decent query plans.
> >
> > Oracle does this. So, is't worth to add support (configurable, like
> > Oracle's optimizer_dynamic_sampling) ?
>
> Well, dynamic sampling is considerably more complicated than what I
> proposed, which is just to force an ordinary ANALYZE before the first
> query against the table. It would be a very powerful feature if we
> could use it to ameliorate, for example, the gross statistical errors
> that sometimes occur when multiple, correlated filter conditions are
> applied to the same base table; but I don't think it's in the direct
> path of solving the present complaint.
I have added this TODO:
Consider analyzing temporary tables when they are first used in a query
Autovacuum cannot analyze or vacuum temporary tables.
* http://archives.postgresql.org/pgsql-hackers/2010-04/msg00416.php
I have also applied the following documentation patch to document this
behavior.
--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com
Attachment | Content-Type | Size |
---|---|---|
/rtmp/diff | text/x-diff | 1.9 KB |