Re: Can the query planner create indexes?

From: Jeremy Harris <jgh(at)wizmail(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Can the query planner create indexes?
Date: 2010-12-21 13:44:45
Message-ID: 4D10AF4D.6010501@wizmail.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2010-12-21 10:42, Massa, Harald Armin wrote:
> b) creating an index requires to read the data-to-be-indexed. So, to have an
> index pointing at the interesting rows for your query, the table has to be
> read ... which would be the perfect time to allready select the interesting
> rows. And after having the interesting rows: the index is worthless

... until another similar query comes along, when suddenly it's a massive win.
Why not auto-create indices for some limited period after database load
(copy? any large number of inserts from a single connection?), track those
that actually get re-used and remove the rest? Would this not provide
a better out-of-the-box experience for neophytes?

[...]
> Why is the query planner not allowed to create indexes, but only allowed to
>> use or not use what's available?
>>
>
> as in b): Creating an index is quite expensiv

How much more so than doing that full-table-scan plus sort, which your
query is doing anyway?

Cheers,
Jeremy

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Geoff Bowers 2010-12-21 14:14:35 Trouble uninstalling old postgresql installs on osx
Previous Message Dario Beraldi 2010-12-21 13:44:36 Re: Can the query planner create indexes?