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