David Rowley <dgrowleyml@gmail.com> writes:
> I played around with the attached script and set some breakpoints in
> cost_index(). I'm seeing the same thing as you with the parallel path
> being only slightly cheaper, but when looking at cost_index(), it's
> easy to see why.
> It's only the cpu_run_cost that's divided by the parallel_divisor.
D'oh.
What Maxim is observing is that he's getting I/O concurrency from
multiple workers; and that's an effect we're simply not accounting
for here. cost_seqscan excuses the same omission with
* It may be possible to amortize some of the I/O cost, but probably
* not very much, because most operating systems already do aggressive
* prefetching. For now, we assume that the disk run cost can't be
* amortized at all.
but I don't think this prefetch argument applies to index scans.
regards, tom lane