Re: Can the query planner create indexes? - Mailing list pgsql-general

From Jeremy Harris
Subject Re: Can the query planner create indexes?
Date
Msg-id 4D10AF4D.6010501@wizmail.org
Whole thread Raw
In response to Re: Can the query planner create indexes?  ("Massa, Harald Armin" <chef@ghum.de>)
Responses Re: Can the query planner create indexes?  (tv@fuzzy.cz)
List 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



pgsql-general by date:

Previous
From: Dario Beraldi
Date:
Subject: Re: Can the query planner create indexes?
Next
From: Geoff Bowers
Date:
Subject: Trouble uninstalling old postgresql installs on osx