-
-
Notifications
You must be signed in to change notification settings - Fork 244
Makes MON$COMPILED_STATEMENTS and MON$STATEMENTS share blobs with text and plan content of the same statement. #8513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…t and plan content of the same statement.
dsc desc; | ||
|
||
if ((rid == rel_mon_compiled_statements) && EVL_field(nullptr, record, f_mon_cmp_stmt_id, &desc)) | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fb_assert(desc.dsc_dtype == dtype_int64);
{ | ||
stmtId = *(FB_UINT64*) desc.dsc_address; | ||
|
||
if (EVL_field(nullptr, record, f_mon_cmp_stmt_sql_text, &desc)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fb_assert(desc.isBlob());
else | ||
stmtBlobs.text.clear(); | ||
|
||
if (EVL_field(nullptr, record, f_mon_cmp_stmt_expl_plan, &desc)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fb_assert(desc.isBlob());
blobsMap.put(stmtId, stmtBlobs); | ||
} | ||
else if ((rid == rel_mon_statements) && EVL_field(nullptr, record, f_mon_stmt_cmp_stmt_id, &desc)) | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fb_assert(desc.dsc_dtype == dtype_int64);
if (!stmtBlobs.text.isEmpty()) | ||
{ | ||
record->clearNull(f_mon_stmt_sql_text); | ||
if (EVL_field(nullptr, record, f_mon_stmt_sql_text, &desc)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fb_assert(desc.isBlob());
if (!stmtBlobs.plan.isEmpty()) | ||
{ | ||
record->clearNull(f_mon_stmt_expl_plan); | ||
if (EVL_field(nullptr, record, f_mon_stmt_expl_plan, &desc)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fb_assert(desc.isBlob());
if (!stmtBlobs.text.isEmpty() || !stmtBlobs.plan.isEmpty()) | ||
blobsMap.put(stmtId, stmtBlobs); | ||
} | ||
else if ((rid == rel_mon_statements) && EVL_field(nullptr, record, f_mon_stmt_cmp_stmt_id, &desc)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd add a comment that here we assume that compiled statements are stored in the dump before requests.
Co-authored-by: Adriano dos Santos Fernandes <[email protected]>
Any objections to backport it into v5 ? |
No, I don't mind. |
Was it tested enough for a branch which is supposed to be stable? |
There is QA test for it. Also, snapshots of v5 often used by users. |
Makes MON$COMPILED_STATEMENTS and MON$STATEMENTS share blobs with text and plan content of the same statement.
Table
MON$COMPILED_STATEMENTS
introduced in ODS 13.1 with FB5 containsMON$SQL_TEXT
andMON$EXPLAINED_PLAN
fields that duplicate contents of the same fields inMON$STATEMENTS
. The size of SQL text and explained plan could be relatively big, thus it is feasible to not duplicate its, saving memory, disk and CPU circles.This PR makes engine to put statement text and plan into
MON$COMPILED_STATEMENTS
only and share blobs with corresponding record inMON$STATEMENTS
(if present).