PostgreSQL - Minor Performance bottleneck in PostgresChangeRecordEmitter
- Expensive call to PostgresSchema.parse() for every record - reuse already parsed TableId from PostgresStreamingChangeEventSource
- conditional return in synchronizeTableSchema() is delayed - can be immediately returned
PostgresSchema.parse() is quite expensive due to multiple Pattern Matching replacements in TableIdParser.parse() (non-trivial time taken visible in JVisualVM Sampler metrics).
Few table parsing / fetching operations executed in synchronizeTableSchema() before conditional return. For PGOUTPUT plugins and other use cases, conditional return is always true. So conditional return can be immediately done in method start.
This is the next performance improvement after