On Thu, Jan 16, 2025 at 4:56 AM Corey Huinker <corey.huin...@gmail.com> wrote: >> >> >> >> I do like the idea of a "Statistics for ..." prefix, and I think it's >> doable. > > > And that's now implemented. > > >> The caller needs some knowledge about that anyway, to correctly output >> the statistics dump when the schema is not requested. Tests should >> cover those cases, too. > > > Tests for pg_dump --no-statistics and pg_dump --schema-only were added. > Rebased to master as of today. > > I'm not completely happy with this patch, as I had to comment out one check > in pg_backup_archiver that seemed necessary, but perhaps another set of eyes > will set me straight. > > Attached is just the pg_dump stuff, and only for relation/attribute stats. > The extended stats and vacuumdb work will be in their own threads going > forward.
hi The current v38 implementation allows statistics to be placed in either SECTION_DATA or SECTION_POST_DATA. IMHO, moving all statistics to the SECTION_POST_DATA section would simplify things. Attached is a patch that implements this change, (based on your patch, obviously) Reasoning making statistics in SECTION_POST_DATA are: * statistics in multi sections will make the --section handle statistics more harder for pg_dump and pg_restore. * current doc in --schema-only says "It is similar to, but for historical reasons not identical to, specifying --section=pre-data --section=post-data.". section span two sections making this sentence not less accurate. Also, if we want to use --section option to dump all the statistics, we need to use --data and --post-data together to get all the statistics. * generally, --post-data section takes less time then --data section, so putting it in SECTION_POST_DATA won't "cost" us that much. * repairDependencyLoop, repairMatViewBoundaryMultiLoop is quite hard to comprehend. make statistics in SECTION_POST_DATA can make use not to think about these changes. also seems there is no materialized view statistics dump and restore tests in src/bin/pg_dump/t/002_pg_dump.pl * There are many REQ_DATA or REQ_SCHEMA occurrences, for each occurrence, we may need to consider REQ_STATS. make the statistics in SECTION_POST_DATA, then we don't need REQ_STATS. what do you think? This issue [1] seems not yet resolved. [1] https://postgr.es/m/z22kx5x2ihnb8...@momjian.us even if pg_upgrade has options --with-statistics and --with-statistics. we still need a sentence to mention which option is default?
v38-0001-make-statistics-dumped-at-SECTION_POST_DATA.no-cfbot
Description: Binary data