forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitdc68515
committed
Show values of SET statements as constants in pg_stat_statements
This is a continuation of work like11c34b3, done to reduce thebloat of pg_stat_statements by applying more normalization to queryentries. This commit is able to detect and normalize values inVariableSetStmt, resulting in:SET conf_param = $1Compared to other parse nodes, VariableSetStmt is embedded in much moreplaces in the parser, impacting many query patterns inpg_stat_statements. A custom jumble function is used, with an extrafield in the node to decide if arguments should be included in thejumbling or not, a location field being not enough for this purpose.This approach allows for a finer tuning.Clauses relying on one or more keywords are not normalized, for example:* DEFAULT* FROM CURRENT* List of keywords. SET SESSION CHARACTERISTICS AS TRANSACTION,where it is critical to differentiate different sets of options, is agood example of why normalization should not happen.Some queries use VariableSetStmt for some subclauses with SET, that alsohave their values normalized:- ALTER DATABASE- ALTER ROLE- ALTER SYSTEM- CREATE/ALTER FUNCTIONba90eac has added test coverage for most of the existing SETpatterns. The expected output of these tests shows the difference thiscommit creates. Normalization could be perhaps applied to more portionsof the grammar but what is done here is conservative, and good enough asa starting point.Author: Greg Sabino Mullane, Michael PaquierDiscussion:https://postgr.es/m/36e5bffe-e989-194f-85c8-06e7bc88e6f7@amazon.comDiscussion:https://postgr.es/m/B44FA29D-EBD0-4DD9-ABC2-16F1CB087074@amazon.comDiscussion:https://postgr.es/m/CAKAnmmJtJY2jzQN91=2QAD2eAJAA-Per61eyO48-TyxEg-q0Rg@mail.gmail.com1 parent559efce commitdc68515
File tree
7 files changed
+71
-19
lines changed- contrib/pg_stat_statements/expected
- src
- backend
- nodes
- parser
- include/nodes
7 files changed
+71
-19
lines changedLines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
82 | 82 |
| |
83 | 83 |
| |
84 | 84 |
| |
85 |
| - | |
| 85 | + | |
86 | 86 |
| |
87 | 87 |
| |
88 | 88 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
64 | 64 |
| |
65 | 65 |
| |
66 | 66 |
| |
67 |
| - | |
| 67 | + | |
68 | 68 |
| |
69 | 69 |
| |
70 | 70 |
| |
|
Lines changed: 7 additions & 13 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
108 | 108 |
| |
109 | 109 |
| |
110 | 110 |
| |
111 |
| - | |
| 111 | + | |
112 | 112 |
| |
113 | 113 |
| |
114 | 114 |
| |
| |||
620 | 620 |
| |
621 | 621 |
| |
622 | 622 |
| |
623 |
| - | |
624 |
| - | |
| 623 | + | |
625 | 624 |
| |
626 | 625 |
| |
627 | 626 |
| |
| |||
630 | 629 |
| |
631 | 630 |
| |
632 | 631 |
| |
633 |
| - | |
634 |
| - | |
635 | 632 |
| |
636 | 633 |
| |
637 | 634 |
| |
| |||
641 | 638 |
| |
642 | 639 |
| |
643 | 640 |
| |
644 |
| - | |
645 |
| - | |
646 |
| - | |
647 |
| - | |
| 641 | + | |
| 642 | + | |
648 | 643 |
| |
649 | 644 |
| |
650 |
| - | |
| 645 | + | |
651 | 646 |
| |
652 | 647 |
| |
653 | 648 |
| |
| |||
733 | 728 |
| |
734 | 729 |
| |
735 | 730 |
| |
736 |
| - | |
737 |
| - | |
738 |
| - | |
| 731 | + | |
| 732 | + | |
739 | 733 |
| |
740 | 734 |
| |
741 | 735 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
18 | 18 |
| |
19 | 19 |
| |
20 | 20 |
| |
21 |
| - | |
| 21 | + | |
22 | 22 |
| |
23 | 23 |
| |
24 | 24 |
| |
|
Lines changed: 19 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
57 | 57 |
| |
58 | 58 |
| |
59 | 59 |
| |
| 60 | + | |
60 | 61 |
| |
61 | 62 |
| |
62 | 63 |
| |
| |||
352 | 353 |
| |
353 | 354 |
| |
354 | 355 |
| |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + |
Lines changed: 24 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1647 | 1647 |
| |
1648 | 1648 |
| |
1649 | 1649 |
| |
| 1650 | + | |
| 1651 | + | |
1650 | 1652 |
| |
1651 | 1653 |
| |
1652 | 1654 |
| |
| |||
1656 | 1658 |
| |
1657 | 1659 |
| |
1658 | 1660 |
| |
| 1661 | + | |
| 1662 | + | |
1659 | 1663 |
| |
1660 | 1664 |
| |
1661 | 1665 |
| |
| |||
1669 | 1673 |
| |
1670 | 1674 |
| |
1671 | 1675 |
| |
| 1676 | + | |
1672 | 1677 |
| |
1673 | 1678 |
| |
1674 | 1679 |
| |
| |||
1678 | 1683 |
| |
1679 | 1684 |
| |
1680 | 1685 |
| |
| 1686 | + | |
1681 | 1687 |
| |
1682 | 1688 |
| |
1683 | 1689 |
| |
| |||
1686 | 1692 |
| |
1687 | 1693 |
| |
1688 | 1694 |
| |
| 1695 | + | |
1689 | 1696 |
| |
1690 | 1697 |
| |
1691 | 1698 |
| |
| |||
1694 | 1701 |
| |
1695 | 1702 |
| |
1696 | 1703 |
| |
| 1704 | + | |
1697 | 1705 |
| |
1698 | 1706 |
| |
1699 | 1707 |
| |
| |||
1706 | 1714 |
| |
1707 | 1715 |
| |
1708 | 1716 |
| |
| 1717 | + | |
1709 | 1718 |
| |
1710 | 1719 |
| |
1711 | 1720 |
| |
| |||
1715 | 1724 |
| |
1716 | 1725 |
| |
1717 | 1726 |
| |
| 1727 | + | |
| 1728 | + | |
1718 | 1729 |
| |
1719 | 1730 |
| |
1720 | 1731 |
| |
| |||
1736 | 1747 |
| |
1737 | 1748 |
| |
1738 | 1749 |
| |
| 1750 | + | |
1739 | 1751 |
| |
1740 | 1752 |
| |
1741 | 1753 |
| |
| |||
1744 | 1756 |
| |
1745 | 1757 |
| |
1746 | 1758 |
| |
| 1759 | + | |
1747 | 1760 |
| |
1748 | 1761 |
| |
1749 | 1762 |
| |
| |||
1757 | 1770 |
| |
1758 | 1771 |
| |
1759 | 1772 |
| |
| 1773 | + | |
1760 | 1774 |
| |
1761 | 1775 |
| |
1762 | 1776 |
| |
| |||
1766 | 1780 |
| |
1767 | 1781 |
| |
1768 | 1782 |
| |
| 1783 | + | |
1769 | 1784 |
| |
1770 | 1785 |
| |
1771 | 1786 |
| |
| |||
1774 | 1789 |
| |
1775 | 1790 |
| |
1776 | 1791 |
| |
| 1792 | + | |
1777 | 1793 |
| |
1778 | 1794 |
| |
1779 | 1795 |
| |
| |||
1783 | 1799 |
| |
1784 | 1800 |
| |
1785 | 1801 |
| |
| 1802 | + | |
| 1803 | + | |
1786 | 1804 |
| |
1787 | 1805 |
| |
1788 | 1806 |
| |
| |||
1793 | 1811 |
| |
1794 | 1812 |
| |
1795 | 1813 |
| |
| 1814 | + | |
1796 | 1815 |
| |
1797 | 1816 |
| |
1798 | 1817 |
| |
| |||
1900 | 1919 |
| |
1901 | 1920 |
| |
1902 | 1921 |
| |
| 1922 | + | |
1903 | 1923 |
| |
1904 | 1924 |
| |
1905 | 1925 |
| |
| |||
1908 | 1928 |
| |
1909 | 1929 |
| |
1910 | 1930 |
| |
| 1931 | + | |
1911 | 1932 |
| |
1912 | 1933 |
| |
1913 | 1934 |
| |
| |||
1916 | 1937 |
| |
1917 | 1938 |
| |
1918 | 1939 |
| |
| 1940 | + | |
1919 | 1941 |
| |
1920 | 1942 |
| |
1921 | 1943 |
| |
| |||
1927 | 1949 |
| |
1928 | 1950 |
| |
1929 | 1951 |
| |
| 1952 | + | |
1930 | 1953 |
| |
1931 | 1954 |
| |
1932 | 1955 |
| |
1933 | 1956 |
| |
1934 | 1957 |
| |
1935 | 1958 |
| |
1936 | 1959 |
| |
| 1960 | + | |
1937 | 1961 |
| |
1938 | 1962 |
| |
1939 | 1963 |
| |
|
Lines changed: 18 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2616 | 2616 |
| |
2617 | 2617 |
| |
2618 | 2618 |
| |
| 2619 | + | |
| 2620 | + | |
2619 | 2621 |
| |
2620 | 2622 |
| |
2621 |
| - | |
2622 |
| - | |
2623 |
| - | |
| 2623 | + | |
| 2624 | + | |
| 2625 | + | |
| 2626 | + | |
| 2627 | + | |
| 2628 | + | |
| 2629 | + | |
| 2630 | + | |
| 2631 | + | |
| 2632 | + | |
| 2633 | + | |
| 2634 | + | |
| 2635 | + | |
| 2636 | + | |
| 2637 | + | |
| 2638 | + | |
2624 | 2639 |
| |
2625 | 2640 |
| |
2626 | 2641 |
| |
|
0 commit comments
Comments
(0)