pg.ddx.io pgsql-performance@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jon Nelson <jnelson+pgsql@jamponi.net>
Cc: pgsql-performance@postgresql.org
Subject: Re: temporary tables, indexes, and query plans
Date: Wed, 27 Oct 2010 18:36:35 -0400
Message-ID: <29671.1288218995@sss.pgh.pa.us> (raw )
In-Reply-To: <AANLkTimDd_epkFchAy7+OLHcvyMR9utRbG_Ow5GFJ_n+@mail.gmail.com >
References: <AANLkTinyFRBAR52m7a43-aUuxpLzwirtp5FWwfOYP2vT@mail.gmail.com >
<4CC864F8.3060801@vmsinfo.com >
<AANLkTimLX___=XXUMc86tjaxu7ketDpYr2Yd=YJFw0B6@mail.gmail.com >
<AANLkTikJg7gpP5LOqe5DBFk6iORUefyjx8oJ9aobqr2G@mail.gmail.com >
<7C0800F63CCF4149AC0FC5EE2A041226D52361@sr002-2k3exc.ateb.com >
<AANLkTikJp-geSNQyDwEWDvZfjM0195J7PJN5yuRxuJBt@mail.gmail.com >
<26190.1288208593@sss.pgh.pa.us >
<AANLkTing+x8XCwGfzkoWUtoqtBBk0gv9eOVPqQ=O36Dn@mail.gmail.com >
<29004.1288215953@sss.pgh.pa.us >
<AANLkTimDd_epkFchAy7+OLHcvyMR9utRbG_Ow5GFJ_n+@mail.gmail.com >
Jon Nelson <jnelson+pgsql@jamponi.net> writes:
> I'd like to zoom out a little bit and, instead of focusing on the
> specifics, ask more general questions:
> - does the table being temporary effect anything? Another lister
> emailed me and wondered if ANALYZE on a temporary table might behave
> differently.
Well, the autovacuum daemon can't do anything with temp tables, so
you're reliant on doing a manual ANALYZE if you want the planner to
have stats. Otherwise it should be the same.
> - is there some way for me to determine /why/ the planner chooses a
> sequential scan over other options?
It thinks it's faster, or there is some reason why it *can't* use the
index, like a datatype mismatch. You could tell which by trying "set
enable_seqscan = off" to see if that will make it change to another
plan; if so, the estimated costs of that plan versus the original
seqscan would be valuable information.
> - in the general case, are indexes totally ready to use after creation
> or is an analyze step necessary?
They are unless you said CREATE INDEX CONCURRENTLY, which doesn't seem
like it's relevant here; but since you keep on not showing us your code,
who knows?
> - do hint bits come into play here at all?
No.
regards, tom lane
view thread (25+ messages) latest in thread
Message-ID: <29671.1288218995@sss.pgh.pa.us>
Permalink: ../29671.1288218995@sss.pgh.pa.us/
Also on: postgresql.org/message-id/29671.1288218995@sss.pgh.pa.us
copy link · copy postgr.es
reply 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: tgl@sss.pgh.pa.us, jnelson+pgsql@jamponi.net
Subject: Re: temporary tables, indexes, and query plans
In-Reply-To: <29671.1288218995@sss.pgh.pa.us>
* 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