aboutsummaryrefslogtreecommitdiff
path: root/src/include/nodes/relation.h
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2014-11-07 17:26:02 -0500
committerRobert Haas <rhaas@postgresql.org>2014-11-07 17:34:36 -0500
commit0b03e5951bf0a1a8868db13f02049cf686a82165 (patch)
tree3495ca06369ec694e68ac84ed19c296a74521f26 /src/include/nodes/relation.h
parent7250d8535b11d6443a9b27299e586c3df0654302 (diff)
downloadpostgresql-0b03e5951bf0a1a8868db13f02049cf686a82165.tar.gz
postgresql-0b03e5951bf0a1a8868db13f02049cf686a82165.zip
Introduce custom path and scan providers.
This allows extension modules to define their own methods for scanning a relation, and get the core code to use them. It's unclear as yet how much use this capability will find, but we won't find out if we never commit it. KaiGai Kohei, reviewed at various times and in various levels of detail by Shigeru Hanada, Tom Lane, Andres Freund, Álvaro Herrera, and myself.
Diffstat (limited to 'src/include/nodes/relation.h')
-rw-r--r--src/include/nodes/relation.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/include/nodes/relation.h b/src/include/nodes/relation.h
index f1a0504c0d4..05cfbcd2aa1 100644
--- a/src/include/nodes/relation.h
+++ b/src/include/nodes/relation.h
@@ -15,6 +15,7 @@
#define RELATION_H
#include "access/sdir.h"
+#include "lib/stringinfo.h"
#include "nodes/params.h"
#include "nodes/parsenodes.h"
#include "storage/block.h"
@@ -884,6 +885,47 @@ typedef struct ForeignPath
} ForeignPath;
/*
+ * CustomPath represents a scan by some out-of-core extension.
+ *
+ * We provide a set of hooks here - which the provider must take care to
+ * set up correctly - to allow extensions to supply their own methods of
+ * scanning a relation. For example, a provider might provide GPU
+ * acceleration, a cache-based scan, or some other kind of logic we haven't
+ * dreamed up yet.
+ *
+ * Core code should avoid assuming that the CustomPath is only as large as
+ * the structure declared here; providers are expected to make it the first
+ * element in a larger structure.
+ */
+
+struct CustomPathMethods;
+struct Plan; /* not to include plannodes.h here */
+
+#define CUSTOMPATH_SUPPORT_BACKWARD_SCAN 0x0001
+#define CUSTOMPATH_SUPPORT_MARK_RESTORE 0x0002
+
+typedef struct CustomPath
+{
+ Path path;
+ uint32 flags;
+ const struct CustomPathMethods *methods;
+} CustomPath;
+
+typedef struct CustomPathMethods
+{
+ const char *CustomName;
+ void (*CreateCustomScanPath)(PlannerInfo *root,
+ RelOptInfo *baserel,
+ RangeTblEntry *rte);
+ struct Plan *(*PlanCustomPath)(PlannerInfo *root,
+ RelOptInfo *rel,
+ CustomPath *best_path,
+ List *tlist,
+ List *clauses);
+ void (*TextOutCustomPath)(StringInfo str, const CustomPath *node);
+} CustomPathMethods;
+
+/*
* AppendPath represents an Append plan, ie, successive execution of
* several member plans.
*