forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit109f079
committed
I made the patch that improved the performance of replace_text().
The content of the patch is as follows:(1)Create shortcut when subtext was not found.(2)Stop using LEFT and RIGHT macro.In LEFT and RIGHT macro, TEXTPOS is executed by the same content asexecution immediately before. The execution frequency of TEXTPOS can bereduced by using text_substring instead of LEFT and RIGHT macro.(3)Add appendStringInfoText, and use it instead ofappendStringInfoString.There is an overhead of PG_TEXT_GET_STR when appendStringInfoString isexecuted by text type. This can be reduced by appendStringInfoText.(4)Reduce execution of TEXTDUP.The effect of the patch that I measured is as follows:- The Data for test was created by 'pgbench -i'.- Test SQL: select replace(aid, '9', 'A') from accounts;- Test results: Linux(CPU: Pentium III, Compiler option: -O2) original: 1.515s patched: 1.250sAtsushi Ogawa1 parent4b97d51 commit109f079
1 file changed
+35
-18
lines changedLines changed: 35 additions & 18 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
48 | 48 |
| |
49 | 49 |
| |
50 | 50 |
| |
51 |
| - | |
52 |
| - | |
53 | 51 |
| |
54 | 52 |
| |
55 | 53 |
| |
56 | 54 |
| |
57 |
| - | |
58 |
| - | |
59 |
| - | |
60 |
| - | |
61 | 55 |
| |
62 | 56 |
| |
63 | 57 |
| |
| |||
67 | 61 |
| |
68 | 62 |
| |
69 | 63 |
| |
| 64 | + | |
| 65 | + | |
70 | 66 |
| |
71 | 67 |
| |
72 | 68 |
| |
| |||
1922 | 1918 |
| |
1923 | 1919 |
| |
1924 | 1920 |
| |
| 1921 | + | |
| 1922 | + | |
| 1923 | + | |
| 1924 | + | |
| 1925 | + | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
| 1930 | + | |
| 1931 | + | |
| 1932 | + | |
1925 | 1933 |
| |
1926 | 1934 |
| |
1927 | 1935 |
| |
| |||
1938 | 1946 |
| |
1939 | 1947 |
| |
1940 | 1948 |
| |
1941 |
| - | |
1942 | 1949 |
| |
1943 | 1950 |
| |
1944 | 1951 |
| |
1945 | 1952 |
| |
1946 | 1953 |
| |
1947 |
| - | |
| 1954 | + | |
1948 | 1955 |
| |
1949 | 1956 |
| |
1950 | 1957 |
| |
1951 | 1958 |
| |
1952 |
| - | |
1953 |
| - | |
| 1959 | + | |
| 1960 | + | |
| 1961 | + | |
| 1962 | + | |
| 1963 | + | |
| 1964 | + | |
| 1965 | + | |
| 1966 | + | |
1954 | 1967 |
| |
1955 | 1968 |
| |
1956 | 1969 |
| |
1957 |
| - | |
1958 |
| - | |
| 1970 | + | |
| 1971 | + | |
| 1972 | + | |
| 1973 | + | |
1959 | 1974 |
| |
1960 |
| - | |
1961 |
| - | |
| 1975 | + | |
| 1976 | + | |
1962 | 1977 |
| |
1963 |
| - | |
| 1978 | + | |
| 1979 | + | |
1964 | 1980 |
| |
1965 | 1981 |
| |
1966 | 1982 |
| |
1967 | 1983 |
| |
1968 | 1984 |
| |
1969 |
| - | |
1970 |
| - | |
| 1985 | + | |
| 1986 | + | |
| 1987 | + | |
1971 | 1988 |
| |
1972 | 1989 |
| |
1973 | 1990 |
| |
|
0 commit comments
Comments
(0)