Re: vacuum timings
От | Tom Lane |
---|---|
Тема | Re: vacuum timings |
Дата | |
Msg-id | 19678.948516613@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: vacuum timings (Bruce Momjian <pgman@candle.pha.pa.us>) |
Ответы |
Re: vacuum timings
|
Список | pgsql-hackers |
Bruce Momjian <pgman@candle.pha.pa.us> writes: > Conclusions: > o drop/recreate index is slower than vacuum of indexes BTW, I did some profiling of CREATE INDEX this evening (quite unintentionally actually; I was interested in COPY IN, but the pg_dump script I used as driver happened to create some indexes too). I was startled to discover that 60% of the runtime of CREATE INDEX is spent in _bt_invokestrat (which is called from tuplesort.c's comparetup_index, and exists only to figure out which specific comparison routine to call). Of this, a whopping 4% was spent in the useful subroutine, int4gt. All the rest went into lookup and validation checks that by rights should be done once per index creation, not once per comparison. In short: a fairly straightforward bit of optimization will eliminate circa 50% of the CPU time consumed by CREATE INDEX. All we need is to figure out where to cache the lookup results. The optimization would improve insertions and lookups in indexes, as well, if we can cache the lookup results in those scenarios. This was for a table small enough that tuplesort.c could do the sort entirely in memory, so I'm sure the gains would be smaller for a large table that requires a disk-based sort. Still, it seems worth looking into... regards, tom lane
В списке pgsql-hackers по дате отправления: