[pgpool-hackers: 4331] Refactoring send_to_where()

Tatsuo Ishii ishii at sraoss.co.jp
Sun May 7 11:30:52 JST 2023


I have been wondering about the code of send_to_where() for long time.

1) It does a binary search to find out unrecognized queries (nodes)
quickly. However since send_to_where() processes query nodes including
SELECT and other DMLs anyway and that's the hottest code path, I guess
taking away the binary search code does not affect too much in terms
of performance. The binary search code has long list of recognized
query nodes and we have to maintain it if PostgreSQL adds new node
type, which is pain.

2) send_to_where() has query string parameter. But it is not used for
any purpose.

So today I decided to refactor send_to_where() to deal with the issues
above.

For #1, I did quick benchmark using standard pgbench tool:

pgbench -p 11000 -S -n -T 300 -c 10 test

The TPS numbers were 30161.685109 (after) / 30214.696136 (before) =
0.9982. I think the subtle difference is actually a noise. So I can
say that the refactoring did not affect the performance.

In overall, I believe that the refactoring removes the maintenance
pain without loosing anything.

Best reagards,
--
Tatsuo Ishii
SRA OSS LLC
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp


More information about the pgpool-hackers mailing list