projects
/
online_analyze.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f8a834b
)
distinguish unknown and zero number of affected rows
author
Teodor Sigaev
<teodor@sigaev.ru>
Mon, 29 Aug 2016 14:19:14 +0000
(17:19 +0300)
committer
Teodor Sigaev
<teodor@sigaev.ru>
Mon, 29 Aug 2016 14:19:14 +0000
(17:19 +0300)
online_analyze.c
patch
|
blob
|
history
diff --git
a/online_analyze.c
b/online_analyze.c
index
c4c2691
..
4c3e044
100644
(file)
--- a/
online_analyze.c
+++ b/
online_analyze.c
@@
-318,7
+318,7
@@
makeRangeVarFromOid(Oid relOid)
#endif
static void
#endif
static void
-makeAnalyze(Oid relOid, CmdType operation,
u
int32 naffected)
+makeAnalyze(Oid relOid, CmdType operation, int32 naffected)
{
PgStat_StatTabEntry *tabentry;
TimestampTz now = GetCurrentTimestamp();
{
PgStat_StatTabEntry *tabentry;
TimestampTz now = GetCurrentTimestamp();
@@
-326,6
+326,13
@@
makeAnalyze(Oid relOid, CmdType operation, uint32 naffected)
if (relOid == InvalidOid)
return;
if (relOid == InvalidOid)
return;
+ if (naffected == 0)
+ /* return if there is not changes */
+ return;
+ else if (naffected < 0)
+ /* number if affected rows is unknown */
+ naffected = 0;
+
if (get_rel_relkind(relOid) != RELKIND_RELATION)
return;
if (get_rel_relkind(relOid) != RELKIND_RELATION)
return;
@@
-479,7
+486,7
@@
extern PGDLLIMPORT void onlineAnalyzeHooker(QueryDesc *queryDesc);
void
onlineAnalyzeHooker(QueryDesc *queryDesc)
{
void
onlineAnalyzeHooker(QueryDesc *queryDesc)
{
- uint32 naffected =
0
;
+ uint32 naffected =
-1
;
if (queryDesc->estate)
naffected = queryDesc->estate->es_processed;
if (queryDesc->estate)
naffected = queryDesc->estate->es_processed;
@@
-558,7
+565,7
@@
onlineAnalyzeHookerUtility(Node *parsetree, const char *queryString,
if (tblname) {
Oid tblOid = RangeVarGetRelid(tblname, NoLock, true);
if (tblname) {
Oid tblOid = RangeVarGetRelid(tblname, NoLock, true);
- makeAnalyze(tblOid, CMD_INSERT,
0
);
+ makeAnalyze(tblOid, CMD_INSERT,
-1
);
}
}
#endif
}
}
#endif