- Notifications
You must be signed in to change notification settings - Fork5k
Commit41625ab
committed
psql: Add support for pipelines
With \bind, \parse, \bind_named and \close, it is possible to issuequeries from psql using the extended protocol. However, it was notpossible to send these queries using libpq's pipeline mode. Thisfeature has two advantages:- Testing. Pipeline tests were only possible with pgbench, using TAPtests. It now becomes possible to have more SQL tests that are able tostress the backend with pipelines and extended queries. More tests willbe added in a follow-up commit that were discussed on some otherthreads. Some external projects in the community had to implement theirown facility to work around this limitation.- Emulation of custom workloads, with more control over the actionstaken by a client with libpq APIs. It is possible to emulate moreworkload patterns to bottleneck the backend with the extended queryprotocol.This patch adds six new meta-commands to be able to control pipelines:* \startpipeline starts a new pipeline. All extended queries are queueduntil the end of the pipeline are reached or a sync request is sent andprocessed.* \endpipeline ends an existing pipeline. All queued commands are sentto the server and all responses are processed by psql.* \syncpipeline queues a synchronisation request, without flushing thecommands to the server, equivalent of PQsendPipelineSync().* \flush, equivalent of PQflush().* \flushrequest, equivalent of PQsendFlushRequest()* \getresults reads the server's results for the queries in a pipeline.Unsent data is automatically pushed when \getresults is called. It ispossible to control the number of results read in a single meta-commandexecution with an optional parameter, 0 means that all the resultsshould be read.Author: Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>Discussion:https://postgr.es/m/CAO6_XqroE7JuMEm1sWz55rp9fAYX2JwmcP_3m_v51vnOFdsLiQ@mail.gmail.com1 parent40af897 commit41625ab
File tree
11 files changed
+1497
-12
lines changed- doc/src/sgml/ref
- src
- bin/psql
- test/regress
- expected
- sql
11 files changed
+1497
-12
lines changedLines changed: 67 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3674 | 3674 |
| |
3675 | 3675 |
| |
3676 | 3676 |
| |
| 3677 | + | |
| 3678 | + | |
| 3679 | + | |
| 3680 | + | |
| 3681 | + | |
| 3682 | + | |
| 3683 | + | |
| 3684 | + | |
| 3685 | + | |
| 3686 | + | |
| 3687 | + | |
| 3688 | + | |
| 3689 | + | |
| 3690 | + | |
| 3691 | + | |
| 3692 | + | |
| 3693 | + | |
| 3694 | + | |
| 3695 | + | |
| 3696 | + | |
| 3697 | + | |
| 3698 | + | |
| 3699 | + | |
| 3700 | + | |
| 3701 | + | |
| 3702 | + | |
| 3703 | + | |
| 3704 | + | |
| 3705 | + | |
| 3706 | + | |
| 3707 | + | |
| 3708 | + | |
| 3709 | + | |
| 3710 | + | |
| 3711 | + | |
| 3712 | + | |
| 3713 | + | |
| 3714 | + | |
| 3715 | + | |
| 3716 | + | |
| 3717 | + | |
| 3718 | + | |
| 3719 | + | |
| 3720 | + | |
| 3721 | + | |
| 3722 | + | |
| 3723 | + | |
| 3724 | + | |
| 3725 | + | |
| 3726 | + | |
| 3727 | + | |
| 3728 | + | |
| 3729 | + | |
| 3730 | + | |
| 3731 | + | |
| 3732 | + | |
| 3733 | + | |
| 3734 | + | |
| 3735 | + | |
| 3736 | + | |
| 3737 | + | |
| 3738 | + | |
| 3739 | + | |
| 3740 | + | |
| 3741 | + | |
| 3742 | + | |
| 3743 | + | |
3677 | 3744 |
| |
3678 | 3745 |
| |
3679 | 3746 |
| |
|
Lines changed: 170 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
90 | 90 |
| |
91 | 91 |
| |
92 | 92 |
| |
| 93 | + | |
93 | 94 |
| |
94 | 95 |
| |
95 | 96 |
| |
| 97 | + | |
| 98 | + | |
96 | 99 |
| |
97 | 100 |
| |
98 | 101 |
| |
| |||
103 | 106 |
| |
104 | 107 |
| |
105 | 108 |
| |
| 109 | + | |
106 | 110 |
| |
107 | 111 |
| |
108 | 112 |
| |
| |||
132 | 136 |
| |
133 | 137 |
| |
134 | 138 |
| |
| 139 | + | |
| 140 | + | |
135 | 141 |
| |
136 | 142 |
| |
137 | 143 |
| |
| |||
351 | 357 |
| |
352 | 358 |
| |
353 | 359 |
| |
| 360 | + | |
| 361 | + | |
354 | 362 |
| |
355 | 363 |
| |
356 | 364 |
| |
357 | 365 |
| |
358 | 366 |
| |
359 | 367 |
| |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
360 | 372 |
| |
361 | 373 |
| |
362 | 374 |
| |
363 | 375 |
| |
364 | 376 |
| |
365 | 377 |
| |
| 378 | + | |
| 379 | + | |
366 | 380 |
| |
367 | 381 |
| |
368 | 382 |
| |
| |||
411 | 425 |
| |
412 | 426 |
| |
413 | 427 |
| |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
414 | 432 |
| |
415 | 433 |
| |
416 | 434 |
| |
| |||
1515 | 1533 |
| |
1516 | 1534 |
| |
1517 | 1535 |
| |
| 1536 | + | |
| 1537 | + | |
| 1538 | + | |
| 1539 | + | |
| 1540 | + | |
| 1541 | + | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
| 1548 | + | |
| 1549 | + | |
| 1550 | + | |
| 1551 | + | |
| 1552 | + | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
| 1567 | + | |
| 1568 | + | |
| 1569 | + | |
| 1570 | + | |
| 1571 | + | |
| 1572 | + | |
| 1573 | + | |
1518 | 1574 |
| |
1519 | 1575 |
| |
1520 | 1576 |
| |
| |||
1550 | 1606 |
| |
1551 | 1607 |
| |
1552 | 1608 |
| |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
1553 | 1617 |
| |
1554 | 1618 |
| |
1555 | 1619 |
| |
| |||
1703 | 1767 |
| |
1704 | 1768 |
| |
1705 | 1769 |
| |
| 1770 | + | |
| 1771 | + | |
| 1772 | + | |
| 1773 | + | |
| 1774 | + | |
| 1775 | + | |
| 1776 | + | |
| 1777 | + | |
| 1778 | + | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
| 1785 | + | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
| 1789 | + | |
| 1790 | + | |
| 1791 | + | |
| 1792 | + | |
| 1793 | + | |
| 1794 | + | |
| 1795 | + | |
| 1796 | + | |
| 1797 | + | |
| 1798 | + | |
| 1799 | + | |
| 1800 | + | |
| 1801 | + | |
| 1802 | + | |
| 1803 | + | |
| 1804 | + | |
| 1805 | + | |
1706 | 1806 |
| |
1707 | 1807 |
| |
1708 | 1808 |
| |
| |||
1713 | 1813 |
| |
1714 | 1814 |
| |
1715 | 1815 |
| |
| 1816 | + | |
| 1817 | + | |
| 1818 | + | |
| 1819 | + | |
| 1820 | + | |
| 1821 | + | |
1716 | 1822 |
| |
1717 | 1823 |
| |
1718 | 1824 |
| |
| |||
1733 | 1839 |
| |
1734 | 1840 |
| |
1735 | 1841 |
| |
| 1842 | + | |
| 1843 | + | |
| 1844 | + | |
| 1845 | + | |
| 1846 | + | |
| 1847 | + | |
| 1848 | + | |
1736 | 1849 |
| |
1737 | 1850 |
| |
1738 | 1851 |
| |
| |||
2718 | 2831 |
| |
2719 | 2832 |
| |
2720 | 2833 |
| |
| 2834 | + | |
| 2835 | + | |
| 2836 | + | |
| 2837 | + | |
| 2838 | + | |
| 2839 | + | |
| 2840 | + | |
| 2841 | + | |
| 2842 | + | |
| 2843 | + | |
| 2844 | + | |
| 2845 | + | |
| 2846 | + | |
| 2847 | + | |
| 2848 | + | |
| 2849 | + | |
| 2850 | + | |
| 2851 | + | |
| 2852 | + | |
| 2853 | + | |
| 2854 | + | |
| 2855 | + | |
| 2856 | + | |
| 2857 | + | |
| 2858 | + | |
| 2859 | + | |
| 2860 | + | |
| 2861 | + | |
| 2862 | + | |
| 2863 | + | |
| 2864 | + | |
| 2865 | + | |
| 2866 | + | |
| 2867 | + | |
| 2868 | + | |
| 2869 | + | |
| 2870 | + | |
| 2871 | + | |
| 2872 | + | |
| 2873 | + | |
| 2874 | + | |
| 2875 | + | |
| 2876 | + | |
| 2877 | + | |
| 2878 | + | |
| 2879 | + | |
| 2880 | + | |
| 2881 | + | |
| 2882 | + | |
| 2883 | + | |
| 2884 | + | |
| 2885 | + | |
| 2886 | + | |
| 2887 | + | |
| 2888 | + | |
| 2889 | + | |
| 2890 | + | |
2721 | 2891 |
| |
2722 | 2892 |
| |
2723 | 2893 |
| |
|
0 commit comments
Comments
(0)