You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since we already supported historical stats and make it enabled by default. It would be convenient for the user to be able to download the plan replayer file with historical stats.
To achieve this, we need to enhance the syntax of the PLAN REPLAYER DUMP statement to specify the expected time, then make the dump logic able to fetch and dump the expected historical stats, and we can reuse the code of historical stats HTTP API for this.
Design
Syntax
Add a new clause WITH STATS AS OF TIMESTAMP [datetime | TSO] after PLAN REPLAYER DUMP. The AS OF TIMESTAMP part is consistent with the stale read syntax.
For example:
plan replayer dump with stats as of timestamp'442012134592479233' explain [analyze] select ...
plan replayer dump with stats as of timestamp'2023-06-14 17:00:00' explain [analyze] select ...
Behavior
If the user specified a valid time and the corresponding historical stats are available, the stats in the replayer file would be the expected historical stats.
The TS used to fetch the historical stats would be recorded in sql_meta.toml in the plan replayer zip file.
If the expected historical stats are not available, it would dump the latest stats (the same as when there's no specified time), and the corresponding table names would be recorded in errors.txt in the plan replayer zip file.
Tests
Create a table (mark as time1), insert some data, then analyze (mark as time2), then insert some data, then analyze again (mark as time3).
Try to use the PLAN REPLAYER DUMP ... AS OF TIMESTAMP time1 ... to get a plan replayer file. In the zip file:
The recorded time in the sql_meta.toml should be consistent with time1.
The stats should be the same as the stats of time3.
It should be recorded in errors.txt that it failed to fetch historical stats of the table.
Try to get plan replayer file at time2. In the zip file:
The recorded time in the sql_meta.toml should be consistent with time2.
The stats should be the same as the stats of time2.
There should be no errors.txt.
Try to get plan replayer file at time2. In the zip file:
The recorded time in the sql_meta.toml should be consistent with time3.
The stats should be the same as the stats of time3.
There should be no errors.txt.
The text was updated successfully, but these errors were encountered:
Backgound
Since we already supported historical stats and make it enabled by default. It would be convenient for the user to be able to download the plan replayer file with historical stats.
To achieve this, we need to enhance the syntax of the
PLAN REPLAYER DUMP
statement to specify the expected time, then make the dump logic able to fetch and dump the expected historical stats, and we can reuse the code of historical stats HTTP API for this.Design
Syntax
Add a new clause
WITH STATS AS OF TIMESTAMP [datetime | TSO]
afterPLAN REPLAYER DUMP
. TheAS OF TIMESTAMP
part is consistent with the stale read syntax.For example:
Behavior
sql_meta.toml
in the plan replayer zip file.errors.txt
in the plan replayer zip file.Tests
PLAN REPLAYER DUMP ... AS OF TIMESTAMP time1 ...
to get a plan replayer file. In the zip file:sql_meta.toml
should be consistent with time1.errors.txt
that it failed to fetch historical stats of the table.sql_meta.toml
should be consistent with time2.errors.txt
.sql_meta.toml
should be consistent with time3.errors.txt
.The text was updated successfully, but these errors were encountered: