Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

So you’re saying, do something like this?

1. Index-only scans on t_product.{category,color} indices, summing each value

2. Lookup the names of those values in their parent tables, generate output rows

If so, I suspect there are two reasons why it might not do that:

Given the relatively small size of the t_product table (23 bytes overhead + 1 byte padding + int4 + int4 + 16 bytes text + [I think] 1 byte varlena = 49 bytes/row), it will be fairly well bin-packed into pages on the heap, consuming roughly 170 pages, assuming 8 KiB default, and default fillfactor of 100%). That trivially fits into a single segment file on-disk, and is a very easy sequential scan.

If it does a sequential scan on the heap, it doesn’t have to check the Visibility Map, because it already has that information in the heap itself, which avoids a second (albeit small) lookup.

Happy for someone who knows more about Postgres to correct me if I’m wrong, though!





Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: