Joachim Wieland wrote: > + typedef struct AsyncQueueEntry > + { > + /* > + * this record has the maximal length, but usually we limit it to > + * AsyncQueueEntryEmptySize + strlen(payload). > + */ > + Size length; > + Oid dboid; > + TransactionId xid; > + int32 srcPid; > + char channel[NAMEDATALEN]; > + char payload[NOTIFY_PAYLOAD_MAX_LENGTH]; > + } AsyncQueueEntry; > + #define AsyncQueueEntryEmptySize \ > + (sizeof(AsyncQueueEntry) - NOTIFY_PAYLOAD_MAX_LENGTH + 1)
These are the on-disk notifications, right? It seems to me a bit wasteful to store channel name always as NAMEDATALEN bytes. Can we truncate it at its strlen? I realize that this would cause the struct definition to be uglier (you will no longer be able to have both channel and payload pointers, only a char[1] pointer to a data area to which you write both). Typical channel names should be short, so IMHO this is worthwhile. Besides, I think the uglification of code this causes should be fairly contained ... -- Alvaro Herrera http://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers