Add support for coordinating record typmods among parallel workers.
Andres Freund <andres@anarazel.de>
Add support for coordinating record typmods among parallel workers. Tuples can have type RECORDOID and a typmod number that identifies a blessed TupleDesc in a backend-private cache. To support the sharing of such tuples through shared memory and temporary files, provide a typmod registry in shared memory. To achieve that, introduce per-session DSM segments, created on demand when a backend first runs a parallel query. The per-session DSM segment has a table-of-contents just like the per-query DSM segment, and initially the contents are a shared record typmod registry and a DSA area to provide the space it needs to grow. State relating to the current session is accessed via a Session object reached through global variable CurrentSession that may require significant redesign further down the road as we figure out what else needs to be shared or remodelled. Author: Thomas Munro Reviewed-By: Andres Freund Discussion: https://postgr.es/m/CAEepm=0ZtQ-SpsgCyzzYpsXS6e=kZWqk3g5Ygn3MDV7A8dabUA@mail.gmail.com
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/access/common/Makefile | modified | +1 −1 |
| src/backend/access/common/session.c | added | +208 −0 |
| src/backend/access/common/tupdesc.c | modified | +16 −0 |
| src/backend/access/transam/parallel.c | modified | +41 −3 |
| src/backend/storage/lmgr/lwlock.c | modified | +7 −1 |
| src/backend/utils/cache/typcache.c | modified | +602 −32 |
| src/backend/utils/init/postinit.c | modified | +4 −0 |
| src/include/access/session.h | added | +44 −0 |
| src/include/access/tupdesc.h | modified | +6 −0 |
| src/include/storage/lwlock.h | modified | +3 −0 |
| src/include/utils/typcache.h | modified | +10 −0 |
| src/tools/pgindent/typedefs.list | modified | +4 −0 |
Discussion
- POC: Sharing record typmods between backends 50 messages · 2017-04-07 → 2017-09-15