Commit 9604f82
committed
sql: implement stats_as_of session variable for time-based statistics selection
This commit adds a new session variable `stats_as_of` that allows
controlling statistics selection based on a specific timestamp rather
than the current time. Previously, statistics selection was always
relative to the current wall clock time, making it difficult to get
consistent query plans for historical analysis or testing.
This feature is only for debugging and troubleshooting, and should not
be used in production.
The implementation is also integrated into the existing canary
statistics logic to respect the as-of timestamp when determining canary
window boundaries.
Release note (sql change): adds a new session variable `stats_as_of`
that allows controlling statistics selection based on a specific
timestamp rather than the current time.1 parent 0d7061d commit 9604f82
File tree
6 files changed
+56
-2
lines changed- pkg/sql
- opt/memo
- sessiondatapb
- sessionmutator
6 files changed
+56
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
686 | 686 | | |
687 | 687 | | |
688 | 688 | | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
689 | 696 | | |
690 | 697 | | |
691 | 698 | | |
692 | 699 | | |
693 | 700 | | |
| 701 | + | |
694 | 702 | | |
695 | 703 | | |
696 | 704 | | |
697 | 705 | | |
698 | 706 | | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
699 | 711 | | |
700 | 712 | | |
701 | 713 | | |
702 | 714 | | |
703 | | - | |
704 | 715 | | |
705 | 716 | | |
706 | 717 | | |
707 | 718 | | |
708 | 719 | | |
709 | 720 | | |
710 | 721 | | |
711 | | - | |
| 722 | + | |
712 | 723 | | |
713 | 724 | | |
714 | 725 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
751 | 751 | | |
752 | 752 | | |
753 | 753 | | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
754 | 758 | | |
755 | 759 | | |
756 | 760 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
1102 | 1103 | | |
1103 | 1104 | | |
1104 | 1105 | | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4444 | 4444 | | |
4445 | 4445 | | |
4446 | 4446 | | |
| 4447 | + | |
| 4448 | + | |
| 4449 | + | |
| 4450 | + | |
| 4451 | + | |
| 4452 | + | |
| 4453 | + | |
| 4454 | + | |
| 4455 | + | |
| 4456 | + | |
| 4457 | + | |
| 4458 | + | |
| 4459 | + | |
| 4460 | + | |
| 4461 | + | |
| 4462 | + | |
| 4463 | + | |
| 4464 | + | |
| 4465 | + | |
| 4466 | + | |
| 4467 | + | |
| 4468 | + | |
| 4469 | + | |
| 4470 | + | |
| 4471 | + | |
| 4472 | + | |
| 4473 | + | |
| 4474 | + | |
| 4475 | + | |
| 4476 | + | |
| 4477 | + | |
| 4478 | + | |
4447 | 4479 | | |
4448 | 4480 | | |
4449 | 4481 | | |
| |||
0 commit comments