2 Chapter 60. Writing a Custom Scan Provider
6 60.1. Creating Custom Scan Paths
8 60.1.1. Custom Scan Path Callbacks
10 60.2. Creating Custom Scan Plans
12 60.2.1. Custom Scan Plan Callbacks
14 60.3. Executing Custom Scans
16 60.3.1. Custom Scan Execution Callbacks
18 PostgreSQL supports a set of experimental facilities which are intended
19 to allow extension modules to add new scan types to the system. Unlike
20 a foreign data wrapper, which is only responsible for knowing how to
21 scan its own foreign tables, a custom scan provider can provide an
22 alternative method of scanning any relation in the system. Typically,
23 the motivation for writing a custom scan provider will be to allow the
24 use of some optimization not supported by the core system, such as
25 caching or some form of hardware acceleration. This chapter outlines
26 how to write a new custom scan provider.
28 Implementing a new type of custom scan is a three-step process. First,
29 during planning, it is necessary to generate access paths representing
30 a scan using the proposed strategy. Second, if one of those access
31 paths is selected by the planner as the optimal strategy for scanning a
32 particular relation, the access path must be converted to a plan.
33 Finally, it must be possible to execute the plan and generate the same
34 results that would have been generated for any other access path
35 targeting the same relation.