Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbe85727

Browse files
committed
Use PREPARE/EXECUTE for repetitive per-object queries in pg_dump.
For objects such as functions, pg_dump issues the same secondarydata-collection query against each object to be dumped. This can'treadily be refactored to avoid the repetitive queries, but we canPREPARE these queries to reduce planning costs.This patch applies the idea to functions, aggregates, operators, anddata types. While it could be carried further, the remaining sorts ofobjects aren't likely to appear in typical databases enough times tobe worth worrying over. Moreover, doing the PREPARE is likely to be anet loss if there aren't at least some dozens of objects to apply theprepared query to.Discussion:https://postgr.es/m/7d7eb6128f40401d81b3b7a898b6b4de@W2012-02.nidsa.loc
1 parent9895961 commitbe85727

File tree

2 files changed

+532
-366
lines changed

2 files changed

+532
-366
lines changed

‎src/bin/pg_dump/pg_backup.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,23 @@ typedef enum _teSection
5858
SECTION_POST_DATA/* stuff to be processed after data */
5959
}teSection;
6060

61+
/* We need one enum entry per prepared query in pg_dump */
62+
enum_dumpPreparedQueries
63+
{
64+
PREPQUERY_DUMPAGG,
65+
PREPQUERY_DUMPBASETYPE,
66+
PREPQUERY_DUMPCOMPOSITETYPE,
67+
PREPQUERY_DUMPDOMAIN,
68+
PREPQUERY_DUMPENUMTYPE,
69+
PREPQUERY_DUMPFUNC,
70+
PREPQUERY_DUMPOPR,
71+
PREPQUERY_DUMPRANGETYPE,
72+
PREPQUERY_DUMPTABLEATTACH,
73+
PREPQUERY_GETCOLUMNACLS,
74+
PREPQUERY_GETDOMAINCONSTRAINTS,
75+
NUM_PREP_QUERIES/* must be last */
76+
};
77+
6178
/* Parameters needed by ConnectDatabase; same for dump and restore */
6279
typedefstruct_connParams
6380
{
@@ -214,6 +231,9 @@ typedef struct Archive
214231
boolexit_on_error;/* whether to exit on SQL errors... */
215232
intn_errors;/* number of errors (if no die) */
216233

234+
/* prepared-query status */
235+
bool*is_prepared;/* indexed by enum _dumpPreparedQueries */
236+
217237
/* The rest is private */
218238
}Archive;
219239

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp