Statistics Import and Export commit related issue.

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Jeff Davis <pgsql(at)j-davis(dot)com>, Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
Subject: Statistics Import and Export commit related issue.
Date: 2025-02-25 06:30:00
Message-ID: CACJufxFVq=tq9u1zrHWYSbMi1T07gS9Ff0LJScMco4HZmtZ1xw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

hi.
the thread "Statistics Import and Export" is quite hot.
so a new thread for some minor issue i found.

static int
_tocEntryRequired(TocEntry *te, teSection curSection, ArchiveHandle *AH)
{

if (strcmp(te->desc, "STATISTICS DATA") == 0)
{
if (!ropt->dumpStatistics)
return 0;
else
res = REQ_STATS;
}

/* If it's statistics and we don't want statistics, maybe ignore it */
if (!ropt->dumpStatistics && strcmp(te->desc, "STATISTICS DATA") == 0)
return 0;
}
As you can see, there is some duplicate code there.
in _tocEntryRequired, we can move `` if (strcmp(te->desc, "STATISTICS
DATA") == 0)`` after switch (curSection).
so pg_dump --section option does not influence statistics dump.
attached is the proposed change.

in dumpTableData_copy, we have:
pg_log_info("dumping contents of table \"%s.%s\"",
tbinfo->dobj.namespace->dobj.name, classname);
dumpRelationStats add a pg_log_info would be a good thing.
commit: https://git.postgresql.org/cgit/postgresql.git/commit/?id=1fd1bd871012732e3c6c482667d2f2c56f1a9395
didn't have any pg_log_info.

https://www.postgresql.org/docs/devel/app-pgrestore.html
"""
--jobs=number-of-jobs
Run the most time-consuming steps of pg_restore — those that load
data, create indexes, or create constraints — concurrently, using up
to number-of-jobs concurrent sessions.
"""
we may need to change the above sentence?
pg_restore restore STATISTICS DATA also doing it concurrently if
--jobs is specified.

Attachment Content-Type Size
v1-0001-refactor-_tocEntryRequired-for-STATISTICS-DATA.patch text/x-patch 2.0 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2025-02-25 06:50:38 Re: per backend WAL statistics
Previous Message Ashutosh Bapat 2025-02-25 06:29:24 Re: Test to dump and restore objects left behind by regression