Tried to reproduce on 65 Gb (oltp-emul) and 500+ gb (real system) databases, repeat two times: with FileSystemCacheThreshold greater than and less than DefaultDBCachePages.
table in bot cases contained about 1600 PP. Linux page cache was flushed and cleared before each run of .sql
On Firebird where this fix was not applied (2.5.7, build: 27086) time of preparing query was very small, less than 700 ms. Can not compare such value with smth other.
Sent several letters to hvlad (last: 05-feb-2018 23:56).