--- /dev/null
+Copyright (c) 2012, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the NIPPON TELEGRAPH AND TELEPHONE CORPORATION
+ (NTT) nor the names of its contributors may be used to endorse or
+ promote products derived from this software without specific prior
+ written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--- /dev/null
+core.c and make_join_rel.c are parts of PostgreSQL Database Management System.
+(formerly known as Postgres, then as Postgres95)
+Copyright holders of those files are following organizations:
+
+Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
+
+Portions Copyright (c) 1994, The Regents of the University of California
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose, without fee, and without a written agreement
+is hereby granted, provided that the above copyright notice and this
+paragraph and the following two paragraphs appear in all copies.
+
+IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
+LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
+DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO
+PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
--- /dev/null
+#
+# pg_hint_plan: Makefile
+#
+# Copyright (c) 2012, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
+#
+
+MODULES = pg_hint_plan
+REGRESS = init base_plan pg_hint_plan ut-init ut-A ut-S ut-J ut-L ut-G ut-fdw ut-fini
+
+REGRESSION_EXPECTED = expected/init.out expected/base_plan.out expected/pg_hint_plan.out expected/ut-A.out expected/ut-S.out expected/ut-J.out expected/ut-L.out expected/ut-G.out
+
+REGRESS_OPTS = --encoding=UTF8
+
+EXTRA_CLEAN = core.c sql/ut-fdw.sql expected/ut-fdw.out $(REGRESSION_EXPECTED)
+
+PG_CONFIG = pg_config
+PGXS := $(shell $(PG_CONFIG) --pgxs)
+include $(PGXS)
+
+core.c: core-$(MAJORVERSION).c
+ cp core-$(MAJORVERSION).c core.c
+
+$(REGRESSION_EXPECTED): %.out: %-$(MAJORVERSION).out
+ cp $< $@
+
+installcheck: $(REGRESSION_EXPECTED)
+
+# pg_hint_plan.c includes core.c and make_join_rel.c
+pg_hint_plan.o: core.c make_join_rel.c
--- /dev/null
+# SPEC file for pg_hint_plan
+# Copyright(C) 2012 NIPPON TELEGRAPH AND TELEPHONE CORPORATION
+
+%define _pgdir /usr/pgsql-9.1
+%define _bindir %{_pgdir}/bin
+%define _libdir %{_pgdir}/lib
+%define _datadir %{_pgdir}/share
+
+## Set general information for pg_hint_plan.
+Summary: Optimizer hint for PostgreSQL 9.1
+Name: pg_hint_plan91
+Version: 1.0.0
+Release: 1%{?dist}
+License: BSD
+Group: Applications/Databases
+Source0: %{name}-%{version}.tar.gz
+#URL: http://example.com/pg_hint_plan/
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-%(%{__id_u} -n)
+Vendor: NIPPON TELEGRAPH AND TELEPHONE CORPORATION
+
+## We use postgresql-devel package
+BuildRequires: postgresql91-devel
+Requires: postgresql91-libs
+
+## Description for "pg_hint_plan"
+%description
+pg_hint_plan provides capability to force arbitrary plan to PostgreSQL' planner
+to optimize queries by hand directly.
+
+If you have query plan better than which PostgreSQL chooses, you can force your
+plan by adding special comment block with optimizer hint before the query you
+want to optimize. You can control scan method, join method, join order, and
+planner-related GUC parameters during planning.
+
+Note that this package is available for only PostgreSQL 9.1.
+
+## pre work for build pg_hint_plan
+%prep
+%setup -q
+
+## Set variables for build environment
+%build
+make %{?_smp_mflags}
+
+## Set variables for install
+%install
+rm -rf %{buildroot}
+install -d %{buildroot}%{_libdir}
+install pg_hint_plan.so %{buildroot}%{_libdir}/pg_hint_plan.so
+
+%clean
+rm -rf %{buildroot}
+
+%files
+%defattr(0755,root,root)
+%{_libdir}/pg_hint_plan.so
+
+# History of pg_hint_plan.
+%changelog
+* Mon Sep 24 2012 Shigeru Hanada <shigeru.hanada@gmail.com>
+- Initial cut for 1.0.0
+
--- /dev/null
+# SPEC file for pg_hint_plan
+# Copyright(C) 2012 NIPPON TELEGRAPH AND TELEPHONE CORPORATION
+
+%define _pgdir /usr/pgsql-9.2
+%define _bindir %{_pgdir}/bin
+%define _libdir %{_pgdir}/lib
+%define _datadir %{_pgdir}/share
+
+## Set general information for pg_hint_plan.
+Summary: Optimizer hint for PostgreSQL 9.2
+Name: pg_hint_plan92
+Version: 1.0.0
+Release: 1%{?dist}
+License: BSD
+Group: Applications/Databases
+Source0: %{name}-%{version}.tar.gz
+#URL: http://example.com/pg_hint_plan/
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-%(%{__id_u} -n)
+Vendor: NIPPON TELEGRAPH AND TELEPHONE CORPORATION
+
+## We use postgresql-devel package
+BuildRequires: postgresql92-devel
+Requires: postgresql92-libs
+
+## Description for "pg_hint_plan"
+%description
+pg_hint_plan provides capability to force arbitrary plan to PostgreSQL' planner
+to optimize queries by hand directly.
+
+If you have query plan better than which PostgreSQL chooses, you can force your
+plan by adding special comment block with optimizer hint before the query you
+want to optimize. You can control scan method, join method, join order, and
+planner-related GUC parameters during planning.
+
+Note that this package is available for only PostgreSQL 9.2.
+
+## pre work for build pg_hint_plan
+%prep
+%setup -q
+
+## Set variables for build environment
+%build
+make %{?_smp_mflags}
+
+## Set variables for install
+%install
+rm -rf %{buildroot}
+install -d %{buildroot}%{_libdir}
+install pg_hint_plan.so %{buildroot}%{_libdir}/pg_hint_plan.so
+
+%clean
+rm -rf %{buildroot}
+
+%files
+%defattr(0755,root,root)
+%{_libdir}/pg_hint_plan.so
+
+# History of pg_hint_plan.
+%changelog
+* Mon Sep 24 2012 Shigeru Hanada <shigeru.hanada@gmail.com>
+- Initial cut for 1.0.0
+
--- /dev/null
+/*-------------------------------------------------------------------------
+ *
+ * core.c
+ * Routines copied from PostgreSQL core distribution.
+ *
+ * src/backend/optimizer/path/allpaths.c
+ * set_append_rel_pathlist()
+ * accumulate_append_subpath()
+ * set_dummy_rel_pathlist()
+ * standard_join_search()
+ *
+ * src/backend/optimizer/path/joinrels.c
+ * join_search_one_level()
+ * make_rels_by_clause_joins()
+ * make_rels_by_clauseless_joins()
+ * join_is_legal()
+ * has_join_restriction()
+ * is_dummy_rel()
+ * mark_dummy_rel()
+ * restriction_is_constant_false()
+ *
+ * Portions Copyright (c) 1996-2011, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ *-------------------------------------------------------------------------
+ */
+
+/*
+ * set_append_rel_pathlist
+ * Build access paths for an "append relation"
+ *
+ * The passed-in rel and RTE represent the entire append relation. The
+ * relation's contents are computed by appending together the output of
+ * the individual member relations. Note that in the inheritance case,
+ * the first member relation is actually the same table as is mentioned in
+ * the parent RTE ... but it has a different RTE and RelOptInfo. This is
+ * a good thing because their outputs are not the same size.
+ */
+static void
+set_append_rel_pathlist(PlannerInfo *root, RelOptInfo *rel,
+ Index rti, RangeTblEntry *rte)
+{
+ int parentRTindex = rti;
+ List *live_childrels = NIL;
+ List *subpaths = NIL;
+ List *all_child_pathkeys = NIL;
+ double parent_rows;
+ double parent_size;
+ double *parent_attrsizes;
+ int nattrs;
+ ListCell *l;
+
+ /*
+ * Initialize to compute size estimates for whole append relation.
+ *
+ * We handle width estimates by weighting the widths of different child
+ * rels proportionally to their number of rows. This is sensible because
+ * the use of width estimates is mainly to compute the total relation
+ * "footprint" if we have to sort or hash it. To do this, we sum the
+ * total equivalent size (in "double" arithmetic) and then divide by the
+ * total rowcount estimate. This is done separately for the total rel
+ * width and each attribute.
+ *
+ * Note: if you consider changing this logic, beware that child rels could
+ * have zero rows and/or width, if they were excluded by constraints.
+ */
+ parent_rows = 0;
+ parent_size = 0;
+ nattrs = rel->max_attr - rel->min_attr + 1;
+ parent_attrsizes = (double *) palloc0(nattrs * sizeof(double));
+
+ /*
+ * Generate access paths for each member relation, and pick the cheapest
+ * path for each one.
+ */
+ foreach(l, root->append_rel_list)
+ {
+ AppendRelInfo *appinfo = (AppendRelInfo *) lfirst(l);
+ int childRTindex;
+ RangeTblEntry *childRTE;
+ RelOptInfo *childrel;
+ List *childquals;
+ Node *childqual;
+ ListCell *lcp;
+ ListCell *parentvars;
+ ListCell *childvars;
+
+ /* append_rel_list contains all append rels; ignore others */
+ if (appinfo->parent_relid != parentRTindex)
+ continue;
+
+ childRTindex = appinfo->child_relid;
+ childRTE = root->simple_rte_array[childRTindex];
+
+ /*
+ * The child rel's RelOptInfo was already created during
+ * add_base_rels_to_query.
+ */
+ childrel = find_base_rel(root, childRTindex);
+ Assert(childrel->reloptkind == RELOPT_OTHER_MEMBER_REL);
+
+ /*
+ * We have to copy the parent's targetlist and quals to the child,
+ * with appropriate substitution of variables. However, only the
+ * baserestrictinfo quals are needed before we can check for
+ * constraint exclusion; so do that first and then check to see if we
+ * can disregard this child.
+ *
+ * As of 8.4, the child rel's targetlist might contain non-Var
+ * expressions, which means that substitution into the quals could
+ * produce opportunities for const-simplification, and perhaps even
+ * pseudoconstant quals. To deal with this, we strip the RestrictInfo
+ * nodes, do the substitution, do const-simplification, and then
+ * reconstitute the RestrictInfo layer.
+ */
+ childquals = get_all_actual_clauses(rel->baserestrictinfo);
+ childquals = (List *) adjust_appendrel_attrs((Node *) childquals,
+ appinfo);
+ childqual = eval_const_expressions(root, (Node *)
+ make_ands_explicit(childquals));
+ if (childqual && IsA(childqual, Const) &&
+ (((Const *) childqual)->constisnull ||
+ !DatumGetBool(((Const *) childqual)->constvalue)))
+ {
+ /*
+ * Restriction reduces to constant FALSE or constant NULL after
+ * substitution, so this child need not be scanned.
+ */
+ set_dummy_rel_pathlist(childrel);
+ continue;
+ }
+ childquals = make_ands_implicit((Expr *) childqual);
+ childquals = make_restrictinfos_from_actual_clauses(root,
+ childquals);
+ childrel->baserestrictinfo = childquals;
+
+ if (relation_excluded_by_constraints(root, childrel, childRTE))
+ {
+ /*
+ * This child need not be scanned, so we can omit it from the
+ * appendrel. Mark it with a dummy cheapest-path though, in case
+ * best_appendrel_indexscan() looks at it later.
+ */
+ set_dummy_rel_pathlist(childrel);
+ continue;
+ }
+
+ /*
+ * CE failed, so finish copying/modifying targetlist and join quals.
+ *
+ * Note: the resulting childrel->reltargetlist may contain arbitrary
+ * expressions, which normally would not occur in a reltargetlist.
+ * That is okay because nothing outside of this routine will look at
+ * the child rel's reltargetlist. We do have to cope with the case
+ * while constructing attr_widths estimates below, though.
+ */
+ childrel->joininfo = (List *)
+ adjust_appendrel_attrs((Node *) rel->joininfo,
+ appinfo);
+ childrel->reltargetlist = (List *)
+ adjust_appendrel_attrs((Node *) rel->reltargetlist,
+ appinfo);
+
+ /*
+ * We have to make child entries in the EquivalenceClass data
+ * structures as well. This is needed either if the parent
+ * participates in some eclass joins (because we will want to consider
+ * inner-indexscan joins on the individual children) or if the parent
+ * has useful pathkeys (because we should try to build MergeAppend
+ * paths that produce those sort orderings).
+ */
+ if (rel->has_eclass_joins || has_useful_pathkeys(root, rel))
+ add_child_rel_equivalences(root, appinfo, rel, childrel);
+ childrel->has_eclass_joins = rel->has_eclass_joins;
+
+ /*
+ * Note: we could compute appropriate attr_needed data for the child's
+ * variables, by transforming the parent's attr_needed through the
+ * translated_vars mapping. However, currently there's no need
+ * because attr_needed is only examined for base relations not
+ * otherrels. So we just leave the child's attr_needed empty.
+ */
+
+ /* Remember which childrels are live, for MergeAppend logic below */
+ live_childrels = lappend(live_childrels, childrel);
+
+ /*
+ * Compute the child's access paths, and add the cheapest one to the
+ * Append path we are constructing for the parent.
+ */
+ set_rel_pathlist(root, childrel, childRTindex, childRTE);
+
+ subpaths = accumulate_append_subpath(subpaths,
+ childrel->cheapest_total_path);
+
+ /*
+ * Collect a list of all the available path orderings for all the
+ * children. We use this as a heuristic to indicate which sort
+ * orderings we should build MergeAppend paths for.
+ */
+ foreach(lcp, childrel->pathlist)
+ {
+ Path *childpath = (Path *) lfirst(lcp);
+ List *childkeys = childpath->pathkeys;
+ ListCell *lpk;
+ bool found = false;
+
+ /* Ignore unsorted paths */
+ if (childkeys == NIL)
+ continue;
+
+ /* Have we already seen this ordering? */
+ foreach(lpk, all_child_pathkeys)
+ {
+ List *existing_pathkeys = (List *) lfirst(lpk);
+
+ if (compare_pathkeys(existing_pathkeys,
+ childkeys) == PATHKEYS_EQUAL)
+ {
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ {
+ /* No, so add it to all_child_pathkeys */
+ all_child_pathkeys = lappend(all_child_pathkeys, childkeys);
+ }
+ }
+
+ /*
+ * Accumulate size information from each child.
+ */
+ if (childrel->rows > 0)
+ {
+ parent_rows += childrel->rows;
+ parent_size += childrel->width * childrel->rows;
+
+ /*
+ * Accumulate per-column estimates too. We need not do anything
+ * for PlaceHolderVars in the parent list. If child expression
+ * isn't a Var, or we didn't record a width estimate for it, we
+ * have to fall back on a datatype-based estimate.
+ *
+ * By construction, child's reltargetlist is 1-to-1 with parent's.
+ */
+ forboth(parentvars, rel->reltargetlist,
+ childvars, childrel->reltargetlist)
+ {
+ Var *parentvar = (Var *) lfirst(parentvars);
+ Node *childvar = (Node *) lfirst(childvars);
+
+ if (IsA(parentvar, Var))
+ {
+ int pndx = parentvar->varattno - rel->min_attr;
+ int32 child_width = 0;
+
+ if (IsA(childvar, Var))
+ {
+ int cndx = ((Var *) childvar)->varattno - childrel->min_attr;
+
+ child_width = childrel->attr_widths[cndx];
+ }
+ if (child_width <= 0)
+ child_width = get_typavgwidth(exprType(childvar),
+ exprTypmod(childvar));
+ Assert(child_width > 0);
+ parent_attrsizes[pndx] += child_width * childrel->rows;
+ }
+ }
+ }
+ }
+
+ /*
+ * Save the finished size estimates.
+ */
+ rel->rows = parent_rows;
+ if (parent_rows > 0)
+ {
+ int i;
+
+ rel->width = rint(parent_size / parent_rows);
+ for (i = 0; i < nattrs; i++)
+ rel->attr_widths[i] = rint(parent_attrsizes[i] / parent_rows);
+ }
+ else
+ rel->width = 0; /* attr_widths should be zero already */
+
+ /*
+ * Set "raw tuples" count equal to "rows" for the appendrel; needed
+ * because some places assume rel->tuples is valid for any baserel.
+ */
+ rel->tuples = parent_rows;
+
+ pfree(parent_attrsizes);
+
+ /*
+ * Next, build an unordered Append path for the rel. (Note: this is
+ * correct even if we have zero or one live subpath due to constraint
+ * exclusion.)
+ */
+ add_path(rel, (Path *) create_append_path(rel, subpaths));
+
+ /*
+ * Next, build MergeAppend paths based on the collected list of child
+ * pathkeys. We consider both cheapest-startup and cheapest-total cases,
+ * ie, for each interesting ordering, collect all the cheapest startup
+ * subpaths and all the cheapest total paths, and build a MergeAppend path
+ * for each list.
+ */
+ foreach(l, all_child_pathkeys)
+ {
+ List *pathkeys = (List *) lfirst(l);
+ List *startup_subpaths = NIL;
+ List *total_subpaths = NIL;
+ bool startup_neq_total = false;
+ ListCell *lcr;
+
+ /* Select the child paths for this ordering... */
+ foreach(lcr, live_childrels)
+ {
+ RelOptInfo *childrel = (RelOptInfo *) lfirst(lcr);
+ Path *cheapest_startup,
+ *cheapest_total;
+
+ /* Locate the right paths, if they are available. */
+ cheapest_startup =
+ get_cheapest_path_for_pathkeys(childrel->pathlist,
+ pathkeys,
+ STARTUP_COST);
+ cheapest_total =
+ get_cheapest_path_for_pathkeys(childrel->pathlist,
+ pathkeys,
+ TOTAL_COST);
+
+ /*
+ * If we can't find any paths with the right order just add the
+ * cheapest-total path; we'll have to sort it.
+ */
+ if (cheapest_startup == NULL)
+ cheapest_startup = childrel->cheapest_total_path;
+ if (cheapest_total == NULL)
+ cheapest_total = childrel->cheapest_total_path;
+
+ /*
+ * Notice whether we actually have different paths for the
+ * "cheapest" and "total" cases; frequently there will be no point
+ * in two create_merge_append_path() calls.
+ */
+ if (cheapest_startup != cheapest_total)
+ startup_neq_total = true;
+
+ startup_subpaths =
+ accumulate_append_subpath(startup_subpaths, cheapest_startup);
+ total_subpaths =
+ accumulate_append_subpath(total_subpaths, cheapest_total);
+ }
+
+ /* ... and build the MergeAppend paths */
+ add_path(rel, (Path *) create_merge_append_path(root,
+ rel,
+ startup_subpaths,
+ pathkeys));
+ if (startup_neq_total)
+ add_path(rel, (Path *) create_merge_append_path(root,
+ rel,
+ total_subpaths,
+ pathkeys));
+ }
+
+ /* Select cheapest path */
+ set_cheapest(rel);
+}
+
+/*
+ * accumulate_append_subpath
+ * Add a subpath to the list being built for an Append or MergeAppend
+ *
+ * It's possible that the child is itself an Append path, in which case
+ * we can "cut out the middleman" and just add its child paths to our
+ * own list. (We don't try to do this earlier because we need to
+ * apply both levels of transformation to the quals.)
+ */
+static List *
+accumulate_append_subpath(List *subpaths, Path *path)
+{
+ if (IsA(path, AppendPath))
+ {
+ AppendPath *apath = (AppendPath *) path;
+
+ /* list_copy is important here to avoid sharing list substructure */
+ return list_concat(subpaths, list_copy(apath->subpaths));
+ }
+ else
+ return lappend(subpaths, path);
+}
+
+/*
+ * set_dummy_rel_pathlist
+ * Build a dummy path for a relation that's been excluded by constraints
+ *
+ * Rather than inventing a special "dummy" path type, we represent this as an
+ * AppendPath with no members (see also IS_DUMMY_PATH macro).
+ */
+static void
+set_dummy_rel_pathlist(RelOptInfo *rel)
+{
+ /* Set dummy size estimates --- we leave attr_widths[] as zeroes */
+ rel->rows = 0;
+ rel->width = 0;
+
+ add_path(rel, (Path *) create_append_path(rel, NIL));
+
+ /* Select cheapest path (pretty easy in this case...) */
+ set_cheapest(rel);
+}
+
+/*
+ * standard_join_search
+ * Find possible joinpaths for a query by successively finding ways
+ * to join component relations into join relations.
+ *
+ * 'levels_needed' is the number of iterations needed, ie, the number of
+ * independent jointree items in the query. This is > 1.
+ *
+ * 'initial_rels' is a list of RelOptInfo nodes for each independent
+ * jointree item. These are the components to be joined together.
+ * Note that levels_needed == list_length(initial_rels).
+ *
+ * Returns the final level of join relations, i.e., the relation that is
+ * the result of joining all the original relations together.
+ * At least one implementation path must be provided for this relation and
+ * all required sub-relations.
+ *
+ * To support loadable plugins that modify planner behavior by changing the
+ * join searching algorithm, we provide a hook variable that lets a plugin
+ * replace or supplement this function. Any such hook must return the same
+ * final join relation as the standard code would, but it might have a
+ * different set of implementation paths attached, and only the sub-joinrels
+ * needed for these paths need have been instantiated.
+ *
+ * Note to plugin authors: the functions invoked during standard_join_search()
+ * modify root->join_rel_list and root->join_rel_hash. If you want to do more
+ * than one join-order search, you'll probably need to save and restore the
+ * original states of those data structures. See geqo_eval() for an example.
+ */
+RelOptInfo *
+standard_join_search(PlannerInfo *root, int levels_needed, List *initial_rels)
+{
+ int lev;
+ RelOptInfo *rel;
+
+ /*
+ * This function cannot be invoked recursively within any one planning
+ * problem, so join_rel_level[] can't be in use already.
+ */
+ Assert(root->join_rel_level == NULL);
+
+ /*
+ * We employ a simple "dynamic programming" algorithm: we first find all
+ * ways to build joins of two jointree items, then all ways to build joins
+ * of three items (from two-item joins and single items), then four-item
+ * joins, and so on until we have considered all ways to join all the
+ * items into one rel.
+ *
+ * root->join_rel_level[j] is a list of all the j-item rels. Initially we
+ * set root->join_rel_level[1] to represent all the single-jointree-item
+ * relations.
+ */
+ root->join_rel_level = (List **) palloc0((levels_needed + 1) * sizeof(List *));
+
+ root->join_rel_level[1] = initial_rels;
+
+ for (lev = 2; lev <= levels_needed; lev++)
+ {
+ ListCell *lc;
+
+ /*
+ * Determine all possible pairs of relations to be joined at this
+ * level, and build paths for making each one from every available
+ * pair of lower-level relations.
+ */
+ join_search_one_level(root, lev);
+
+ /*
+ * Do cleanup work on each just-processed rel.
+ */
+ foreach(lc, root->join_rel_level[lev])
+ {
+ rel = (RelOptInfo *) lfirst(lc);
+
+ /* Find and save the cheapest paths for this rel */
+ set_cheapest(rel);
+
+#ifdef OPTIMIZER_DEBUG
+ debug_print_rel(root, rel);
+#endif
+ }
+ }
+
+ /*
+ * We should have a single rel at the final level.
+ */
+ if (root->join_rel_level[levels_needed] == NIL)
+ elog(ERROR, "failed to build any %d-way joins", levels_needed);
+ Assert(list_length(root->join_rel_level[levels_needed]) == 1);
+
+ rel = (RelOptInfo *) linitial(root->join_rel_level[levels_needed]);
+
+ root->join_rel_level = NULL;
+
+ return rel;
+}
+
+/*
+ * join_search_one_level
+ * Consider ways to produce join relations containing exactly 'level'
+ * jointree items. (This is one step of the dynamic-programming method
+ * embodied in standard_join_search.) Join rel nodes for each feasible
+ * combination of lower-level rels are created and returned in a list.
+ * Implementation paths are created for each such joinrel, too.
+ *
+ * level: level of rels we want to make this time
+ * root->join_rel_level[j], 1 <= j < level, is a list of rels containing j items
+ *
+ * The result is returned in root->join_rel_level[level].
+ */
+void
+join_search_one_level(PlannerInfo *root, int level)
+{
+ List **joinrels = root->join_rel_level;
+ ListCell *r;
+ int k;
+
+ Assert(joinrels[level] == NIL);
+
+ /* Set join_cur_level so that new joinrels are added to proper list */
+ root->join_cur_level = level;
+
+ /*
+ * First, consider left-sided and right-sided plans, in which rels of
+ * exactly level-1 member relations are joined against initial relations.
+ * We prefer to join using join clauses, but if we find a rel of level-1
+ * members that has no join clauses, we will generate Cartesian-product
+ * joins against all initial rels not already contained in it.
+ *
+ * In the first pass (level == 2), we try to join each initial rel to each
+ * initial rel that appears later in joinrels[1]. (The mirror-image joins
+ * are handled automatically by make_join_rel.) In later passes, we try
+ * to join rels of size level-1 from joinrels[level-1] to each initial rel
+ * in joinrels[1].
+ */
+ foreach(r, joinrels[level - 1])
+ {
+ RelOptInfo *old_rel = (RelOptInfo *) lfirst(r);
+ ListCell *other_rels;
+
+ if (level == 2)
+ other_rels = lnext(r); /* only consider remaining initial
+ * rels */
+ else
+ other_rels = list_head(joinrels[1]); /* consider all initial
+ * rels */
+
+ if (old_rel->joininfo != NIL || old_rel->has_eclass_joins ||
+ has_join_restriction(root, old_rel))
+ {
+ /*
+ * Note that if all available join clauses for this rel require
+ * more than one other rel, we will fail to make any joins against
+ * it here. In most cases that's OK; it'll be considered by
+ * "bushy plan" join code in a higher-level pass where we have
+ * those other rels collected into a join rel.
+ *
+ * See also the last-ditch case below.
+ */
+ make_rels_by_clause_joins(root,
+ old_rel,
+ other_rels);
+ }
+ else
+ {
+ /*
+ * Oops, we have a relation that is not joined to any other
+ * relation, either directly or by join-order restrictions.
+ * Cartesian product time.
+ */
+ make_rels_by_clauseless_joins(root,
+ old_rel,
+ other_rels);
+ }
+ }
+
+ /*
+ * Now, consider "bushy plans" in which relations of k initial rels are
+ * joined to relations of level-k initial rels, for 2 <= k <= level-2.
+ *
+ * We only consider bushy-plan joins for pairs of rels where there is a
+ * suitable join clause (or join order restriction), in order to avoid
+ * unreasonable growth of planning time.
+ */
+ for (k = 2;; k++)
+ {
+ int other_level = level - k;
+
+ /*
+ * Since make_join_rel(x, y) handles both x,y and y,x cases, we only
+ * need to go as far as the halfway point.
+ */
+ if (k > other_level)
+ break;
+
+ foreach(r, joinrels[k])
+ {
+ RelOptInfo *old_rel = (RelOptInfo *) lfirst(r);
+ ListCell *other_rels;
+ ListCell *r2;
+
+ /*
+ * We can ignore clauseless joins here, *except* when they
+ * participate in join-order restrictions --- then we might have
+ * to force a bushy join plan.
+ */
+ if (old_rel->joininfo == NIL && !old_rel->has_eclass_joins &&
+ !has_join_restriction(root, old_rel))
+ continue;
+
+ if (k == other_level)
+ other_rels = lnext(r); /* only consider remaining rels */
+ else
+ other_rels = list_head(joinrels[other_level]);
+
+ for_each_cell(r2, other_rels)
+ {
+ RelOptInfo *new_rel = (RelOptInfo *) lfirst(r2);
+
+ if (!bms_overlap(old_rel->relids, new_rel->relids))
+ {
+ /*
+ * OK, we can build a rel of the right level from this
+ * pair of rels. Do so if there is at least one usable
+ * join clause or a relevant join restriction.
+ */
+ if (have_relevant_joinclause(root, old_rel, new_rel) ||
+ have_join_order_restriction(root, old_rel, new_rel))
+ {
+ (void) make_join_rel(root, old_rel, new_rel);
+ }
+ }
+ }
+ }
+ }
+
+ /*
+ * Last-ditch effort: if we failed to find any usable joins so far, force
+ * a set of cartesian-product joins to be generated. This handles the
+ * special case where all the available rels have join clauses but we
+ * cannot use any of those clauses yet. An example is
+ *
+ * SELECT * FROM a,b,c WHERE (a.f1 + b.f2 + c.f3) = 0;
+ *
+ * The join clause will be usable at level 3, but at level 2 we have no
+ * choice but to make cartesian joins. We consider only left-sided and
+ * right-sided cartesian joins in this case (no bushy).
+ */
+ if (joinrels[level] == NIL)
+ {
+ /*
+ * This loop is just like the first one, except we always call
+ * make_rels_by_clauseless_joins().
+ */
+ foreach(r, joinrels[level - 1])
+ {
+ RelOptInfo *old_rel = (RelOptInfo *) lfirst(r);
+ ListCell *other_rels;
+
+ if (level == 2)
+ other_rels = lnext(r); /* only consider remaining initial
+ * rels */
+ else
+ other_rels = list_head(joinrels[1]); /* consider all initial
+ * rels */
+
+ make_rels_by_clauseless_joins(root,
+ old_rel,
+ other_rels);
+ }
+
+ /*----------
+ * When special joins are involved, there may be no legal way
+ * to make an N-way join for some values of N. For example consider
+ *
+ * SELECT ... FROM t1 WHERE
+ * x IN (SELECT ... FROM t2,t3 WHERE ...) AND
+ * y IN (SELECT ... FROM t4,t5 WHERE ...)
+ *
+ * We will flatten this query to a 5-way join problem, but there are
+ * no 4-way joins that join_is_legal() will consider legal. We have
+ * to accept failure at level 4 and go on to discover a workable
+ * bushy plan at level 5.
+ *
+ * However, if there are no special joins then join_is_legal() should
+ * never fail, and so the following sanity check is useful.
+ *----------
+ */
+ if (joinrels[level] == NIL && root->join_info_list == NIL)
+ elog(ERROR, "failed to build any %d-way joins", level);
+ }
+}
+
+/*
+ * make_rels_by_clause_joins
+ * Build joins between the given relation 'old_rel' and other relations
+ * that participate in join clauses that 'old_rel' also participates in
+ * (or participate in join-order restrictions with it).
+ * The join rels are returned in root->join_rel_level[join_cur_level].
+ *
+ * Note: at levels above 2 we will generate the same joined relation in
+ * multiple ways --- for example (a join b) join c is the same RelOptInfo as
+ * (b join c) join a, though the second case will add a different set of Paths
+ * to it. This is the reason for using the join_rel_level mechanism, which
+ * automatically ensures that each new joinrel is only added to the list once.
+ *
+ * 'old_rel' is the relation entry for the relation to be joined
+ * 'other_rels': the first cell in a linked list containing the other
+ * rels to be considered for joining
+ *
+ * Currently, this is only used with initial rels in other_rels, but it
+ * will work for joining to joinrels too.
+ */
+static void
+make_rels_by_clause_joins(PlannerInfo *root,
+ RelOptInfo *old_rel,
+ ListCell *other_rels)
+{
+ ListCell *l;
+
+ for_each_cell(l, other_rels)
+ {
+ RelOptInfo *other_rel = (RelOptInfo *) lfirst(l);
+
+ if (!bms_overlap(old_rel->relids, other_rel->relids) &&
+ (have_relevant_joinclause(root, old_rel, other_rel) ||
+ have_join_order_restriction(root, old_rel, other_rel)))
+ {
+ (void) make_join_rel(root, old_rel, other_rel);
+ }
+ }
+}
+
+/*
+ * make_rels_by_clauseless_joins
+ * Given a relation 'old_rel' and a list of other relations
+ * 'other_rels', create a join relation between 'old_rel' and each
+ * member of 'other_rels' that isn't already included in 'old_rel'.
+ * The join rels are returned in root->join_rel_level[join_cur_level].
+ *
+ * 'old_rel' is the relation entry for the relation to be joined
+ * 'other_rels': the first cell of a linked list containing the
+ * other rels to be considered for joining
+ *
+ * Currently, this is only used with initial rels in other_rels, but it would
+ * work for joining to joinrels too.
+ */
+static void
+make_rels_by_clauseless_joins(PlannerInfo *root,
+ RelOptInfo *old_rel,
+ ListCell *other_rels)
+{
+ ListCell *l;
+
+ for_each_cell(l, other_rels)
+ {
+ RelOptInfo *other_rel = (RelOptInfo *) lfirst(l);
+
+ if (!bms_overlap(other_rel->relids, old_rel->relids))
+ {
+ (void) make_join_rel(root, old_rel, other_rel);
+ }
+ }
+}
+
+/*
+ * join_is_legal
+ * Determine whether a proposed join is legal given the query's
+ * join order constraints; and if it is, determine the join type.
+ *
+ * Caller must supply not only the two rels, but the union of their relids.
+ * (We could simplify the API by computing joinrelids locally, but this
+ * would be redundant work in the normal path through make_join_rel.)
+ *
+ * On success, *sjinfo_p is set to NULL if this is to be a plain inner join,
+ * else it's set to point to the associated SpecialJoinInfo node. Also,
+ * *reversed_p is set TRUE if the given relations need to be swapped to
+ * match the SpecialJoinInfo node.
+ */
+static bool
+join_is_legal(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2,
+ Relids joinrelids,
+ SpecialJoinInfo **sjinfo_p, bool *reversed_p)
+{
+ SpecialJoinInfo *match_sjinfo;
+ bool reversed;
+ bool unique_ified;
+ bool is_valid_inner;
+ ListCell *l;
+
+ /*
+ * Ensure output params are set on failure return. This is just to
+ * suppress uninitialized-variable warnings from overly anal compilers.
+ */
+ *sjinfo_p = NULL;
+ *reversed_p = false;
+
+ /*
+ * If we have any special joins, the proposed join might be illegal; and
+ * in any case we have to determine its join type. Scan the join info
+ * list for conflicts.
+ */
+ match_sjinfo = NULL;
+ reversed = false;
+ unique_ified = false;
+ is_valid_inner = true;
+
+ foreach(l, root->join_info_list)
+ {
+ SpecialJoinInfo *sjinfo = (SpecialJoinInfo *) lfirst(l);
+
+ /*
+ * This special join is not relevant unless its RHS overlaps the
+ * proposed join. (Check this first as a fast path for dismissing
+ * most irrelevant SJs quickly.)
+ */
+ if (!bms_overlap(sjinfo->min_righthand, joinrelids))
+ continue;
+
+ /*
+ * Also, not relevant if proposed join is fully contained within RHS
+ * (ie, we're still building up the RHS).
+ */
+ if (bms_is_subset(joinrelids, sjinfo->min_righthand))
+ continue;
+
+ /*
+ * Also, not relevant if SJ is already done within either input.
+ */
+ if (bms_is_subset(sjinfo->min_lefthand, rel1->relids) &&
+ bms_is_subset(sjinfo->min_righthand, rel1->relids))
+ continue;
+ if (bms_is_subset(sjinfo->min_lefthand, rel2->relids) &&
+ bms_is_subset(sjinfo->min_righthand, rel2->relids))
+ continue;
+
+ /*
+ * If it's a semijoin and we already joined the RHS to any other rels
+ * within either input, then we must have unique-ified the RHS at that
+ * point (see below). Therefore the semijoin is no longer relevant in
+ * this join path.
+ */
+ if (sjinfo->jointype == JOIN_SEMI)
+ {
+ if (bms_is_subset(sjinfo->syn_righthand, rel1->relids) &&
+ !bms_equal(sjinfo->syn_righthand, rel1->relids))
+ continue;
+ if (bms_is_subset(sjinfo->syn_righthand, rel2->relids) &&
+ !bms_equal(sjinfo->syn_righthand, rel2->relids))
+ continue;
+ }
+
+ /*
+ * If one input contains min_lefthand and the other contains
+ * min_righthand, then we can perform the SJ at this join.
+ *
+ * Barf if we get matches to more than one SJ (is that possible?)
+ */
+ if (bms_is_subset(sjinfo->min_lefthand, rel1->relids) &&
+ bms_is_subset(sjinfo->min_righthand, rel2->relids))
+ {
+ if (match_sjinfo)
+ return false; /* invalid join path */
+ match_sjinfo = sjinfo;
+ reversed = false;
+ }
+ else if (bms_is_subset(sjinfo->min_lefthand, rel2->relids) &&
+ bms_is_subset(sjinfo->min_righthand, rel1->relids))
+ {
+ if (match_sjinfo)
+ return false; /* invalid join path */
+ match_sjinfo = sjinfo;
+ reversed = true;
+ }
+ else if (sjinfo->jointype == JOIN_SEMI &&
+ bms_equal(sjinfo->syn_righthand, rel2->relids) &&
+ create_unique_path(root, rel2, rel2->cheapest_total_path,
+ sjinfo) != NULL)
+ {
+ /*----------
+ * For a semijoin, we can join the RHS to anything else by
+ * unique-ifying the RHS (if the RHS can be unique-ified).
+ * We will only get here if we have the full RHS but less
+ * than min_lefthand on the LHS.
+ *
+ * The reason to consider such a join path is exemplified by
+ * SELECT ... FROM a,b WHERE (a.x,b.y) IN (SELECT c1,c2 FROM c)
+ * If we insist on doing this as a semijoin we will first have
+ * to form the cartesian product of A*B. But if we unique-ify
+ * C then the semijoin becomes a plain innerjoin and we can join
+ * in any order, eg C to A and then to B. When C is much smaller
+ * than A and B this can be a huge win. So we allow C to be
+ * joined to just A or just B here, and then make_join_rel has
+ * to handle the case properly.
+ *
+ * Note that actually we'll allow unique-ified C to be joined to
+ * some other relation D here, too. That is legal, if usually not
+ * very sane, and this routine is only concerned with legality not
+ * with whether the join is good strategy.
+ *----------
+ */
+ if (match_sjinfo)
+ return false; /* invalid join path */
+ match_sjinfo = sjinfo;
+ reversed = false;
+ unique_ified = true;
+ }
+ else if (sjinfo->jointype == JOIN_SEMI &&
+ bms_equal(sjinfo->syn_righthand, rel1->relids) &&
+ create_unique_path(root, rel1, rel1->cheapest_total_path,
+ sjinfo) != NULL)
+ {
+ /* Reversed semijoin case */
+ if (match_sjinfo)
+ return false; /* invalid join path */
+ match_sjinfo = sjinfo;
+ reversed = true;
+ unique_ified = true;
+ }
+ else
+ {
+ /*----------
+ * Otherwise, the proposed join overlaps the RHS but isn't
+ * a valid implementation of this SJ. It might still be
+ * a legal join, however. If both inputs overlap the RHS,
+ * assume that it's OK. Since the inputs presumably got past
+ * this function's checks previously, they can't overlap the
+ * LHS and their violations of the RHS boundary must represent
+ * SJs that have been determined to commute with this one.
+ * We have to allow this to work correctly in cases like
+ * (a LEFT JOIN (b JOIN (c LEFT JOIN d)))
+ * when the c/d join has been determined to commute with the join
+ * to a, and hence d is not part of min_righthand for the upper
+ * join. It should be legal to join b to c/d but this will appear
+ * as a violation of the upper join's RHS.
+ * Furthermore, if one input overlaps the RHS and the other does
+ * not, we should still allow the join if it is a valid
+ * implementation of some other SJ. We have to allow this to
+ * support the associative identity
+ * (a LJ b on Pab) LJ c ON Pbc = a LJ (b LJ c ON Pbc) on Pab
+ * since joining B directly to C violates the lower SJ's RHS.
+ * We assume that make_outerjoininfo() set things up correctly
+ * so that we'll only match to some SJ if the join is valid.
+ * Set flag here to check at bottom of loop.
+ *----------
+ */
+ if (sjinfo->jointype != JOIN_SEMI &&
+ bms_overlap(rel1->relids, sjinfo->min_righthand) &&
+ bms_overlap(rel2->relids, sjinfo->min_righthand))
+ {
+ /* seems OK */
+ Assert(!bms_overlap(joinrelids, sjinfo->min_lefthand));
+ }
+ else
+ is_valid_inner = false;
+ }
+ }
+
+ /*
+ * Fail if violated some SJ's RHS and didn't match to another SJ. However,
+ * "matching" to a semijoin we are implementing by unique-ification
+ * doesn't count (think: it's really an inner join).
+ */
+ if (!is_valid_inner &&
+ (match_sjinfo == NULL || unique_ified))
+ return false; /* invalid join path */
+
+ /* Otherwise, it's a valid join */
+ *sjinfo_p = match_sjinfo;
+ *reversed_p = reversed;
+ return true;
+}
+
+/*
+ * has_join_restriction
+ * Detect whether the specified relation has join-order restrictions
+ * due to being inside an outer join or an IN (sub-SELECT).
+ *
+ * Essentially, this tests whether have_join_order_restriction() could
+ * succeed with this rel and some other one. It's OK if we sometimes
+ * say "true" incorrectly. (Therefore, we don't bother with the relatively
+ * expensive has_legal_joinclause test.)
+ */
+static bool
+has_join_restriction(PlannerInfo *root, RelOptInfo *rel)
+{
+ ListCell *l;
+
+ foreach(l, root->join_info_list)
+ {
+ SpecialJoinInfo *sjinfo = (SpecialJoinInfo *) lfirst(l);
+
+ /* ignore full joins --- other mechanisms preserve their ordering */
+ if (sjinfo->jointype == JOIN_FULL)
+ continue;
+
+ /* ignore if SJ is already contained in rel */
+ if (bms_is_subset(sjinfo->min_lefthand, rel->relids) &&
+ bms_is_subset(sjinfo->min_righthand, rel->relids))
+ continue;
+
+ /* restricted if it overlaps LHS or RHS, but doesn't contain SJ */
+ if (bms_overlap(sjinfo->min_lefthand, rel->relids) ||
+ bms_overlap(sjinfo->min_righthand, rel->relids))
+ return true;
+ }
+
+ return false;
+}
+
+/*
+ * is_dummy_rel --- has relation been proven empty?
+ *
+ * If so, it will have a single path that is dummy.
+ */
+static bool
+is_dummy_rel(RelOptInfo *rel)
+{
+ return (rel->cheapest_total_path != NULL &&
+ IS_DUMMY_PATH(rel->cheapest_total_path));
+}
+
+/*
+ * Mark a relation as proven empty.
+ *
+ * During GEQO planning, this can get invoked more than once on the same
+ * baserel struct, so it's worth checking to see if the rel is already marked
+ * dummy.
+ *
+ * Also, when called during GEQO join planning, we are in a short-lived
+ * memory context. We must make sure that the dummy path attached to a
+ * baserel survives the GEQO cycle, else the baserel is trashed for future
+ * GEQO cycles. On the other hand, when we are marking a joinrel during GEQO,
+ * we don't want the dummy path to clutter the main planning context. Upshot
+ * is that the best solution is to explicitly make the dummy path in the same
+ * context the given RelOptInfo is in.
+ */
+static void
+mark_dummy_rel(RelOptInfo *rel)
+{
+ MemoryContext oldcontext;
+
+ /* Already marked? */
+ if (is_dummy_rel(rel))
+ return;
+
+ /* No, so choose correct context to make the dummy path in */
+ oldcontext = MemoryContextSwitchTo(GetMemoryChunkContext(rel));
+
+ /* Set dummy size estimate */
+ rel->rows = 0;
+
+ /* Evict any previously chosen paths */
+ rel->pathlist = NIL;
+
+ /* Set up the dummy path */
+ add_path(rel, (Path *) create_append_path(rel, NIL));
+
+ /* Set or update cheapest_total_path */
+ set_cheapest(rel);
+
+ MemoryContextSwitchTo(oldcontext);
+}
+
+/*
+ * restriction_is_constant_false --- is a restrictlist just FALSE?
+ *
+ * In cases where a qual is provably constant FALSE, eval_const_expressions
+ * will generally have thrown away anything that's ANDed with it. In outer
+ * join situations this will leave us computing cartesian products only to
+ * decide there's no match for an outer row, which is pretty stupid. So,
+ * we need to detect the case.
+ *
+ * If only_pushed_down is TRUE, then consider only pushed-down quals.
+ */
+static bool
+restriction_is_constant_false(List *restrictlist, bool only_pushed_down)
+{
+ ListCell *lc;
+
+ /*
+ * Despite the above comment, the restriction list we see here might
+ * possibly have other members besides the FALSE constant, since other
+ * quals could get "pushed down" to the outer join level. So we check
+ * each member of the list.
+ */
+ foreach(lc, restrictlist)
+ {
+ RestrictInfo *rinfo = (RestrictInfo *) lfirst(lc);
+
+ Assert(IsA(rinfo, RestrictInfo));
+ if (only_pushed_down && !rinfo->is_pushed_down)
+ continue;
+
+ if (rinfo->clause && IsA(rinfo->clause, Const))
+ {
+ Const *con = (Const *) rinfo->clause;
+
+ /* constant NULL is as good as constant FALSE for our purposes */
+ if (con->constisnull)
+ return true;
+ if (!DatumGetBool(con->constvalue))
+ return true;
+ }
+ }
+ return false;
+}
--- /dev/null
+/*-------------------------------------------------------------------------
+ *
+ * core.c
+ * Routines copied from PostgreSQL core distribution.
+ *
+ * src/backend/optimizer/path/allpaths.c
+ * set_append_rel_pathlist()
+ * generate_mergeappend_paths()
+ * accumulate_append_subpath()
+ * standard_join_search()
+ *
+ * src/backend/optimizer/path/joinrels.c
+ * join_search_one_level()
+ * make_rels_by_clause_joins()
+ * make_rels_by_clauseless_joins()
+ * join_is_legal()
+ * has_join_restriction()
+ * is_dummy_rel()
+ * mark_dummy_rel()
+ * restriction_is_constant_false()
+ *
+ * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ *-------------------------------------------------------------------------
+ */
+
+/*
+ * set_append_rel_pathlist
+ * Build access paths for an "append relation"
+ */
+static void
+set_append_rel_pathlist(PlannerInfo *root, RelOptInfo *rel,
+ Index rti, RangeTblEntry *rte)
+{
+ int parentRTindex = rti;
+ List *live_childrels = NIL;
+ List *subpaths = NIL;
+ List *all_child_pathkeys = NIL;
+ List *all_child_outers = NIL;
+ ListCell *l;
+
+ /*
+ * Generate access paths for each member relation, and remember the
+ * cheapest path for each one. Also, identify all pathkeys (orderings)
+ * and parameterizations (required_outer sets) available for the member
+ * relations.
+ */
+ foreach(l, root->append_rel_list)
+ {
+ AppendRelInfo *appinfo = (AppendRelInfo *) lfirst(l);
+ int childRTindex;
+ RangeTblEntry *childRTE;
+ RelOptInfo *childrel;
+ ListCell *lcp;
+
+ /* append_rel_list contains all append rels; ignore others */
+ if (appinfo->parent_relid != parentRTindex)
+ continue;
+
+ /* Re-locate the child RTE and RelOptInfo */
+ childRTindex = appinfo->child_relid;
+ childRTE = root->simple_rte_array[childRTindex];
+ childrel = root->simple_rel_array[childRTindex];
+
+ /*
+ * Compute the child's access paths.
+ */
+ set_rel_pathlist(root, childrel, childRTindex, childRTE);
+
+ /*
+ * If child is dummy, ignore it.
+ */
+ if (IS_DUMMY_REL(childrel))
+ continue;
+
+ /*
+ * Child is live, so add its cheapest access path to the Append path
+ * we are constructing for the parent.
+ */
+ subpaths = accumulate_append_subpath(subpaths,
+ childrel->cheapest_total_path);
+
+ /* Remember which childrels are live, for logic below */
+ live_childrels = lappend(live_childrels, childrel);
+
+ /*
+ * Collect lists of all the available path orderings and
+ * parameterizations for all the children. We use these as a
+ * heuristic to indicate which sort orderings and parameterizations we
+ * should build Append and MergeAppend paths for.
+ */
+ foreach(lcp, childrel->pathlist)
+ {
+ Path *childpath = (Path *) lfirst(lcp);
+ List *childkeys = childpath->pathkeys;
+ Relids childouter = PATH_REQ_OUTER(childpath);
+
+ /* Unsorted paths don't contribute to pathkey list */
+ if (childkeys != NIL)
+ {
+ ListCell *lpk;
+ bool found = false;
+
+ /* Have we already seen this ordering? */
+ foreach(lpk, all_child_pathkeys)
+ {
+ List *existing_pathkeys = (List *) lfirst(lpk);
+
+ if (compare_pathkeys(existing_pathkeys,
+ childkeys) == PATHKEYS_EQUAL)
+ {
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ {
+ /* No, so add it to all_child_pathkeys */
+ all_child_pathkeys = lappend(all_child_pathkeys,
+ childkeys);
+ }
+ }
+
+ /* Unparameterized paths don't contribute to param-set list */
+ if (childouter)
+ {
+ ListCell *lco;
+ bool found = false;
+
+ /* Have we already seen this param set? */
+ foreach(lco, all_child_outers)
+ {
+ Relids existing_outers = (Relids) lfirst(lco);
+
+ if (bms_equal(existing_outers, childouter))
+ {
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ {
+ /* No, so add it to all_child_outers */
+ all_child_outers = lappend(all_child_outers,
+ childouter);
+ }
+ }
+ }
+ }
+
+ /*
+ * Next, build an unordered, unparameterized Append path for the rel.
+ * (Note: this is correct even if we have zero or one live subpath due to
+ * constraint exclusion.)
+ */
+ add_path(rel, (Path *) create_append_path(rel, subpaths, NULL));
+
+ /*
+ * Build unparameterized MergeAppend paths based on the collected list of
+ * child pathkeys.
+ */
+ generate_mergeappend_paths(root, rel, live_childrels, all_child_pathkeys);
+
+ /*
+ * Build Append paths for each parameterization seen among the child rels.
+ * (This may look pretty expensive, but in most cases of practical
+ * interest, the child rels will expose mostly the same parameterizations,
+ * so that not that many cases actually get considered here.)
+ *
+ * The Append node itself cannot enforce quals, so all qual checking must
+ * be done in the child paths. This means that to have a parameterized
+ * Append path, we must have the exact same parameterization for each
+ * child path; otherwise some children might be failing to check the
+ * moved-down quals. To make them match up, we can try to increase the
+ * parameterization of lesser-parameterized paths.
+ */
+ foreach(l, all_child_outers)
+ {
+ Relids required_outer = (Relids) lfirst(l);
+ bool ok = true;
+ ListCell *lcr;
+
+ /* Select the child paths for an Append with this parameterization */
+ subpaths = NIL;
+ foreach(lcr, live_childrels)
+ {
+ RelOptInfo *childrel = (RelOptInfo *) lfirst(lcr);
+ Path *cheapest_total;
+
+ cheapest_total =
+ get_cheapest_path_for_pathkeys(childrel->pathlist,
+ NIL,
+ required_outer,
+ TOTAL_COST);
+ Assert(cheapest_total != NULL);
+
+ /* Children must have exactly the desired parameterization */
+ if (!bms_equal(PATH_REQ_OUTER(cheapest_total), required_outer))
+ {
+ cheapest_total = reparameterize_path(root, cheapest_total,
+ required_outer, 1.0);
+ if (cheapest_total == NULL)
+ {
+ ok = false;
+ break;
+ }
+ }
+
+ subpaths = accumulate_append_subpath(subpaths, cheapest_total);
+ }
+
+ if (ok)
+ add_path(rel, (Path *)
+ create_append_path(rel, subpaths, required_outer));
+ }
+
+ /* Select cheapest paths */
+ set_cheapest(rel);
+}
+
+/*
+ * generate_mergeappend_paths
+ * Generate MergeAppend paths for an append relation
+ *
+ * Generate a path for each ordering (pathkey list) appearing in
+ * all_child_pathkeys.
+ *
+ * We consider both cheapest-startup and cheapest-total cases, ie, for each
+ * interesting ordering, collect all the cheapest startup subpaths and all the
+ * cheapest total paths, and build a MergeAppend path for each case.
+ *
+ * We don't currently generate any parameterized MergeAppend paths. While
+ * it would not take much more code here to do so, it's very unclear that it
+ * is worth the planning cycles to investigate such paths: there's little
+ * use for an ordered path on the inside of a nestloop. In fact, it's likely
+ * that the current coding of add_path would reject such paths out of hand,
+ * because add_path gives no credit for sort ordering of parameterized paths,
+ * and a parameterized MergeAppend is going to be more expensive than the
+ * corresponding parameterized Append path. If we ever try harder to support
+ * parameterized mergejoin plans, it might be worth adding support for
+ * parameterized MergeAppends to feed such joins. (See notes in
+ * optimizer/README for why that might not ever happen, though.)
+ */
+static void
+generate_mergeappend_paths(PlannerInfo *root, RelOptInfo *rel,
+ List *live_childrels,
+ List *all_child_pathkeys)
+{
+ ListCell *lcp;
+
+ foreach(lcp, all_child_pathkeys)
+ {
+ List *pathkeys = (List *) lfirst(lcp);
+ List *startup_subpaths = NIL;
+ List *total_subpaths = NIL;
+ bool startup_neq_total = false;
+ ListCell *lcr;
+
+ /* Select the child paths for this ordering... */
+ foreach(lcr, live_childrels)
+ {
+ RelOptInfo *childrel = (RelOptInfo *) lfirst(lcr);
+ Path *cheapest_startup,
+ *cheapest_total;
+
+ /* Locate the right paths, if they are available. */
+ cheapest_startup =
+ get_cheapest_path_for_pathkeys(childrel->pathlist,
+ pathkeys,
+ NULL,
+ STARTUP_COST);
+ cheapest_total =
+ get_cheapest_path_for_pathkeys(childrel->pathlist,
+ pathkeys,
+ NULL,
+ TOTAL_COST);
+
+ /*
+ * If we can't find any paths with the right order just use the
+ * cheapest-total path; we'll have to sort it later.
+ */
+ if (cheapest_startup == NULL || cheapest_total == NULL)
+ {
+ cheapest_startup = cheapest_total =
+ childrel->cheapest_total_path;
+ Assert(cheapest_total != NULL);
+ }
+
+ /*
+ * Notice whether we actually have different paths for the
+ * "cheapest" and "total" cases; frequently there will be no point
+ * in two create_merge_append_path() calls.
+ */
+ if (cheapest_startup != cheapest_total)
+ startup_neq_total = true;
+
+ startup_subpaths =
+ accumulate_append_subpath(startup_subpaths, cheapest_startup);
+ total_subpaths =
+ accumulate_append_subpath(total_subpaths, cheapest_total);
+ }
+
+ /* ... and build the MergeAppend paths */
+ add_path(rel, (Path *) create_merge_append_path(root,
+ rel,
+ startup_subpaths,
+ pathkeys,
+ NULL));
+ if (startup_neq_total)
+ add_path(rel, (Path *) create_merge_append_path(root,
+ rel,
+ total_subpaths,
+ pathkeys,
+ NULL));
+ }
+}
+
+/*
+ * accumulate_append_subpath
+ * Add a subpath to the list being built for an Append or MergeAppend
+ *
+ * It's possible that the child is itself an Append path, in which case
+ * we can "cut out the middleman" and just add its child paths to our
+ * own list. (We don't try to do this earlier because we need to
+ * apply both levels of transformation to the quals.)
+ */
+static List *
+accumulate_append_subpath(List *subpaths, Path *path)
+{
+ if (IsA(path, AppendPath))
+ {
+ AppendPath *apath = (AppendPath *) path;
+
+ /* list_copy is important here to avoid sharing list substructure */
+ return list_concat(subpaths, list_copy(apath->subpaths));
+ }
+ else
+ return lappend(subpaths, path);
+}
+
+/*
+ * standard_join_search
+ * Find possible joinpaths for a query by successively finding ways
+ * to join component relations into join relations.
+ *
+ * 'levels_needed' is the number of iterations needed, ie, the number of
+ * independent jointree items in the query. This is > 1.
+ *
+ * 'initial_rels' is a list of RelOptInfo nodes for each independent
+ * jointree item. These are the components to be joined together.
+ * Note that levels_needed == list_length(initial_rels).
+ *
+ * Returns the final level of join relations, i.e., the relation that is
+ * the result of joining all the original relations together.
+ * At least one implementation path must be provided for this relation and
+ * all required sub-relations.
+ *
+ * To support loadable plugins that modify planner behavior by changing the
+ * join searching algorithm, we provide a hook variable that lets a plugin
+ * replace or supplement this function. Any such hook must return the same
+ * final join relation as the standard code would, but it might have a
+ * different set of implementation paths attached, and only the sub-joinrels
+ * needed for these paths need have been instantiated.
+ *
+ * Note to plugin authors: the functions invoked during standard_join_search()
+ * modify root->join_rel_list and root->join_rel_hash. If you want to do more
+ * than one join-order search, you'll probably need to save and restore the
+ * original states of those data structures. See geqo_eval() for an example.
+ */
+RelOptInfo *
+standard_join_search(PlannerInfo *root, int levels_needed, List *initial_rels)
+{
+ int lev;
+ RelOptInfo *rel;
+
+ /*
+ * This function cannot be invoked recursively within any one planning
+ * problem, so join_rel_level[] can't be in use already.
+ */
+ Assert(root->join_rel_level == NULL);
+
+ /*
+ * We employ a simple "dynamic programming" algorithm: we first find all
+ * ways to build joins of two jointree items, then all ways to build joins
+ * of three items (from two-item joins and single items), then four-item
+ * joins, and so on until we have considered all ways to join all the
+ * items into one rel.
+ *
+ * root->join_rel_level[j] is a list of all the j-item rels. Initially we
+ * set root->join_rel_level[1] to represent all the single-jointree-item
+ * relations.
+ */
+ root->join_rel_level = (List **) palloc0((levels_needed + 1) * sizeof(List *));
+
+ root->join_rel_level[1] = initial_rels;
+
+ for (lev = 2; lev <= levels_needed; lev++)
+ {
+ ListCell *lc;
+
+ /*
+ * Determine all possible pairs of relations to be joined at this
+ * level, and build paths for making each one from every available
+ * pair of lower-level relations.
+ */
+ join_search_one_level(root, lev);
+
+ /*
+ * Do cleanup work on each just-processed rel.
+ */
+ foreach(lc, root->join_rel_level[lev])
+ {
+ rel = (RelOptInfo *) lfirst(lc);
+
+ /* Find and save the cheapest paths for this rel */
+ set_cheapest(rel);
+
+#ifdef OPTIMIZER_DEBUG
+ debug_print_rel(root, rel);
+#endif
+ }
+ }
+
+ /*
+ * We should have a single rel at the final level.
+ */
+ if (root->join_rel_level[levels_needed] == NIL)
+ elog(ERROR, "failed to build any %d-way joins", levels_needed);
+ Assert(list_length(root->join_rel_level[levels_needed]) == 1);
+
+ rel = (RelOptInfo *) linitial(root->join_rel_level[levels_needed]);
+
+ root->join_rel_level = NULL;
+
+ return rel;
+}
+
+/*
+ * join_search_one_level
+ * Consider ways to produce join relations containing exactly 'level'
+ * jointree items. (This is one step of the dynamic-programming method
+ * embodied in standard_join_search.) Join rel nodes for each feasible
+ * combination of lower-level rels are created and returned in a list.
+ * Implementation paths are created for each such joinrel, too.
+ *
+ * level: level of rels we want to make this time
+ * root->join_rel_level[j], 1 <= j < level, is a list of rels containing j items
+ *
+ * The result is returned in root->join_rel_level[level].
+ */
+void
+join_search_one_level(PlannerInfo *root, int level)
+{
+ List **joinrels = root->join_rel_level;
+ ListCell *r;
+ int k;
+
+ Assert(joinrels[level] == NIL);
+
+ /* Set join_cur_level so that new joinrels are added to proper list */
+ root->join_cur_level = level;
+
+ /*
+ * First, consider left-sided and right-sided plans, in which rels of
+ * exactly level-1 member relations are joined against initial relations.
+ * We prefer to join using join clauses, but if we find a rel of level-1
+ * members that has no join clauses, we will generate Cartesian-product
+ * joins against all initial rels not already contained in it.
+ */
+ foreach(r, joinrels[level - 1])
+ {
+ RelOptInfo *old_rel = (RelOptInfo *) lfirst(r);
+
+ if (old_rel->joininfo != NIL || old_rel->has_eclass_joins ||
+ has_join_restriction(root, old_rel))
+ {
+ /*
+ * There are join clauses or join order restrictions relevant to
+ * this rel, so consider joins between this rel and (only) those
+ * initial rels it is linked to by a clause or restriction.
+ *
+ * At level 2 this condition is symmetric, so there is no need to
+ * look at initial rels before this one in the list; we already
+ * considered such joins when we were at the earlier rel. (The
+ * mirror-image joins are handled automatically by make_join_rel.)
+ * In later passes (level > 2), we join rels of the previous level
+ * to each initial rel they don't already include but have a join
+ * clause or restriction with.
+ */
+ ListCell *other_rels;
+
+ if (level == 2) /* consider remaining initial rels */
+ other_rels = lnext(r);
+ else /* consider all initial rels */
+ other_rels = list_head(joinrels[1]);
+
+ make_rels_by_clause_joins(root,
+ old_rel,
+ other_rels);
+ }
+ else
+ {
+ /*
+ * Oops, we have a relation that is not joined to any other
+ * relation, either directly or by join-order restrictions.
+ * Cartesian product time.
+ *
+ * We consider a cartesian product with each not-already-included
+ * initial rel, whether it has other join clauses or not. At
+ * level 2, if there are two or more clauseless initial rels, we
+ * will redundantly consider joining them in both directions; but
+ * such cases aren't common enough to justify adding complexity to
+ * avoid the duplicated effort.
+ */
+ make_rels_by_clauseless_joins(root,
+ old_rel,
+ list_head(joinrels[1]));
+ }
+ }
+
+ /*
+ * Now, consider "bushy plans" in which relations of k initial rels are
+ * joined to relations of level-k initial rels, for 2 <= k <= level-2.
+ *
+ * We only consider bushy-plan joins for pairs of rels where there is a
+ * suitable join clause (or join order restriction), in order to avoid
+ * unreasonable growth of planning time.
+ */
+ for (k = 2;; k++)
+ {
+ int other_level = level - k;
+
+ /*
+ * Since make_join_rel(x, y) handles both x,y and y,x cases, we only
+ * need to go as far as the halfway point.
+ */
+ if (k > other_level)
+ break;
+
+ foreach(r, joinrels[k])
+ {
+ RelOptInfo *old_rel = (RelOptInfo *) lfirst(r);
+ ListCell *other_rels;
+ ListCell *r2;
+
+ /*
+ * We can ignore relations without join clauses here, unless they
+ * participate in join-order restrictions --- then we might have
+ * to force a bushy join plan.
+ */
+ if (old_rel->joininfo == NIL && !old_rel->has_eclass_joins &&
+ !has_join_restriction(root, old_rel))
+ continue;
+
+ if (k == other_level)
+ other_rels = lnext(r); /* only consider remaining rels */
+ else
+ other_rels = list_head(joinrels[other_level]);
+
+ for_each_cell(r2, other_rels)
+ {
+ RelOptInfo *new_rel = (RelOptInfo *) lfirst(r2);
+
+ if (!bms_overlap(old_rel->relids, new_rel->relids))
+ {
+ /*
+ * OK, we can build a rel of the right level from this
+ * pair of rels. Do so if there is at least one relevant
+ * join clause or join order restriction.
+ */
+ if (have_relevant_joinclause(root, old_rel, new_rel) ||
+ have_join_order_restriction(root, old_rel, new_rel))
+ {
+ (void) make_join_rel(root, old_rel, new_rel);
+ }
+ }
+ }
+ }
+ }
+
+ /*----------
+ * Last-ditch effort: if we failed to find any usable joins so far, force
+ * a set of cartesian-product joins to be generated. This handles the
+ * special case where all the available rels have join clauses but we
+ * cannot use any of those clauses yet. This can only happen when we are
+ * considering a join sub-problem (a sub-joinlist) and all the rels in the
+ * sub-problem have only join clauses with rels outside the sub-problem.
+ * An example is
+ *
+ * SELECT ... FROM a INNER JOIN b ON TRUE, c, d, ...
+ * WHERE a.w = c.x and b.y = d.z;
+ *
+ * If the "a INNER JOIN b" sub-problem does not get flattened into the
+ * upper level, we must be willing to make a cartesian join of a and b;
+ * but the code above will not have done so, because it thought that both
+ * a and b have joinclauses. We consider only left-sided and right-sided
+ * cartesian joins in this case (no bushy).
+ *----------
+ */
+ if (joinrels[level] == NIL)
+ {
+ /*
+ * This loop is just like the first one, except we always call
+ * make_rels_by_clauseless_joins().
+ */
+ foreach(r, joinrels[level - 1])
+ {
+ RelOptInfo *old_rel = (RelOptInfo *) lfirst(r);
+
+ make_rels_by_clauseless_joins(root,
+ old_rel,
+ list_head(joinrels[1]));
+ }
+
+ /*----------
+ * When special joins are involved, there may be no legal way
+ * to make an N-way join for some values of N. For example consider
+ *
+ * SELECT ... FROM t1 WHERE
+ * x IN (SELECT ... FROM t2,t3 WHERE ...) AND
+ * y IN (SELECT ... FROM t4,t5 WHERE ...)
+ *
+ * We will flatten this query to a 5-way join problem, but there are
+ * no 4-way joins that join_is_legal() will consider legal. We have
+ * to accept failure at level 4 and go on to discover a workable
+ * bushy plan at level 5.
+ *
+ * However, if there are no special joins then join_is_legal() should
+ * never fail, and so the following sanity check is useful.
+ *----------
+ */
+ if (joinrels[level] == NIL && root->join_info_list == NIL)
+ elog(ERROR, "failed to build any %d-way joins", level);
+ }
+}
+
+/*
+ * make_rels_by_clause_joins
+ * Build joins between the given relation 'old_rel' and other relations
+ * that participate in join clauses that 'old_rel' also participates in
+ * (or participate in join-order restrictions with it).
+ * The join rels are returned in root->join_rel_level[join_cur_level].
+ *
+ * Note: at levels above 2 we will generate the same joined relation in
+ * multiple ways --- for example (a join b) join c is the same RelOptInfo as
+ * (b join c) join a, though the second case will add a different set of Paths
+ * to it. This is the reason for using the join_rel_level mechanism, which
+ * automatically ensures that each new joinrel is only added to the list once.
+ *
+ * 'old_rel' is the relation entry for the relation to be joined
+ * 'other_rels': the first cell in a linked list containing the other
+ * rels to be considered for joining
+ *
+ * Currently, this is only used with initial rels in other_rels, but it
+ * will work for joining to joinrels too.
+ */
+static void
+make_rels_by_clause_joins(PlannerInfo *root,
+ RelOptInfo *old_rel,
+ ListCell *other_rels)
+{
+ ListCell *l;
+
+ for_each_cell(l, other_rels)
+ {
+ RelOptInfo *other_rel = (RelOptInfo *) lfirst(l);
+
+ if (!bms_overlap(old_rel->relids, other_rel->relids) &&
+ (have_relevant_joinclause(root, old_rel, other_rel) ||
+ have_join_order_restriction(root, old_rel, other_rel)))
+ {
+ (void) make_join_rel(root, old_rel, other_rel);
+ }
+ }
+}
+
+/*
+ * make_rels_by_clauseless_joins
+ * Given a relation 'old_rel' and a list of other relations
+ * 'other_rels', create a join relation between 'old_rel' and each
+ * member of 'other_rels' that isn't already included in 'old_rel'.
+ * The join rels are returned in root->join_rel_level[join_cur_level].
+ *
+ * 'old_rel' is the relation entry for the relation to be joined
+ * 'other_rels': the first cell of a linked list containing the
+ * other rels to be considered for joining
+ *
+ * Currently, this is only used with initial rels in other_rels, but it would
+ * work for joining to joinrels too.
+ */
+static void
+make_rels_by_clauseless_joins(PlannerInfo *root,
+ RelOptInfo *old_rel,
+ ListCell *other_rels)
+{
+ ListCell *l;
+
+ for_each_cell(l, other_rels)
+ {
+ RelOptInfo *other_rel = (RelOptInfo *) lfirst(l);
+
+ if (!bms_overlap(other_rel->relids, old_rel->relids))
+ {
+ (void) make_join_rel(root, old_rel, other_rel);
+ }
+ }
+}
+
+/*
+ * join_is_legal
+ * Determine whether a proposed join is legal given the query's
+ * join order constraints; and if it is, determine the join type.
+ *
+ * Caller must supply not only the two rels, but the union of their relids.
+ * (We could simplify the API by computing joinrelids locally, but this
+ * would be redundant work in the normal path through make_join_rel.)
+ *
+ * On success, *sjinfo_p is set to NULL if this is to be a plain inner join,
+ * else it's set to point to the associated SpecialJoinInfo node. Also,
+ * *reversed_p is set TRUE if the given relations need to be swapped to
+ * match the SpecialJoinInfo node.
+ */
+static bool
+join_is_legal(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2,
+ Relids joinrelids,
+ SpecialJoinInfo **sjinfo_p, bool *reversed_p)
+{
+ SpecialJoinInfo *match_sjinfo;
+ bool reversed;
+ bool unique_ified;
+ bool is_valid_inner;
+ ListCell *l;
+
+ /*
+ * Ensure output params are set on failure return. This is just to
+ * suppress uninitialized-variable warnings from overly anal compilers.
+ */
+ *sjinfo_p = NULL;
+ *reversed_p = false;
+
+ /*
+ * If we have any special joins, the proposed join might be illegal; and
+ * in any case we have to determine its join type. Scan the join info
+ * list for conflicts.
+ */
+ match_sjinfo = NULL;
+ reversed = false;
+ unique_ified = false;
+ is_valid_inner = true;
+
+ foreach(l, root->join_info_list)
+ {
+ SpecialJoinInfo *sjinfo = (SpecialJoinInfo *) lfirst(l);
+
+ /*
+ * This special join is not relevant unless its RHS overlaps the
+ * proposed join. (Check this first as a fast path for dismissing
+ * most irrelevant SJs quickly.)
+ */
+ if (!bms_overlap(sjinfo->min_righthand, joinrelids))
+ continue;
+
+ /*
+ * Also, not relevant if proposed join is fully contained within RHS
+ * (ie, we're still building up the RHS).
+ */
+ if (bms_is_subset(joinrelids, sjinfo->min_righthand))
+ continue;
+
+ /*
+ * Also, not relevant if SJ is already done within either input.
+ */
+ if (bms_is_subset(sjinfo->min_lefthand, rel1->relids) &&
+ bms_is_subset(sjinfo->min_righthand, rel1->relids))
+ continue;
+ if (bms_is_subset(sjinfo->min_lefthand, rel2->relids) &&
+ bms_is_subset(sjinfo->min_righthand, rel2->relids))
+ continue;
+
+ /*
+ * If it's a semijoin and we already joined the RHS to any other rels
+ * within either input, then we must have unique-ified the RHS at that
+ * point (see below). Therefore the semijoin is no longer relevant in
+ * this join path.
+ */
+ if (sjinfo->jointype == JOIN_SEMI)
+ {
+ if (bms_is_subset(sjinfo->syn_righthand, rel1->relids) &&
+ !bms_equal(sjinfo->syn_righthand, rel1->relids))
+ continue;
+ if (bms_is_subset(sjinfo->syn_righthand, rel2->relids) &&
+ !bms_equal(sjinfo->syn_righthand, rel2->relids))
+ continue;
+ }
+
+ /*
+ * If one input contains min_lefthand and the other contains
+ * min_righthand, then we can perform the SJ at this join.
+ *
+ * Barf if we get matches to more than one SJ (is that possible?)
+ */
+ if (bms_is_subset(sjinfo->min_lefthand, rel1->relids) &&
+ bms_is_subset(sjinfo->min_righthand, rel2->relids))
+ {
+ if (match_sjinfo)
+ return false; /* invalid join path */
+ match_sjinfo = sjinfo;
+ reversed = false;
+ }
+ else if (bms_is_subset(sjinfo->min_lefthand, rel2->relids) &&
+ bms_is_subset(sjinfo->min_righthand, rel1->relids))
+ {
+ if (match_sjinfo)
+ return false; /* invalid join path */
+ match_sjinfo = sjinfo;
+ reversed = true;
+ }
+ else if (sjinfo->jointype == JOIN_SEMI &&
+ bms_equal(sjinfo->syn_righthand, rel2->relids) &&
+ create_unique_path(root, rel2, rel2->cheapest_total_path,
+ sjinfo) != NULL)
+ {
+ /*----------
+ * For a semijoin, we can join the RHS to anything else by
+ * unique-ifying the RHS (if the RHS can be unique-ified).
+ * We will only get here if we have the full RHS but less
+ * than min_lefthand on the LHS.
+ *
+ * The reason to consider such a join path is exemplified by
+ * SELECT ... FROM a,b WHERE (a.x,b.y) IN (SELECT c1,c2 FROM c)
+ * If we insist on doing this as a semijoin we will first have
+ * to form the cartesian product of A*B. But if we unique-ify
+ * C then the semijoin becomes a plain innerjoin and we can join
+ * in any order, eg C to A and then to B. When C is much smaller
+ * than A and B this can be a huge win. So we allow C to be
+ * joined to just A or just B here, and then make_join_rel has
+ * to handle the case properly.
+ *
+ * Note that actually we'll allow unique-ified C to be joined to
+ * some other relation D here, too. That is legal, if usually not
+ * very sane, and this routine is only concerned with legality not
+ * with whether the join is good strategy.
+ *----------
+ */
+ if (match_sjinfo)
+ return false; /* invalid join path */
+ match_sjinfo = sjinfo;
+ reversed = false;
+ unique_ified = true;
+ }
+ else if (sjinfo->jointype == JOIN_SEMI &&
+ bms_equal(sjinfo->syn_righthand, rel1->relids) &&
+ create_unique_path(root, rel1, rel1->cheapest_total_path,
+ sjinfo) != NULL)
+ {
+ /* Reversed semijoin case */
+ if (match_sjinfo)
+ return false; /* invalid join path */
+ match_sjinfo = sjinfo;
+ reversed = true;
+ unique_ified = true;
+ }
+ else
+ {
+ /*----------
+ * Otherwise, the proposed join overlaps the RHS but isn't
+ * a valid implementation of this SJ. It might still be
+ * a legal join, however. If both inputs overlap the RHS,
+ * assume that it's OK. Since the inputs presumably got past
+ * this function's checks previously, they can't overlap the
+ * LHS and their violations of the RHS boundary must represent
+ * SJs that have been determined to commute with this one.
+ * We have to allow this to work correctly in cases like
+ * (a LEFT JOIN (b JOIN (c LEFT JOIN d)))
+ * when the c/d join has been determined to commute with the join
+ * to a, and hence d is not part of min_righthand for the upper
+ * join. It should be legal to join b to c/d but this will appear
+ * as a violation of the upper join's RHS.
+ * Furthermore, if one input overlaps the RHS and the other does
+ * not, we should still allow the join if it is a valid
+ * implementation of some other SJ. We have to allow this to
+ * support the associative identity
+ * (a LJ b on Pab) LJ c ON Pbc = a LJ (b LJ c ON Pbc) on Pab
+ * since joining B directly to C violates the lower SJ's RHS.
+ * We assume that make_outerjoininfo() set things up correctly
+ * so that we'll only match to some SJ if the join is valid.
+ * Set flag here to check at bottom of loop.
+ *----------
+ */
+ if (sjinfo->jointype != JOIN_SEMI &&
+ bms_overlap(rel1->relids, sjinfo->min_righthand) &&
+ bms_overlap(rel2->relids, sjinfo->min_righthand))
+ {
+ /* seems OK */
+ Assert(!bms_overlap(joinrelids, sjinfo->min_lefthand));
+ }
+ else
+ is_valid_inner = false;
+ }
+ }
+
+ /*
+ * Fail if violated some SJ's RHS and didn't match to another SJ. However,
+ * "matching" to a semijoin we are implementing by unique-ification
+ * doesn't count (think: it's really an inner join).
+ */
+ if (!is_valid_inner &&
+ (match_sjinfo == NULL || unique_ified))
+ return false; /* invalid join path */
+
+ /* Otherwise, it's a valid join */
+ *sjinfo_p = match_sjinfo;
+ *reversed_p = reversed;
+ return true;
+}
+
+/*
+ * has_join_restriction
+ * Detect whether the specified relation has join-order restrictions
+ * due to being inside an outer join or an IN (sub-SELECT).
+ *
+ * Essentially, this tests whether have_join_order_restriction() could
+ * succeed with this rel and some other one. It's OK if we sometimes
+ * say "true" incorrectly. (Therefore, we don't bother with the relatively
+ * expensive has_legal_joinclause test.)
+ */
+static bool
+has_join_restriction(PlannerInfo *root, RelOptInfo *rel)
+{
+ ListCell *l;
+
+ foreach(l, root->join_info_list)
+ {
+ SpecialJoinInfo *sjinfo = (SpecialJoinInfo *) lfirst(l);
+
+ /* ignore full joins --- other mechanisms preserve their ordering */
+ if (sjinfo->jointype == JOIN_FULL)
+ continue;
+
+ /* ignore if SJ is already contained in rel */
+ if (bms_is_subset(sjinfo->min_lefthand, rel->relids) &&
+ bms_is_subset(sjinfo->min_righthand, rel->relids))
+ continue;
+
+ /* restricted if it overlaps LHS or RHS, but doesn't contain SJ */
+ if (bms_overlap(sjinfo->min_lefthand, rel->relids) ||
+ bms_overlap(sjinfo->min_righthand, rel->relids))
+ return true;
+ }
+
+ return false;
+}
+
+/*
+ * is_dummy_rel --- has relation been proven empty?
+ */
+static bool
+is_dummy_rel(RelOptInfo *rel)
+{
+ return IS_DUMMY_REL(rel);
+}
+
+/*
+ * Mark a relation as proven empty.
+ *
+ * During GEQO planning, this can get invoked more than once on the same
+ * baserel struct, so it's worth checking to see if the rel is already marked
+ * dummy.
+ *
+ * Also, when called during GEQO join planning, we are in a short-lived
+ * memory context. We must make sure that the dummy path attached to a
+ * baserel survives the GEQO cycle, else the baserel is trashed for future
+ * GEQO cycles. On the other hand, when we are marking a joinrel during GEQO,
+ * we don't want the dummy path to clutter the main planning context. Upshot
+ * is that the best solution is to explicitly make the dummy path in the same
+ * context the given RelOptInfo is in.
+ */
+static void
+mark_dummy_rel(RelOptInfo *rel)
+{
+ MemoryContext oldcontext;
+
+ /* Already marked? */
+ if (is_dummy_rel(rel))
+ return;
+
+ /* No, so choose correct context to make the dummy path in */
+ oldcontext = MemoryContextSwitchTo(GetMemoryChunkContext(rel));
+
+ /* Set dummy size estimate */
+ rel->rows = 0;
+
+ /* Evict any previously chosen paths */
+ rel->pathlist = NIL;
+
+ /* Set up the dummy path */
+ add_path(rel, (Path *) create_append_path(rel, NIL, NULL));
+
+ /* Set or update cheapest_total_path and related fields */
+ set_cheapest(rel);
+
+ MemoryContextSwitchTo(oldcontext);
+}
+
+/*
+ * restriction_is_constant_false --- is a restrictlist just FALSE?
+ *
+ * In cases where a qual is provably constant FALSE, eval_const_expressions
+ * will generally have thrown away anything that's ANDed with it. In outer
+ * join situations this will leave us computing cartesian products only to
+ * decide there's no match for an outer row, which is pretty stupid. So,
+ * we need to detect the case.
+ *
+ * If only_pushed_down is TRUE, then consider only pushed-down quals.
+ */
+static bool
+restriction_is_constant_false(List *restrictlist, bool only_pushed_down)
+{
+ ListCell *lc;
+
+ /*
+ * Despite the above comment, the restriction list we see here might
+ * possibly have other members besides the FALSE constant, since other
+ * quals could get "pushed down" to the outer join level. So we check
+ * each member of the list.
+ */
+ foreach(lc, restrictlist)
+ {
+ RestrictInfo *rinfo = (RestrictInfo *) lfirst(lc);
+
+ Assert(IsA(rinfo, RestrictInfo));
+ if (only_pushed_down && !rinfo->is_pushed_down)
+ continue;
+
+ if (rinfo->clause && IsA(rinfo->clause, Const))
+ {
+ Const *con = (Const *) rinfo->clause;
+
+ /* constant NULL is as good as constant FALSE for our purposes */
+ if (con->constisnull)
+ return true;
+ if (!DatumGetBool(con->constvalue))
+ return true;
+ }
+ }
+ return false;
+}
--- /dev/null
+1,1
+2,2
+3,3
+4,4
+5,5
+6,6
+7,7
+8,8
+9,9
+10,10
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD html 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<title>Appendix A. ヒント一覧</title>
+<!-- Uncoment after the tool has been hosted somewhere.
+<link rel="home" title="pg_hint_plan" href="index.html">
+-->
+<link rel="stylesheet" type="text/css" href="style.css">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+</head>
+
+<body>
+<h1 id="pg_hint_plan">pg_hint_plan 0.1.0</h1>
+<div class="navigation">
+ <a href="pg_hint_plan-ja.html">pg_hint_plan</a> >
+ <a href="hint_list-ja.html">Appendix A. ヒント一覧</a>
+</div>
+<hr>
+
+<h2 id="hint-list">Appendix A. ヒント一覧</h2>
+<p>pg_hint_planで指定できるヒントは以下の通りです。</p>
+<table>
+<thead>
+<tr>
+<tr><th>グループ</th><th>ヒントの書式</th><th>説明</th></tr>
+</tr>
+</thead>
+<tbody>
+<tr><td rowspan="10" nowrap>スキャン方式</td>
+ <td nowrap>SeqScan(テーブル)</td>
+ <td>指定したテーブルについて、Seq Scanを選択します。</td></tr>
+<tr><td>TidScan(テーブル)</td>
+ <td>指定したテーブルについて、Tid Scanを選択します。検索条件にctidを指定した場合にのみ有効です。</td></tr>
+<tr><td nowrap>IndexScan(テーブル[ インデックス...])</td>
+ <td>指定したテーブルについて、Index Scanを選択します。インデックスも指定した場合は、指定したインデックスの中でコストが最小となるIndex Scanを選択します。ただし、インデックスが存在しない場合や指定したインデックスがWHERE句やJOIN条件などに関連しない場合はSeq Scanを選択します。</td></tr>
+<tr><td nowrap>IndexOnlyScan(テーブル[ インデックス...])</td>
+ <td>指定したテーブルについて、Index Only ScanとIndex Scanのうちコストが最小となるスキャン方式を選択します。インデックスも指定した場合は、指定したインデックスの中でIndex Only ScanとIndex Scanのうちコストが最小となるスキャン方式を選択します。ただし、インデックスが存在しない場合や指定したインデックスがWHERE句やJOIN条件などに関連しない場合はSeq Scanを選択します。また、これらの場合以外にも、インデックスが持つ値だけでなくテーブルの値も必要な場合はIndex Scanを選択します。PostgreSQL 9.2以降で動作します。</td></tr>
+<tr><td nowrap>BitmapScan(テーブル[ インデックス...])</td>
+ <td>指定したテーブルについて、Bitmap Scanを選択します。インデックスも指定した場合は、指定したインデックスの中でコストが最小となるインデックスを選択します。ただし、インデックスが存在しない場合や指定したインデックスがWHERE句やJOIN条件などに関連しない場合はSeq Scanを選択します。</td></tr>
+<tr><td nowrap>NoSeqScan(テーブル)</td>
+ <td>指定したテーブルについて、Seq Scan以外でコストが最小となるスキャン方式を選択します。ただし、他のスキャン方式を選択できない場合は、Seq Scanを選択します。</td></tr>
+<tr><td nowrap>NoTidScan(テーブル)</td>
+ <td>指定したテーブルについて、Tid Scan以外でコストが最小となるスキャン方式を選択します。</td></tr>
+<tr><td nowrap>NoIndexScan(テーブル)</td>
+ <td>指定したテーブルについて、Index ScanとIndex Only Scanを除いたスキャン方式の中でコストが最小となるスキャン方式を選択します。</td></tr>
+<tr><td nowrap>NoIndexOnlyScan(テーブル)</td>
+ <td>指定したテーブルについて、Index Only Scan以外でコストが最小となるスキャン方式を選択します。PostgreSQL 9.2以降で動作します。</td></tr>
+<tr><td nowrap>NoBitmapScan(テーブル)</td>
+ <td>指定したテーブルについて、Bitmap Scan以外でコストが最小となるスキャン方式を選択します。</td></tr>
+
+<tr><td rowspan="6" nowrap>結合方式</td>
+ <td nowrap>NestLoop(テーブル テーブル[ テーブル...])</td>
+ <td>指定したテーブル間の結合にNested Loopを選択します。</td></tr>
+<tr><td nowrap>HashJoin(テーブル テーブル[ テーブル...])</td>
+ <td>指定したテーブル間の結合にHash Joinを選択します。</td></tr>
+<tr><td nowrap>MergeJoin(テーブル テーブル[ テーブル...])</td>
+ <td>指定したテーブル間の結合にMerge Joinを選択します。</td></tr>
+<tr><td nowrap>NoNestLoop(テーブル テーブル[ テーブル...])</td>
+ <td>指定したテーブル間の結合にNested Loop以外の結合方式を選択します。</td></tr>
+<tr><td nowrap>NoHashJoin(テーブル テーブル[ テーブル...])</td>
+ <td>指定したテーブル間の結合にHash Join以外の結合方式を選択します。</td></tr>
+<tr><td nowrap>NoMergeJoin(テーブル テーブル[ テーブル...])</td>
+ <td>指定したテーブル間の結合にMerge Join以外の結合方式を選択します。</td></tr>
+
+<tr><td>結合順序</td>
+ <td nowrap>Leading(テーブル テーブル[ テーブル...])</td>
+ <td>指定したテーブルを指定した順番通りに結合します。</td></tr>
+
+<tr><td>GUCパラメータ</td>
+ <td nowrap>Set(GUCパラメータ 値)</td>
+ <td>そのクエリの実行計画を作成している間だけ、指定したGUCパラメータを指定した値に変更します。</td></tr>
+</tbody>
+</table></p>
+
+
+<hr>
+<div class="navigation">
+ <a href="pg_hint_plan-ja.html">pg_hint_plan</a> >
+ <a href="hint_list-ja.html">Appendix A. ヒント一覧</a>
+</div>
+
+<p class="footer">Copyright (c) 2012, NIPPON TELEGRAPH AND TELEPHONE CORPORATION</p>
+
+<!--
+<script type="text/javascript">
+var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
+document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
+</script><script src="pg_statsinfo-ja_files/ga.js" type="text/javascript"></script>
+<script type="text/javascript">
+try{
+var pageTracker = _gat._getTracker("UA-10244036-6");
+pageTracker._trackPageview();
+} catch(err) {}
+</script>
+-->
+</body>
+</html>
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD html 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<title>pg_hint_plan</title>
+<!-- Uncoment after the tool has been hosted somewhere.
+<link rel="home" title="pg_hint_plan" href="index.html">
+-->
+<link rel="stylesheet" type="text/css" href="style.css">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+</head>
+
+<body>
+<h1 id="pg_hint_plan">pg_hint_plan 1.0.0</h1>
+<div class="navigation">
+ <a href="pg_hint_plan-ja.html">pg_hint_plan</a>
+</div>
+<hr>
+
+<div class="index">
+<ol>
+<li><a href="#name">名前</a></li>
+<li><a href="#synopsis">概要</a></li>
+<li><a href="#description">機能説明</a>
+<li><a href="#install">インストール</a></li>
+<li><a href="#uninstall">アンインストール</a></li>
+<li><a href="#examples">使用例</a></li>
+<li><a href="#restrictions">使用上の注意と制約</a></li>
+<li><a href="#requirement">動作環境</a></li>
+<li><a href="#seealso">関連項目</a></li>
+<li><a href="hint_list-ja.html">Appendix A. ヒント一覧</a></li>
+</div>
+
+<h2 id="name">名前</h2>
+<p>pg_hint_plan -- 特殊なコメント中にヒント情報を記述することで、SQL文やGUCパラメータを変えずに実行計画を制御します。</p>
+
+<h2 id="synopsis">概要</h2>
+<p>PostgreSQLはコストベースオプティマイザを採用しており、SQL文と統計情報を元に可能なアクセスパスのコストを見積もり、最もコストの低い実行計画を選択します。オプティマイザは可能な限りよい実行計画を作成使用としますが、カラム間の相関関係などは考慮しないため、複雑なクエリでは常に最適なプランが選択されるとは限りません。</p>
+<p>pg_hint_planを用いると、ヒントを記述したブロックコメントをSQL文の前に加えることで、SQL文やGUCパラメータを変更することなく実行計画を制御することができます。</p>
+
+<h2 id="description">機能説明</h2>
+<p>pg_hint_planの機能について説明します。</p>
+
+<h3 id="hint-rule">ヒントの記述方法</h3>
+<p>ヒントはクエリ文字列の先頭のブロックコメント内に記述してください。ブロックコメントをヒントとして認識させるには、ブロックコメントの開始直後にプラス(+)を指定する必要があります。ヒントの対象は、カッコ内にオブジェクト名または別名(別名)で指定してください。オブジェクト名は、スペース、タブ、または改行のいずれかで区切って指定してください。</p>
+
+<p>以下の例では、HashJoinとSeqScanヒントにより、pgbench_accountsテーブルに対するSeq Scanの結果をHash Joinする実行計画が選択されています。</p>
+<pre>
+postgres=# /*+
+postgres*# <span class="strong">HashJoin(a b)</span>
+postgres*# <span class="strong">SeqScan(a)</span>
+postgres*# */
+postgres-# EXPLAIN SELECT *
+postgres-# FROM pgbench_branches b
+postgres-# JOIN pgbench_accounts a ON b.bid = a.bid
+postgres-# ORDER BY a.aid;
+ QUERY PLAN
+---------------------------------------------------------------------------------------
+ Sort (cost=31465.84..31715.84 rows=100000 width=197)
+ Sort Key: a.aid
+ -> <span class="strong">Hash Join</span> (cost=1.02..4016.02 rows=100000 width=197)
+ Hash Cond: (a.bid = b.bid)
+ -> <span class="strong">Seq Scan on pgbench_accounts a</span> (cost=0.00..2640.00 rows=100000 width=97)
+ -> Hash (cost=1.01..1.01 rows=1 width=100)
+ -> Seq Scan on pgbench_branches b (cost=0.00..1.01 rows=1 width=100)
+(7 rows)
+
+postgres=# </pre>
+
+<h3 id="hint-group">ヒントのグループ</h3>
+<p>pg_hint_planで使えるヒントは、スキャン方式と結合方式、結合順序、GUCパラメータの4グループに分けられます。各グループの具体的なヒントは、<a href="hint_list-ja.html">ヒント一覧</a>を参照してください。</p>
+
+<h4>スキャン方式</h4>
+<p>あるオブジェクトでどのスキャン方式を選択するかを指定できるヒントのグループで、「SeqScan」や「IndexScan」などが含まれます。</p>
+<p>スキャン方式を指定できるオブジェクトは、通常のテーブル、継承テーブル、UNLOGGEDテーブル、一時テーブル、システムカタログです。スキャン方式を指定できないオブジェクトは、外部テーブル、テーブル関数、VALUESコマンド結果、CTE、ビュー、副問い合わせ結果です。</p>
+<p>特定のオブジェクトについてあるスキャン方式を選択して欲しい場合は、そのスキャン方式のヒントと、対象となるオブジェクトの名前を指定してください。逆に、特定のオブジェクトについてあるスキャン方式を選択して欲しくない場合は、Noで始まるヒントを指定してください。同じオブジェクトに対して複数のスキャン方式のヒントを指定した場合は、最後に指定したヒントが適用されます。</p>
+
+<h4>結合方式</h4>
+<p>あるオブジェクトの組み合わせでどの結合方式を選択するかを指定できるヒントのグループで、「MergeJoin」や「NestLoop」などが含まれます。</p>
+<p>結合方式を指定できるオブジェクトは、通常のテーブル、継承テーブル、UNLOGGEDテーブル、一時テーブル、外部テーブル、システムカタログ、テーブル関数、VALUESコマンド結果、CTEです。結合方式を指定できないオブジェクトは、ビュー、副問い合わせ結果です。</p>
+<p>特定のオブジェクトの組み合わせについてある結合方式を選択して欲しい場合は、その結合方式のヒントと、対象となる2つ以上のオブジェクトの名前を指定してください。逆に、特定のオブジェクトの組み合わせについてある結合方式を選択して欲しくない場合は、Noで始まるヒントを指定してください。同じオブジェクトの組み合わせに対して複数の結合方式のヒントを指定した場合は、最後に指定したヒントが適用されます。</p>
+<h4>結合順序</h4>
+<p>あるオブジェクトの組み合わせでどのような順番で結合するかを指定できるヒントのグループで、「Leading」のみが含まれます。</p>
+<p>結合順序を指定できるオブジェクトは結合方式と同じです。</p>
+<p>先に結合して欲しいオブジェクトから順にオブジェクト名または別名を指定してください。複数の結合順序のヒントを指定した場合は、最後に指定したヒントが適用されます。クエリ中に複数の問い合わせブロックがあり、それぞれに結合順を指定したい場合は、それぞれの結合順を1つのLeadingヒントに連続して指定してください。</p>
+<h4>GUCパラメータ</h4>
+<p>そのクエリの実行計画を作成している間だけGUCパラメータを変更できるヒントのグループで、「Set」のみが含まれます。</p>
+<p>設定したいGUCパラメータとそのパラメータの値を指定してください。<a href="http://www.postgresql.org/docs/9.1/static/sql-set.html">SET</a>コマンドで指定できるGUCパラメータならば全て指定できますが、効果があるのは<a href="http://www.postgresql.org/docs/9.1/static/runtime-config-query.html">問い合わせ計画</a>のGUCパラメータのみです。同じGUCパラメータに対して複数のGUCパラメータのヒントを指定した場合は、最後に指定したヒントが適用されます。</p>
+<p>Setヒントに<a href="#hint-GUC">pg_hint_planのGUCパラメータ</a>を指定することはできますが、期待通りの動作をしないため、指定しないことをおすすめします。指定した場合の実際の動作は、<a href="#restrictions">使用上の注意と制約</a>を参照してください。</p>
+
+<h3 id="hint-GUC">pg_hint_planのGUCパラメータ</h3>
+<p>pg_hint_planの動作を制御するGUCパラメータを以下に記述します。</p>
+<table>
+<thead>
+<tr>
+<tr><th>GUCパラメータ</th><th>説明</th><th>デフォルト値</th></tr>
+</tr></thead>
+<tbody>
+<tr><td>pg_hint_plan.enable_hint</td>
+ <td>pg_hint_planの機能を有効または無効にします。</td><td>on</td></tr>
+<tr><td>pg_hint_plan.debug_print</td>
+ <td>pg_hint_planのデバッグ出力を有効にします。メッセージはLOGメッセージレベルで出力されますので、デフォルトではサーバログに出力され、クライアントには渡されません。</td><td>off</td></tr>
+<tr><td>pg_hint_plan.parse_messages</td>
+ <td>指定したヒントを解釈できなかった場合に、どのメッセージ階層でログを出力するかを指定します。有効な値は、debug5、debug4、debug3、debug2、debug1、log、info、notice、warning、またはerrorです。fatalとpanicは指定できません。</td><td>info</td></tr>
+</tbody>
+</table>
+<p>
+PostgreSQL 9.1の環境でこれらのパラメータをpostgresql.confファイルで設定するには、<a href="http://www.postgresql.org/docs/9.1/static/runtime-config-custom.html#GUC-CUSTOM-VARIABLE-CLASSES">custom_variable_classes</a>にpg_hint_planを加える必要があります。
+典型的な使用例は以下のようになります。
+</p>
+<pre>
+# postgresql.conf
+shared_preload_libraries = 'pg_hint_plan'
+
+custom_variable_classes = 'pg_hint_plan' # 9.2以降は廃止されたため記述不要
+pg_hint_plan.parse_messages = 'debug2'
+</pre>
+<p>
+PostgreSQL 9.2以降ではcustom_variable_classesは廃止されているため、pg_hint_planのGUCパラメータを標準のGUCパラメータと同様に記述することができます。
+</p>
+
+<h2 id="install">インストール</h2>
+<p>pg_hint_planのインストール方法について説明します。</p>
+
+<h3 id="build">ビルド</h3>
+<p>pg_hint_planをソースコードからビルドする場合、pg_hint_planのソースを展開したディレクトリでmake → make installの順に実行してください。make installはPostgreSQLをインストールしたOSユーザで実行してください。なお、pg_hint_planのビルドにはpgxsを使用するので、RPM版のPostgreSQLを使用している環境では、postgresql-devel パッケージが必要です。</p>
+<p>以下にビルドの例を示します。</p>
+<pre>
+$ tar xzvf pg_hint_plan-1.0.0.tar.gz
+$ cd pg_hint_plan-1.0.0
+$ make
+$ su
+# make install
+</pre>
+
+<h3 id="hint-load">pg_hint_planのロード</h3>
+<p>特定のセッションでのみpg_hint_planを使う場合は、以下の例のようにpg_hint_planの共有ライブラリをLOADコマンドでロードしてください。一般ユーザで利用する場合は$libdir/pluginsにもインストールする必要があるので注意して下さい。
+<pre>
+postgres=# LOAD 'pg_hint_plan';
+LOAD
+postgres=# </pre></p>
+<p>全てのセッションでpg_hint_planを有効にするには、shared_preload_libraries GUCパラメータに'pg_hint_plan'を追加してからサーバを再起動して下さい。</p>
+
+<h2 id="uninstall">アンインストール</h2>
+<p>pg_hint_planをアンインストールするには、pg_hint_planのソースを展開したディレクトリでmake uninstallを実行してください。make uninstallはPostgreSQLをインストールしたOSユーザで実行してください。</p>
+<p>以下にアンインストールの例を示します。</p>
+<pre>
+$ cd pg_hint_plan-1.0.0
+$ su
+# make uninstall
+</pre>
+
+<h2 id="examples">使用例</h2>
+<h3>スキャン方式</h3>
+<p>スキャン方式のヒントでは、スキャン対象のテーブルを指定します。IndexScanヒントで特定のインデックスを使用したい場合は、オプションでインデックスも指定できます。以下の例では、table1はSeq Scan、table2は主キーインデックスでのIndex Scanを選択させています。
+<pre>
+postgres=# /*+
+postgres*# SeqScan(t1)
+postgres*# IndexScan(t2 t2_pkey)
+postgres*# */
+postgres-# SELECT * FROM table1 t1 JOIN table table2 t2 ON (t1.key = t2.key);
+...
+</pre>
+</p>
+
+<h3>結合方式/結合順序</h3>
+<p>結合方式や結合順序のヒントでは、結合対象のテーブルのリストを指定します。以下の例では、table1とtabele2を直接結合する場合はNested Loopを、table1とtable2とtable3を結合する場合はMerge Joinを選択させています。また、コスト見積もりによってはtable1とtable2が直接結合されない場合がありえるため、table1とtable2を結合してからtable3を結合するようにLeadingヒントを併用しています。
+<pre>
+postgres=# /*+
+postgres*# NestLoop(t1 t2)
+postgres*# MergeJoin(t1 t2 t3)
+postgres*# Leading(t1 t2 t3)
+postgres*# */
+postgres-# SELECT * FROM table1 t1
+postgres-# JOIN table table2 t2 ON (t1.key = t2.key)
+postgres-# JOIN table table3 t3 ON (t2.key = t3.key);
+...
+</pre>
+</p>
+
+<h3>GUCパラメータ</h3>
+<p>
+GUCパラメータのヒントでは、GUCパラメータと値のペアを指定します。以下の例では、このクエリの実行計画を作成する間だけrandom_page_costを2.0に変更しています。
+<pre>
+postgres=# /*+
+postgres*# Set(random_page_cost 2.0)
+postgres*# */
+postgres-# SELECT * FROM table1 t1 WHERE key = 'value';
+...
+</pre>
+</p>
+
+<h2 id="restrictions">使用上の注意と制約</h2>
+<p>pg_hint_planを使用する際には、以下の注意と制約があります。</p>
+<h3>ヒントの指定方法</h3>
+<dl>
+<dt>ヒントの記述位置</dt>
+<dd>クエリの前に複数のブロックコメントを記述する場合は、最初のブロックコメントにのみヒントを記述してください。二番目以降のブロックコメントは、ヒントと見なされず無視されます。以下の例では、HashJoin(a b)とSeqScan(a)がヒントと見なされ、IndexScan(a)とMergeJoin(a b)は無視されています。</p>
+<pre>
+postgres=# /*+
+postgres*# <span class="strong">HashJoin(a b)</span>
+postgres*# <span class="strong">SeqScan(a)</span>
+postgres*# */
+postgres-# /*+ IndexScan(a) */
+postgres-# EXPLAIN SELECT /*+ MergeJoin(a b) */ *
+postgres-# FROM pgbench_branches b
+postgres-# JOIN pgbench_accounts a ON b.bid = a.bid
+postgres-# ORDER BY a.aid;
+ QUERY PLAN
+---------------------------------------------------------------------------------------
+ Sort (cost=31465.84..31715.84 rows=100000 width=197)
+ Sort Key: a.aid
+ -> <span class="strong">Hash Join</span> (cost=1.02..4016.02 rows=100000 width=197)
+ Hash Cond: (a.bid = b.bid)
+ -> <span class="strong">Seq Scan on pgbench_accounts a</span> (cost=0.00..2640.00 rows=100000 width=97)
+ -> Hash (cost=1.01..1.01 rows=1 width=100)
+ -> Seq Scan on pgbench_branches b (cost=0.00..1.01 rows=1 width=100)
+(7 rows)
+
+postgres=# </pre>
+</dd>
+<dt>オブジェクト名の引用符付け</dt>
+<dd>ヒントに記述するオブジェクト名や別名が閉じ括弧())、二重引用符(")、空白(スペース、タブ、改行のいずれか)を含む場合は、通常のSQL文で使う場合と同じように二重引用符(")で囲んでください。二重引用符を含むオブジェクト名は、二重引用符で括ったうえで二重引用符を二重引用符でエスケープしてください(例: 「quoted"table"name」→「"quoted""table""name"」)。</dd>
+<dt>同一名称テーブルの区別</dt>
+<dd>スキーマ違いや同一テーブルの複数回使用などでクエリ中に同一名称のテーブルが複数回出現する場合は、テーブルに別名をつけてそれぞれのテーブルを区別してください。以下の例の1つ目のSQL文では、HashJoin(t1 t1)をヒントに指定したとき、ヒント対象のオブジェクトが特定できずにエラーになっています。2つ目のSQL文では、各テーブルにptやstという別名をつけているため、実行計画作成時にヒントで指定した通りにHash Joinを選択しています。</p>
+<pre>
+postgres=# /*+ <span class="strong">HashJoin(t1 t1)</span>*/
+postgres-# EXPLAIN SELECT * FROM s1.t1
+postgres-# JOIN public.t1 ON (s1.t1.id=public.t1.id);
+INFO: hint syntax error at or near "HashJoin(t1 t1)"
+<span class="strong">DETAIL: Relation name "t1" is ambiguous.</span>
+ QUERY PLAN
+------------------------------------------------------------------
+ Merge Join (cost=337.49..781.49 rows=28800 width=8)
+ Merge Cond: (s1.t1.id = public.t1.id)
+ -> Sort (cost=168.75..174.75 rows=2400 width=4)
+ Sort Key: s1.t1.id
+ -> Seq Scan on t1 (cost=0.00..34.00 rows=2400 width=4)
+ -> Sort (cost=168.75..174.75 rows=2400 width=4)
+ Sort Key: public.t1.id
+ -> Seq Scan on t1 (cost=0.00..34.00 rows=2400 width=4)
+(8 行)
+
+postgres=# /*+ <span class="strong">HashJoin(pt st)</span> */
+postgres-# EXPLAIN SELECT * FROM s1.t1 st
+postgres-# JOIN public.t1 pt ON (st.id=pt.id);
+ QUERY PLAN
+---------------------------------------------------------------------
+ <span class="strong">Hash Join</span> (cost=64.00..1112.00 rows=28800 width=8)
+ Hash Cond: (st.id = pt.id)
+ -> Seq Scan on t1 st (cost=0.00..34.00 rows=2400 width=4)
+ -> Hash (cost=34.00..34.00 rows=2400 width=4)
+ -> Seq Scan on t1 pt (cost=0.00..34.00 rows=2400 width=4)
+(5 行)
+
+postgres=#</pre>
+</p>
+</dd>
+<dt>FROM句にVALUESコマンドを指定した場合の制限</dt>
+<dd>FROM句にVALUESコマンドを指定した場合は、ヒントのオブジェクト名に「*VALUES*」を指定してください。これは、VALUESの結果に別名を指定しても、PostgreSQL本体側で「*VALUES*」に名称が置き換えられるためです。このため、複数のVALUESを使用する場合は、ヒントの対象を特定できないため、実行計画を制御できません。</dd>
+</dl>
+<h3>ヒントの適用対象の指定</h3>
+<dl>
+<dt>クエリに明記されていないテーブルへのヒント適用</dt>
+<dd>ヒントで指定した名称と一致すれば、ビュー定義や関数内クエリなどに出現するテーブルについても、ヒントを指定したクエリ内と同じようにヒントが適用されます。このため、ヒントの適用有無や適用するヒントをそれぞれのテーブルで変えたい場合は、別の別名を指定してください。</br>
+以下の例では、ビュー定義で使われている「t1」という別名をSeqScanヒントで指定したことで、表スキャンとビュー経由のスキャンの両方でSeq Scanが選択されています。ビュー定義で使用されている「t1」とは別の別名を実表に指定することで、個別にスキャン方式を制御できます。
+<pre>
+postgres=# CREATE VIEW view1 AS SELECT * FROM table1 <span class="strong">t1</span>;
+CREATE TABLE
+postgres=# /*+ SeqScan(<span class="strong">t1</span>) */
+postgres=# EXPLAIN SELECT * FROM table1 <span class="strong">t1</span> JOIN view1 t2 ON (t1.key = t2.key) WHERE t2.key = 1;
+ QUERY PLAN
+-----------------------------------------------------------------
+ Nested Loop (cost=0.00..358.01 rows=1 width=16)
+ -> Seq Scan on table1 <span class="strong">t1</span> (cost=0.00..179.00 rows=1 width=8)
+ Filter: (key = 1)
+ -> Seq Scan on table1 <span class="strong">t1</span> (cost=0.00..179.00 rows=1 width=8)
+ Filter: (key = 1)
+(5 rows)
+
+postgres=# /*+ SeqScan(<span class="strong">t3</span>) */
+postgres=# EXPLAIN SELECT * FROM table1 <span class="strong">t3</span> JOIN view1 t2 ON (t1.key = t2.key) WHERE t2.key = 1;
+ QUERY PLAN
+--------------------------------------------------------------------------------
+ Nested Loop (cost=0.00..187.29 rows=1 width=16)
+ -> Seq Scan on table1 <span class="strong">t3</span> (cost=0.00..179.00 rows=1 width=8)
+ Filter: (key = 1)
+ -> Index Scan using foo_pkey on table1 t1 (cost=0.00..8.28 rows=1 width=8)
+ Index Cond: (key = 1)
+(5 rows)
+
+</pre>
+</dd>
+<dt>継承テーブルに対するヒント</dt>
+<dd>継承テーブルにスキャン方式のヒントを指定する場合は、オブジェクト名として親テーブルの名称または別名を指定してください。全ての子テーブルに同じスキャン方式を選択します。子テーブルごとに別のスキャン方式を指定することはできません。</dd>
+<dt>ビューやルールを使うクエリのヒント</dt>
+<dd>ルールを定義したテーブルやビューを複数用いるときに、各ビュー内のテーブルの別名やルール書き換え後のクエリのテーブルの別名が重複した場合は、ヒントの対象を区別できません。区別する場合は、各ビュー内のテーブルの別名やルール書き換え後のクエリのテーブルの別名を重複させないでください。</dd>
+<dt>ルールを使うクエリでのヒントの適用範囲</dt>
+<dd>ルールによるクエリ書き換え後によってクエリが複数になる場合は、先頭のブロックコメントで指定したヒントを全てのクエリで使用します。</dd>
+<dt>マルチステートメントでのヒントの適用範囲</dt>
+<dd>クエリがマルチステートメントで実行される場合は、先頭のブロックコメントで指定したヒントを全てのクエリで使用します。2つ目以降のクエリに指定したヒントは無視します。psqlコマンドで-cオプションで複数のクエリを指定した場合などにマルチステートメントで実行されます。</dd>
+<dt>IndexOnlyScanヒントの指定(PostgreSQL 9.2以降)</dt>
+<dd>IndexOnlyScanヒントを指定しても、ヒント対象となるテーブルに複数のインデックスが存在するときは、Index Scanが選択される場合があります。この場合は、IndexOnlyScanヒントに、テーブルだけでなくそのテーブルでIndex Only Scanを選択できるインデックスも指定してください。そのインデックスを使ったIndex Only Scanが選択されます。</dd>
+<dt>NoIndexScanヒントの注意点(PostgreSQL 9.2以降)</dt>
+<dd>PostgreSQL 9.2以降でNoIndexScanヒントを指定した場合は、Index ScanだけでなくIndex Only Scanも選択されません。</dd>
+</dl>
+
+<h3>ヒント指定エラーの扱い</h3>
+<dt>構文エラー</dt>
+<dd>ヒントの記述に構文上の誤りがあった場合、pg_hint_planは誤った記述より前のヒントのみ有効とし、誤った記述以降のヒントを無視してクエリを実行します。誤りの内容はpg_hint_plan.parse_messagesで指定したレベルでサーバログに記録されます。
+<ul>
+<li>ヒント名が間違っている。</li>
+<li>オブジェクト指定が正しく括弧で囲まれていない。</li>
+<li>オブジェクト名が空白で区切られていない。</li>
+</ul>
+</dd>
+<dt>オブジェクト指定エラー</dt>
+<dd>pg_hint_planは、ヒント対象のオブジェクト指定に誤りがあった場合、pg_hint_planは不正なヒントのみを無視し、それ以外のヒントを使ってっクエリを実行します。誤りの内容はpg_hint_plan.parse_messagesで指定したレベルでサーバログに記録されます。誤ったオブジェクト指定の例を以下に示します。</dd>
+<ul>
+<li>クエリ中に同じ名称のテーブル名または別名のテーブルがあり、それに対してヒントを指定した。</li>
+<li>結合方式や結合順のヒントに同じオブジェクト名を複数回指定した。</li>
+</ul>
+</dd>
+<dt>指定するヒントの種類の重複</dt>
+<dd>同じオブジェクトに対して同じグループのヒントを重複して指定した場合は、各グループで最後に指定したヒントを使用します。</dd>
+<dt>ネストしたブロックコメント</dt>
+<dd>pg_hint_planでは、ヒントを指定したブロックコメントにネストしたブロックコメントを含めることができません。ネストしたブロックコメントを含めた場合は、誤った記述に関する情報を出力しますがエラー終了しません。全てのヒントを無視してクエリを実行します。</dd>
+<dt>メッセージの出力レベル</dt>
+<dd>ヒントに誤りがあった場合に出力されるメッセージのレベルは、基本的にはpg_hint_plan.parse_messagesに指定したレベルです。ただし、ヒントに指定したオブジェクトの長さが識別子の最大長(デフォルトでは63バイト)を超えた際に切り詰めた場合は、NOTICEで出力します。</dd>
+
+<h3>機能制限</h3>
+<dt>標準のGUCパラメータの影響</dt>
+<dd>FROMリストの数がfrom_collapse_limitの設定値以上の場合、またはFROMリストの数がjoin_collapse_limitの設定値より大きい場合は、結合順序のヒントが無視されます。また、FROMリストの数がgeqo_thresholdの設定値以上の場合は、結合順序のヒント、および結合方式のヒントが無視されます。ヒントが使われるようにするには、これらのGUCパラメータの値を大きくしてください。</dd>
+<dt>ヒントで制御できないケース</dt>
+<dd>pg_hint_planでは、PostgreSQLのプランナが候補としてあげる事ができない実行計画をヒントに指定しても、その実行計画を生成することはできません。PostgreSQLのプランナが候補としてあげる事ができない実行計画の例を以下に示します。
+<ul>
+<li>FULL OUTER JOINではNested Loopは候補パスとして扱われません。</li>
+<li>WHERE句やJOIN条件などに指定されない列のみを含むインデックスは候補パスとして扱われません。</li>
+<li>検索条件にctidを指定しない場合はTid Scanは候補パスとして扱われません。</li>
+</ul>
+</dd>
+<dt>PL/pgSQLにおける制限</dt>
+<dd>PL/pgSQLでユーザ定義関数を実装する際に、関数定義内の各クエリの先頭にヒントを指定したとしても、そのヒントは無視します。ユーザ定義関数を実行するSELECTコマンドに指定したヒントを使用します。ただし、PL/pgSQLでは、関数定義内で指定したクエリがそのまま実行されるとは限らないため、ヒントを指定した場合の挙動は保証できません。</dd>
+<dt>ECPGにおける制限</dt>
+<dd>pg_hint_planでは、ECPGで実装したアプリケーションから発行するクエリは、基本的に実行計画を制御できません。これは、CプリプロセッサがCコードに変換するタイミングで、全てのブロックコメントを取り除いてしまうためです。ただし、C言語文字列に格納したクエリをEXECUTEコマンドで実行する動的SQLの場合は、クエリ文字列の先頭にヒントを指定することで実行計画を制御できます。</dd>
+<dt>psqlのフェッチ件数指定</dt>
+<dd>psqlコマンドのFETCH_COUNT変数に0より大きな整数値を指定すると、pg_hint_planでは実行計画を制御できなくなります。FETCH_COUNT変数に0より大きな整数値を指定すると、ユーザが指定したクエリの先頭に「DECLARE _psql_cursor NO SCROLL CURSOR FOR」が自動的に追加されてクエリが発行されることにより、ヒントがクエリの先頭ではなくなってしまうためです。</dd>
+<dt>ヒントによるフィンガープリントの変化</dt>
+<dd>pg_hint_planはSQLコメントでヒントを指定するため、SQL文フィンガープリントベースのクエリキャッシュなどでは、ヒントが異なれば別のSQL文として扱われます。pg_stat_statementも9.1では別クエリとして集計しますが、9.2ではクエリ集約機能によりコメントが除去されるので、ヒントのみが異なるクエリは同じクエリとして扱われます。</dd>
+<pre>
+postgres=# /*+ <span class="strong">MergeJoin(a *VALUES*)</span> */
+postgres-# EXPLAIN SELECT *
+postgres-# FROM pgbench_accounts a
+postgres-# JOIN (VALUES (1,1),(2,2)) <span class="strong">v</span> (vid, vbalance) ON a.aid = v.vid
+postgres-# ORDER BY a.aid;
+ QUERY PLAN
+---------------------------------------------------------------------------------------------------------------
+ <span class="strong">Merge Join</span> (cost=0.04..4497.33 rows=2 width=105)
+ Merge Cond: (a.aid = "*VALUES*".column1)
+ -> Index Scan using pgbench_accounts_pkey on pgbench_accounts a (cost=0.00..4247.26 rows=100000 width=97)
+ -> Sort (cost=0.04..0.04 rows=2 width=8)
+ Sort Key: "*VALUES*".column1
+ -> Values Scan on <span class="strong">"*VALUES*"</span> (cost=0.00..0.03 rows=2 width=8)
+(6 行)
+
+postgres=#</pre>
+<dt>Setヒントの制限</dt>
+<dd>Setヒントに<a href="#hint-GUC">pg_hint_planのGUCパラメータ</a>を指定することはできますが、期待通りの動作をしないため、指定しないことをおすすめします。指定した場合の実際の動作を、以下に示します。
+<ul>
+<li>pg_hint_plan.enable_hintおよびpg_hint_plan.debug_printを指定した場合は、無視されます。</li>
+<li>pg_hint_plan.parse_messagesを指定した場合は、構文エラーと一部のSetヒントのエラーについてはクエリ開始時の設定レベルで出力され、それ以外のメッセージについてはSetヒントで指定したレベルで出力されます。</li>
+</ul>
+</dd>
+
+</dl>
+
+<h2 id="requirement">動作環境</h2>
+<dl>
+<dt>PostgreSQL</dt>
+ <dd>バージョン 9.1.4、9.2.1</dd>
+<dt>動作検証済みOS</dt>
+ <dd>RHEL 6.1</dd>
+</dl>
+
+<h2 id="seealso">関連項目</h2>
+<h3 id="postgresql_document">PostgreSQLドキュメント</h3>
+<a href="http://www.postgresql.org/docs/9.1/static/sql-explain.html">EXPLAIN</a>
+<a href="http://www.postgresql.org/docs/9.1/static/sql-set.html">SET</a>
+<a href="http://www.postgresql.org/docs/9.1/static/runtime-config.html">サーバの設定</a>
+<hr>
+
+<div class="navigation">
+ <a href="pg_hint_plan-ja.html">pg_hint_plan</a>
+</div>
+
+<p class="footer">Copyright (c) 2012, NIPPON TELEGRAPH AND TELEPHONE CORPORATION</p>
+
+<!--
+<script type="text/javascript">
+var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
+document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
+</script><script src="pg_statsinfo-ja_files/ga.js" type="text/javascript"></script>
+<script type="text/javascript">
+try{
+var pageTracker = _gat._getTracker("UA-10244036-6");
+pageTracker._trackPageview();
+} catch(err) {}
+</script>
+-->
+</body>
+</html>
--- /dev/null
+body {
+ font-family:
+ Lucida Grande, Verdana, Arial, Helvetica,
+ 'メイリオ',
+ 'Meiryo',
+ 'ヒラギノ角ゴ Pro W3',
+ 'Hiragino Kaku Gothic Pro',
+ 'Osaka',
+ 'MS Pゴシック',
+ sans-serif;
+ color: #202020;
+}
+
+/* give the rule a bit of extra space (above and below), since its being used to divide
+ sections on some pages (project summary) */
+HR { margin: 5px 0px 5px 0px }
+
+
+h2, h3, h4, h5, h6 {
+ color: Black;
+ background: none;
+ padding-top: 0.5em;
+ padding-bottom: 0.17em;
+ border-bottom: 1px solid #aaaaaa;
+}
+H1 { font-size: x-large; font-family: Lucida Grande,verdana,arial,helvetica,sans-serif; }
+H2 { font-size: large; font-family: Lucida Grande,verdana,arial,helvetica,sans-serif; }
+H3 { padding-left: 1em; font-size: medium; font-family: Lucida Grande,verdana,arial,helvetica,sans-serif; }
+H4 { padding-left: 2em; font-size: small; font-family: Lucida Grande,verdana,arial,helvetica,sans-serif; }
+H5 { padding-left: 3em; font-size: x-small; font-family: Lucida Grande,verdana,arial,helvetica,sans-serif; }
+H6 { padding-left: 4em; font-size: xx-small; font-family: Lucida Grande,verdana,arial,helvetica,sans-serif; }
+
+pre {
+ font-family: courier,sans-serif;
+ background-color: #FBFBFD;
+ border: 1px dashed #7E7ECB;
+ color: black;
+ line-height: 1.1em; padding: 0.5em;
+ overflow: auto;
+}
+
+li {
+ line-height: 1.4em;
+}
+
+table {
+ background: #f9f9f9;
+ border: 1px solid #aaa;
+ border-collapse: collapse;
+}
+
+th, td {
+ border: 1px solid #aaa;
+ padding: 0.2em;
+}
+
+thead th {
+ background: #f2f2f2;
+ text-align: center;
+}
+
+tbody th {
+ background: #f2f2f2;
+ text-align: left;
+}
+
+div.index {
+ float:right;
+ border:thin solid black;
+ background-color: white;
+ padding-top: 0.2em;
+ padding-bottom: 0.2em;
+ padding-left: 1em;
+ padding-right: 1em;
+ margin-left: 0.5em;
+}
+
+p.footer {
+ text-align: right;
+ font-size: small;
+}
+
+span.param {
+ color: #0000cd;
+}
+
+span.strong {
+ font-weight: bold;
+ text-decoration: underline;
+}
\ No newline at end of file
--- /dev/null
+base_plan.out
+fdw.out
+init.out
+pg_hint_plan.out
+ut-A.out
+ut-A2.out
+ut-G.out
+ut-J.out
+ut-L.out
+ut-S.out
+indexonly.out
+create_execute.out
--- /dev/null
+SET search_path TO public;
+-- query type 1
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+ QUERY PLAN
+--------------------------------------
+ Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+(4 rows)
+
+-- query type 2
+EXPLAIN (COSTS false) SELECT * FROM t1, t4 WHERE t1.val < 10;
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ -> Bitmap Heap Scan on t1
+ Recheck Cond: (val < 10)
+ -> Bitmap Index Scan on t1_val
+ Index Cond: (val < 10)
+ -> Materialize
+ -> Seq Scan on t4
+(7 rows)
+
+-- query type 3
+EXPLAIN (COSTS false) SELECT * FROM t3, t4 WHERE t3.id = t4.id AND t4.ctid = '(1,1)';
+ QUERY PLAN
+---------------------------------------------
+ Merge Join
+ Merge Cond: (t3.id = t4.id)
+ -> Index Scan using t3_pkey on t3
+ -> Sort
+ Sort Key: t4.id
+ -> Seq Scan on t4
+ Filter: (ctid = '(1,1)'::tid)
+(7 rows)
+
+-- query type 4
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Index Scan using t2_pkey on t2
+ Index Cond: (id = t1.id)
+(5 rows)
+
+-- query type 5
+EXPLAIN (COSTS false) SELECT * FROM t1, t3 WHERE t1.val = t3.val;
+ QUERY PLAN
+--------------------------------
+ Hash Join
+ Hash Cond: (t1.val = t3.val)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t3
+(5 rows)
+
+-- query type 6
+EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
+ QUERY PLAN
+--------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.id = t4.id)
+ -> Merge Join
+ Merge Cond: (t1.id = t3.id)
+ -> Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+ -> Index Scan using t3_pkey on t3
+ -> Sort
+ Sort Key: t4.id
+ -> Seq Scan on t4
+(12 rows)
+
--- /dev/null
+SET search_path TO public;
+-- query type 1
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+ QUERY PLAN
+--------------------------------------
+ Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+(4 rows)
+
+-- query type 2
+EXPLAIN (COSTS false) SELECT * FROM t1, t4 WHERE t1.val < 10;
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ -> Bitmap Heap Scan on t1
+ Recheck Cond: (val < 10)
+ -> Bitmap Index Scan on t1_val
+ Index Cond: (val < 10)
+ -> Materialize
+ -> Seq Scan on t4
+(7 rows)
+
+-- query type 3
+EXPLAIN (COSTS false) SELECT * FROM t3, t4 WHERE t3.id = t4.id AND t4.ctid = '(1,1)';
+ QUERY PLAN
+---------------------------------------------
+ Merge Join
+ Merge Cond: (t3.id = t4.id)
+ -> Index Scan using t3_pkey on t3
+ -> Sort
+ Sort Key: t4.id
+ -> Seq Scan on t4
+ Filter: (ctid = '(1,1)'::tid)
+(7 rows)
+
+-- query type 4
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Index Scan using t2_pkey on t2
+ Index Cond: (id = t1.id)
+(5 rows)
+
+-- query type 5
+EXPLAIN (COSTS false) SELECT * FROM t1, t3 WHERE t1.val = t3.val;
+ QUERY PLAN
+--------------------------------
+ Hash Join
+ Hash Cond: (t1.val = t3.val)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t3
+(5 rows)
+
+-- query type 6
+EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
+ QUERY PLAN
+--------------------------------------------------
+ Nested Loop
+ -> Merge Join
+ Merge Cond: (t1.id = t4.id)
+ -> Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+ -> Sort
+ Sort Key: t4.id
+ -> Seq Scan on t4
+ -> Index Scan using t3_pkey on t3
+ Index Cond: (id = t1.id)
+(12 rows)
+
--- /dev/null
+SET search_path TO public;
+CREATE SCHEMA s0;
+CREATE TABLE t1 (id int PRIMARY KEY, val int);
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "t1_pkey" for table "t1"
+CREATE TABLE t2 (id int PRIMARY KEY, val int);
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "t2_pkey" for table "t2"
+CREATE TABLE t3 (id int PRIMARY KEY, val int);
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "t3_pkey" for table "t3"
+CREATE TABLE t4 (id int PRIMARY KEY, val int);
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "t4_pkey" for table "t4"
+CREATE TABLE p1 (id int PRIMARY KEY, val int);
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "p1_pkey" for table "p1"
+CREATE TABLE p1_c1 (LIKE p1 INCLUDING ALL, CHECK (id <= 100)) INHERITS(p1);
+NOTICE: merging column "id" with inherited definition
+NOTICE: merging column "val" with inherited definition
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "p1_c1_pkey" for table "p1_c1"
+CREATE TABLE p1_c2 (LIKE p1 INCLUDING ALL, CHECK (id > 100 AND id <= 200)) INHERITS(p1);
+NOTICE: merging column "id" with inherited definition
+NOTICE: merging column "val" with inherited definition
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "p1_c2_pkey" for table "p1_c2"
+CREATE TABLE p1_c3 (LIKE p1 INCLUDING ALL, CHECK (id > 200 AND id <= 300)) INHERITS(p1);
+NOTICE: merging column "id" with inherited definition
+NOTICE: merging column "val" with inherited definition
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "p1_c3_pkey" for table "p1_c3"
+CREATE TABLE p1_c4 (LIKE p1 INCLUDING ALL, CHECK (id > 300)) INHERITS(p1);
+NOTICE: merging column "id" with inherited definition
+NOTICE: merging column "val" with inherited definition
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "p1_c4_pkey" for table "p1_c4"
+CREATE TABLE p1_c1_c1 (LIKE p1 INCLUDING ALL, CHECK (id <= 50)) INHERITS(p1_c1);
+NOTICE: merging column "id" with inherited definition
+NOTICE: merging column "val" with inherited definition
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "p1_c1_c1_pkey" for table "p1_c1_c1"
+CREATE TABLE p1_c1_c2 (LIKE p1 INCLUDING ALL, CHECK (id > 50 AND id <= 100)) INHERITS(p1_c1);
+NOTICE: merging column "id" with inherited definition
+NOTICE: merging column "val" with inherited definition
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "p1_c1_c2_pkey" for table "p1_c1_c2"
+CREATE TABLE p1_c3_c1 (LIKE p1 INCLUDING ALL, CHECK (id > 200 AND id <= 250)) INHERITS(p1_c3);
+NOTICE: merging column "id" with inherited definition
+NOTICE: merging column "val" with inherited definition
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "p1_c3_c1_pkey" for table "p1_c3_c1"
+CREATE TABLE p1_c3_c2 (LIKE p1 INCLUDING ALL, CHECK (id > 250 AND id <= 300)) INHERITS(p1_c3);
+NOTICE: merging column "id" with inherited definition
+NOTICE: merging column "val" with inherited definition
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "p1_c3_c2_pkey" for table "p1_c3_c2"
+CREATE TABLE s0.t1 (id int PRIMARY KEY, val int);
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "t1_pkey" for table "t1"
+INSERT INTO t1 SELECT i, i % 100 FROM (SELECT generate_series(1, 10000) i) t;
+INSERT INTO t2 SELECT i, i % 10 FROM (SELECT generate_series(1, 1000) i) t;
+INSERT INTO t3 SELECT i, i FROM (SELECT generate_series(1, 100) i) t;
+INSERT INTO t4 SELECT i, i FROM (SELECT generate_series(1, 10) i) t;
+INSERT INTO p1_c1_c1 SELECT i, i % 100 FROM (SELECT generate_series(1, 50) i) t;
+INSERT INTO p1_c1_c2 SELECT i, i % 100 FROM (SELECT generate_series(51, 100) i) t;
+INSERT INTO p1_c2 SELECT i, i % 100 FROM (SELECT generate_series(101, 200) i) t;
+INSERT INTO p1_c3_c1 SELECT i, i % 100 FROM (SELECT generate_series(201, 250) i) t;
+INSERT INTO p1_c3_c2 SELECT i, i % 100 FROM (SELECT generate_series(251, 300) i) t;
+INSERT INTO p1_c4 SELECT i, i % 100 FROM (SELECT generate_series(301, 400) i) t;
+CREATE INDEX t1_val ON t1 (val);
+CREATE INDEX t2_val ON t2 (val);
+ANALYZE t1;
+ANALYZE t2;
+ANALYZE t3;
+ANALYZE t4;
+ANALYZE p1;
+ANALYZE p1_c1;
+ANALYZE p1_c2;
+CREATE VIEW v1 AS SELECT id, val FROM t1;
+CREATE VIEW v2 AS SELECT t1.id t1_id, t1.val t1_val, t2.id t2_id, t2.val t2_val FROM t1, t2 WHERE t1.id = t2.id;
+CREATE VIEW v3 AS SELECT t_1.id t1_id, t_1.val t1_val, t_2.id t2_id, t_2.val t2_val FROM t1 t_1, t2 t_2 WHERE t_1.id = t_2.id;
+CREATE VIEW v4 AS SELECT v_2.t1_id, t_3.id FROM v2 v_2, t3 t_3 WHERE v_2.t1_id = t_3.id;
+/*
+ * The following GUC parameters need the setting of the default value to
+ * succeed in regression test.
+ */
+CREATE VIEW settings AS
+SELECT name, setting, category
+ FROM pg_settings
+ WHERE category LIKE 'Query Tuning%'
+ OR name = 'client_min_messages'
+ ORDER BY category, name;
+SELECT * FROM settings;
+ name | setting | category
+---------------------------+-----------+---------------------------------------------
+ geqo | on | Query Tuning / Genetic Query Optimizer
+ geqo_effort | 5 | Query Tuning / Genetic Query Optimizer
+ geqo_generations | 0 | Query Tuning / Genetic Query Optimizer
+ geqo_pool_size | 0 | Query Tuning / Genetic Query Optimizer
+ geqo_seed | 0 | Query Tuning / Genetic Query Optimizer
+ geqo_selection_bias | 2 | Query Tuning / Genetic Query Optimizer
+ geqo_threshold | 12 | Query Tuning / Genetic Query Optimizer
+ constraint_exclusion | partition | Query Tuning / Other Planner Options
+ cursor_tuple_fraction | 0.1 | Query Tuning / Other Planner Options
+ default_statistics_target | 100 | Query Tuning / Other Planner Options
+ from_collapse_limit | 8 | Query Tuning / Other Planner Options
+ join_collapse_limit | 8 | Query Tuning / Other Planner Options
+ cpu_index_tuple_cost | 0.005 | Query Tuning / Planner Cost Constants
+ cpu_operator_cost | 0.0025 | Query Tuning / Planner Cost Constants
+ cpu_tuple_cost | 0.01 | Query Tuning / Planner Cost Constants
+ effective_cache_size | 16384 | Query Tuning / Planner Cost Constants
+ random_page_cost | 4 | Query Tuning / Planner Cost Constants
+ seq_page_cost | 1 | Query Tuning / Planner Cost Constants
+ enable_bitmapscan | on | Query Tuning / Planner Method Configuration
+ enable_hashagg | on | Query Tuning / Planner Method Configuration
+ enable_hashjoin | on | Query Tuning / Planner Method Configuration
+ enable_indexscan | on | Query Tuning / Planner Method Configuration
+ enable_material | on | Query Tuning / Planner Method Configuration
+ enable_mergejoin | on | Query Tuning / Planner Method Configuration
+ enable_nestloop | on | Query Tuning / Planner Method Configuration
+ enable_seqscan | on | Query Tuning / Planner Method Configuration
+ enable_sort | on | Query Tuning / Planner Method Configuration
+ enable_tidscan | on | Query Tuning / Planner Method Configuration
+ client_min_messages | notice | Reporting and Logging / When to Log
+(29 rows)
+
--- /dev/null
+SET search_path TO public;
+CREATE SCHEMA s0;
+CREATE TABLE t1 (id int PRIMARY KEY, val int);
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "t1_pkey" for table "t1"
+CREATE TABLE t2 (id int PRIMARY KEY, val int);
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "t2_pkey" for table "t2"
+CREATE TABLE t3 (id int PRIMARY KEY, val int);
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "t3_pkey" for table "t3"
+CREATE TABLE t4 (id int PRIMARY KEY, val int);
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "t4_pkey" for table "t4"
+CREATE TABLE p1 (id int PRIMARY KEY, val int);
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "p1_pkey" for table "p1"
+CREATE TABLE p1_c1 (LIKE p1 INCLUDING ALL, CHECK (id <= 100)) INHERITS(p1);
+NOTICE: merging column "id" with inherited definition
+NOTICE: merging column "val" with inherited definition
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "p1_c1_pkey" for table "p1_c1"
+CREATE TABLE p1_c2 (LIKE p1 INCLUDING ALL, CHECK (id > 100 AND id <= 200)) INHERITS(p1);
+NOTICE: merging column "id" with inherited definition
+NOTICE: merging column "val" with inherited definition
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "p1_c2_pkey" for table "p1_c2"
+CREATE TABLE p1_c3 (LIKE p1 INCLUDING ALL, CHECK (id > 200 AND id <= 300)) INHERITS(p1);
+NOTICE: merging column "id" with inherited definition
+NOTICE: merging column "val" with inherited definition
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "p1_c3_pkey" for table "p1_c3"
+CREATE TABLE p1_c4 (LIKE p1 INCLUDING ALL, CHECK (id > 300)) INHERITS(p1);
+NOTICE: merging column "id" with inherited definition
+NOTICE: merging column "val" with inherited definition
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "p1_c4_pkey" for table "p1_c4"
+CREATE TABLE p1_c1_c1 (LIKE p1 INCLUDING ALL, CHECK (id <= 50)) INHERITS(p1_c1);
+NOTICE: merging column "id" with inherited definition
+NOTICE: merging column "val" with inherited definition
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "p1_c1_c1_pkey" for table "p1_c1_c1"
+CREATE TABLE p1_c1_c2 (LIKE p1 INCLUDING ALL, CHECK (id > 50 AND id <= 100)) INHERITS(p1_c1);
+NOTICE: merging column "id" with inherited definition
+NOTICE: merging column "val" with inherited definition
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "p1_c1_c2_pkey" for table "p1_c1_c2"
+CREATE TABLE p1_c3_c1 (LIKE p1 INCLUDING ALL, CHECK (id > 200 AND id <= 250)) INHERITS(p1_c3);
+NOTICE: merging column "id" with inherited definition
+NOTICE: merging column "val" with inherited definition
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "p1_c3_c1_pkey" for table "p1_c3_c1"
+CREATE TABLE p1_c3_c2 (LIKE p1 INCLUDING ALL, CHECK (id > 250 AND id <= 300)) INHERITS(p1_c3);
+NOTICE: merging column "id" with inherited definition
+NOTICE: merging column "val" with inherited definition
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "p1_c3_c2_pkey" for table "p1_c3_c2"
+CREATE TABLE s0.t1 (id int PRIMARY KEY, val int);
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "t1_pkey" for table "t1"
+INSERT INTO t1 SELECT i, i % 100 FROM (SELECT generate_series(1, 10000) i) t;
+INSERT INTO t2 SELECT i, i % 10 FROM (SELECT generate_series(1, 1000) i) t;
+INSERT INTO t3 SELECT i, i FROM (SELECT generate_series(1, 100) i) t;
+INSERT INTO t4 SELECT i, i FROM (SELECT generate_series(1, 10) i) t;
+INSERT INTO p1_c1_c1 SELECT i, i % 100 FROM (SELECT generate_series(1, 50) i) t;
+INSERT INTO p1_c1_c2 SELECT i, i % 100 FROM (SELECT generate_series(51, 100) i) t;
+INSERT INTO p1_c2 SELECT i, i % 100 FROM (SELECT generate_series(101, 200) i) t;
+INSERT INTO p1_c3_c1 SELECT i, i % 100 FROM (SELECT generate_series(201, 250) i) t;
+INSERT INTO p1_c3_c2 SELECT i, i % 100 FROM (SELECT generate_series(251, 300) i) t;
+INSERT INTO p1_c4 SELECT i, i % 100 FROM (SELECT generate_series(301, 400) i) t;
+CREATE INDEX t1_val ON t1 (val);
+CREATE INDEX t2_val ON t2 (val);
+ANALYZE t1;
+ANALYZE t2;
+ANALYZE t3;
+ANALYZE t4;
+ANALYZE p1;
+ANALYZE p1_c1;
+ANALYZE p1_c2;
+CREATE VIEW v1 AS SELECT id, val FROM t1;
+CREATE VIEW v2 AS SELECT t1.id t1_id, t1.val t1_val, t2.id t2_id, t2.val t2_val FROM t1, t2 WHERE t1.id = t2.id;
+CREATE VIEW v3 AS SELECT t_1.id t1_id, t_1.val t1_val, t_2.id t2_id, t_2.val t2_val FROM t1 t_1, t2 t_2 WHERE t_1.id = t_2.id;
+CREATE VIEW v4 AS SELECT v_2.t1_id, t_3.id FROM v2 v_2, t3 t_3 WHERE v_2.t1_id = t_3.id;
+/*
+ * The following GUC parameters need the setting of the default value to
+ * succeed in regression test.
+ */
+CREATE VIEW settings AS
+SELECT name, setting, category
+ FROM pg_settings
+ WHERE category LIKE 'Query Tuning%'
+ OR name = 'client_min_messages'
+ ORDER BY category, name;
+SELECT * FROM settings;
+ name | setting | category
+---------------------------+-----------+---------------------------------------------
+ geqo | on | Query Tuning / Genetic Query Optimizer
+ geqo_effort | 5 | Query Tuning / Genetic Query Optimizer
+ geqo_generations | 0 | Query Tuning / Genetic Query Optimizer
+ geqo_pool_size | 0 | Query Tuning / Genetic Query Optimizer
+ geqo_seed | 0 | Query Tuning / Genetic Query Optimizer
+ geqo_selection_bias | 2 | Query Tuning / Genetic Query Optimizer
+ geqo_threshold | 12 | Query Tuning / Genetic Query Optimizer
+ constraint_exclusion | partition | Query Tuning / Other Planner Options
+ cursor_tuple_fraction | 0.1 | Query Tuning / Other Planner Options
+ default_statistics_target | 100 | Query Tuning / Other Planner Options
+ from_collapse_limit | 8 | Query Tuning / Other Planner Options
+ join_collapse_limit | 8 | Query Tuning / Other Planner Options
+ cpu_index_tuple_cost | 0.005 | Query Tuning / Planner Cost Constants
+ cpu_operator_cost | 0.0025 | Query Tuning / Planner Cost Constants
+ cpu_tuple_cost | 0.01 | Query Tuning / Planner Cost Constants
+ effective_cache_size | 16384 | Query Tuning / Planner Cost Constants
+ random_page_cost | 4 | Query Tuning / Planner Cost Constants
+ seq_page_cost | 1 | Query Tuning / Planner Cost Constants
+ enable_bitmapscan | on | Query Tuning / Planner Method Configuration
+ enable_hashagg | on | Query Tuning / Planner Method Configuration
+ enable_hashjoin | on | Query Tuning / Planner Method Configuration
+ enable_indexonlyscan | on | Query Tuning / Planner Method Configuration
+ enable_indexscan | on | Query Tuning / Planner Method Configuration
+ enable_material | on | Query Tuning / Planner Method Configuration
+ enable_mergejoin | on | Query Tuning / Planner Method Configuration
+ enable_nestloop | on | Query Tuning / Planner Method Configuration
+ enable_seqscan | on | Query Tuning / Planner Method Configuration
+ enable_sort | on | Query Tuning / Planner Method Configuration
+ enable_tidscan | on | Query Tuning / Planner Method Configuration
+ client_min_messages | notice | Reporting and Logging / When to Log
+(30 rows)
+
--- /dev/null
+SET search_path TO public;
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+ QUERY PLAN
+--------------------------------------
+ Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+(4 rows)
+
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.val = t2.val;
+ QUERY PLAN
+-------------------------------------------
+ Merge Join
+ Merge Cond: (t2.val = t1.val)
+ -> Index Scan using t2_val on t2
+ -> Materialize
+ -> Index Scan using t1_val on t1
+(5 rows)
+
+LOAD 'pg_hint_plan';
+SET pg_hint_plan.debug_print TO on;
+SET client_min_messages TO LOG;
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+ QUERY PLAN
+--------------------------------------
+ Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+(4 rows)
+
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.val = t2.val;
+ QUERY PLAN
+-------------------------------------------
+ Merge Join
+ Merge Cond: (t2.val = t1.val)
+ -> Index Scan using t2_val on t2
+ -> Materialize
+ -> Index Scan using t1_val on t1
+(5 rows)
+
+/*+ Test (t1 t2) */
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+INFO: hint syntax error at or near "Test (t1 t2) "
+DETAIL: Unrecognized hint keyword "Test".
+ QUERY PLAN
+--------------------------------------
+ Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+(4 rows)
+
+SET pg_hint_plan.enable_hint TO off;
+/*+ Test (t1 t2) */
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+ QUERY PLAN
+--------------------------------------
+ Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+(4 rows)
+
+SET pg_hint_plan.enable_hint TO on;
+/*Set(enable_indexscan off)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+ QUERY PLAN
+--------------------------------------
+ Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+(4 rows)
+
+--+Set(enable_indexscan off)
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+ QUERY PLAN
+--------------------------------------
+ Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+(4 rows)
+
+/*+Set(enable_indexscan off) /* nest comment */ */
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+INFO: hint syntax error at or near "/* nest comment */ */
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;"
+DETAIL: Nested block comments are not supported.
+ QUERY PLAN
+--------------------------------------
+ Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+(4 rows)
+
+/*+Set(enable_indexscan off)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.id = t2.id)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+/*+ Set(enable_indexscan off) Set(enable_hashjoin off) */
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_hashjoin off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------
+ Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Sort
+ Sort Key: t1.id
+ -> Seq Scan on t1
+ -> Sort
+ Sort Key: t2.id
+ -> Seq Scan on t2
+(8 rows)
+
+/*+ Set ( enable_indexscan off ) */
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.id = t2.id)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+/*+
+ Set
+ (
+ enable_indexscan
+ off
+ )
+ */
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.id = t2.id)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+/*+ Set(enable_indexscan off)Set(enable_nestloop off)Set(enable_mergejoin off)
+ Set(enable_seqscan off)
+ */
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_indexscan off)
+Set(enable_mergejoin off)
+Set(enable_nestloop off)
+Set(enable_seqscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------
+ Hash Join
+ Hash Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Hash
+ -> Index Scan using t2_pkey on t2
+(5 rows)
+
+/*+Set(work_mem "1M")*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+INFO: invalid value for parameter "work_mem": "1M"
+HINT: Valid units for this parameter are "kB", "MB", and "GB".
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+Set(work_mem 1M)
+
+ QUERY PLAN
+--------------------------------------
+ Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+(4 rows)
+
+/*+Set(work_mem "1MB")*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+LOG: pg_hint_plan:
+used hint:
+Set(work_mem 1MB)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------
+ Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+(4 rows)
+
+/*+Set(work_mem TO "1MB")*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+INFO: hint syntax error at or near ""1MB")"
+DETAIL: Closing parenthesis is necessary.
+ QUERY PLAN
+--------------------------------------
+ Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+(4 rows)
+
+/*+SeqScan(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+INFO: hint syntax error at or near "t2)"
+DETAIL: Closing parenthesis is necessary.
+ QUERY PLAN
+--------------------------------------
+ Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+(4 rows)
+
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.id = t2.id)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+/*+SeqScan(t1)IndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+IndexScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------
+ Hash Join
+ Hash Cond: (t1.id = t2.id)
+ -> Seq Scan on t1
+ -> Hash
+ -> Index Scan using t2_pkey on t2
+(5 rows)
+
+/*+BitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Seq Scan on t1
+ -> Bitmap Heap Scan on t2
+ Recheck Cond: (id = t1.id)
+ -> Bitmap Index Scan on t2_pkey
+ Index Cond: (id = t1.id)
+(6 rows)
+
+/*+BitmapScan(t2)NoSeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+LOG: pg_hint_plan:
+used hint:
+NoSeqScan(t1)
+BitmapScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Index Scan using t1_pkey on t1
+ -> Bitmap Heap Scan on t2
+ Recheck Cond: (id = t1.id)
+ -> Bitmap Index Scan on t2_pkey
+ Index Cond: (id = t1.id)
+(6 rows)
+
+/*+NoIndexScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+LOG: pg_hint_plan:
+used hint:
+NoIndexScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.id = t2.id)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+/*+NoBitmapScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t4 WHERE t1.val < 10;
+LOG: pg_hint_plan:
+used hint:
+NoBitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------
+ Nested Loop
+ -> Seq Scan on t1
+ Filter: (val < 10)
+ -> Materialize
+ -> Seq Scan on t4
+(5 rows)
+
+/*+TidScan(t4)*/
+EXPLAIN (COSTS false) SELECT * FROM t3, t4 WHERE t3.id = t4.id AND t4.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+TidScan(t4)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------
+ Merge Join
+ Merge Cond: (t3.id = t4.id)
+ -> Index Scan using t3_pkey on t3
+ -> Sort
+ Sort Key: t4.id
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(7 rows)
+
+/*+NoTidScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoTidScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------
+ Nested Loop
+ -> Seq Scan on t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t2_pkey on t2
+ Index Cond: (id = t1.id)
+(5 rows)
+
+/*+HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.id = t2.id)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+/*+NestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+LOG: pg_hint_plan:
+used hint:
+NestLoop(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------
+ Nested Loop
+ -> Seq Scan on t2
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id = t2.id)
+(4 rows)
+
+/*+NoMergeJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+LOG: pg_hint_plan:
+used hint:
+NoMergeJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.id = t2.id)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+/*+MergeJoin(t1 t3)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t3 WHERE t1.val = t3.val;
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(t1 t3)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------
+ Merge Join
+ Merge Cond: (t1.val = t3.val)
+ -> Index Scan using t1_val on t1
+ -> Sort
+ Sort Key: t3.val
+ -> Seq Scan on t3
+(6 rows)
+
+/*+NestLoop(t1 t3)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t3 WHERE t1.val = t3.val;
+LOG: pg_hint_plan:
+used hint:
+NestLoop(t1 t3)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------
+ Nested Loop
+ -> Seq Scan on t3
+ -> Index Scan using t1_val on t1
+ Index Cond: (val = t3.val)
+(4 rows)
+
+/*+NoHashJoin(t1 t3)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t3 WHERE t1.val = t3.val;
+LOG: pg_hint_plan:
+used hint:
+NoHashJoin(t1 t3)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------
+ Nested Loop
+ -> Seq Scan on t3
+ -> Index Scan using t1_val on t1
+ Index Cond: (val = t3.val)
+(4 rows)
+
+/*+MergeJoin(t4 t1 t2 t3)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(t1 t2 t3 t4)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.id = t4.id)
+ -> Merge Join
+ Merge Cond: (t1.id = t3.id)
+ -> Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+ -> Index Scan using t3_pkey on t3
+ -> Sort
+ Sort Key: t4.id
+ -> Seq Scan on t4
+(12 rows)
+
+/*+HashJoin(t3 t4 t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t1 t2 t3 t4)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------------
+ Hash Join
+ Hash Cond: (t3.id = t1.id)
+ -> Seq Scan on t3
+ -> Hash
+ -> Merge Join
+ Merge Cond: (t1.id = t4.id)
+ -> Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+ -> Sort
+ Sort Key: t4.id
+ -> Seq Scan on t4
+(13 rows)
+
+/*+NestLoop(t2 t3 t4 t1) IndexScan(t3)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
+LOG: pg_hint_plan:
+used hint:
+IndexScan(t3)
+NestLoop(t1 t2 t3 t4)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------
+ Nested Loop
+ -> Merge Join
+ Merge Cond: (t1.id = t4.id)
+ -> Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+ -> Sort
+ Sort Key: t4.id
+ -> Seq Scan on t4
+ -> Index Scan using t3_pkey on t3
+ Index Cond: (id = t1.id)
+(12 rows)
+
+/*+NoNestLoop(t4 t1 t3 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
+LOG: pg_hint_plan:
+used hint:
+NoNestLoop(t1 t2 t3 t4)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.id = t4.id)
+ -> Merge Join
+ Merge Cond: (t1.id = t3.id)
+ -> Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+ -> Index Scan using t3_pkey on t3
+ -> Sort
+ Sort Key: t4.id
+ -> Seq Scan on t4
+(12 rows)
+
+/*+Leading( */
+EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
+INFO: hint syntax error at or near ""
+DETAIL: Relation name is necessary.
+ QUERY PLAN
+--------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.id = t4.id)
+ -> Merge Join
+ Merge Cond: (t1.id = t3.id)
+ -> Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+ -> Index Scan using t3_pkey on t3
+ -> Sort
+ Sort Key: t4.id
+ -> Seq Scan on t4
+(12 rows)
+
+/*+Leading( )*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
+INFO: hint syntax error at or near "Leading( )"
+DETAIL: Leading hint requires at least two relations.
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+Leading()
+
+ QUERY PLAN
+--------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.id = t4.id)
+ -> Merge Join
+ Merge Cond: (t1.id = t3.id)
+ -> Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+ -> Index Scan using t3_pkey on t3
+ -> Sort
+ Sort Key: t4.id
+ -> Seq Scan on t4
+(12 rows)
+
+/*+Leading( t3 )*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
+INFO: hint syntax error at or near "Leading( t3 )"
+DETAIL: Leading hint requires at least two relations.
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+Leading(t3)
+
+ QUERY PLAN
+--------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.id = t4.id)
+ -> Merge Join
+ Merge Cond: (t1.id = t3.id)
+ -> Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+ -> Index Scan using t3_pkey on t3
+ -> Sort
+ Sort Key: t4.id
+ -> Seq Scan on t4
+(12 rows)
+
+/*+Leading( t3 t4 )*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
+LOG: pg_hint_plan:
+used hint:
+Leading(t3 t4)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------
+ Nested Loop
+ -> Nested Loop
+ -> Merge Join
+ Merge Cond: (t3.id = t4.id)
+ -> Index Scan using t3_pkey on t3
+ -> Sort
+ Sort Key: t4.id
+ -> Seq Scan on t4
+ -> Index Scan using t2_pkey on t2
+ Index Cond: (id = t3.id)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id = t2.id)
+(12 rows)
+
+/*+Leading(t3 t4 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
+LOG: pg_hint_plan:
+used hint:
+Leading(t3 t4 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------
+ Nested Loop
+ -> Merge Join
+ Merge Cond: (t3.id = t1.id)
+ -> Merge Join
+ Merge Cond: (t3.id = t4.id)
+ -> Index Scan using t3_pkey on t3
+ -> Sort
+ Sort Key: t4.id
+ -> Seq Scan on t4
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+ Index Cond: (id = t1.id)
+(12 rows)
+
+/*+Leading(t3 t4 t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
+LOG: pg_hint_plan:
+used hint:
+Leading(t3 t4 t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------
+ Nested Loop
+ -> Merge Join
+ Merge Cond: (t3.id = t1.id)
+ -> Merge Join
+ Merge Cond: (t3.id = t4.id)
+ -> Index Scan using t3_pkey on t3
+ -> Sort
+ Sort Key: t4.id
+ -> Seq Scan on t4
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+ Index Cond: (id = t1.id)
+(12 rows)
+
+/*+Leading(t3 t4 t1 t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
+LOG: pg_hint_plan:
+used hint:
+Leading(t3 t4 t1 t2 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------
+ Nested Loop
+ -> Merge Join
+ Merge Cond: (t3.id = t1.id)
+ -> Merge Join
+ Merge Cond: (t3.id = t4.id)
+ -> Index Scan using t3_pkey on t3
+ -> Sort
+ Sort Key: t4.id
+ -> Seq Scan on t4
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+ Index Cond: (id = t1.id)
+(12 rows)
+
+/*+Leading(t3 t4 t4)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
+INFO: hint syntax error at or near "Leading(t3 t4 t4)"
+DETAIL: Relation name "t4" is duplicated.
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+Leading(t3 t4 t4)
+
+ QUERY PLAN
+--------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.id = t4.id)
+ -> Merge Join
+ Merge Cond: (t1.id = t3.id)
+ -> Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+ -> Index Scan using t3_pkey on t3
+ -> Sort
+ Sort Key: t4.id
+ -> Seq Scan on t4
+(12 rows)
+
+EXPLAIN (COSTS false) SELECT * FROM t1, (VALUES(1,1),(2,2),(3,3)) AS t2(id,val) WHERE t1.id = t2.id;
+ QUERY PLAN
+-----------------------------------------------
+ Nested Loop
+ -> Values Scan on "*VALUES*"
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id = "*VALUES*".column1)
+(4 rows)
+
+/*+HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, (VALUES(1,1),(2,2),(3,3)) AS t2(id,val) WHERE t1.id = t2.id;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+HashJoin(t1 t2)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------
+ Nested Loop
+ -> Values Scan on "*VALUES*"
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id = "*VALUES*".column1)
+(4 rows)
+
+/*+HashJoin(t1 *VALUES*)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, (VALUES(1,1),(2,2),(3,3)) AS t2(id,val) WHERE t1.id = t2.id;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(*VALUES* t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------
+ Hash Join
+ Hash Cond: (t1.id = "*VALUES*".column1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Values Scan on "*VALUES*"
+(5 rows)
+
+/*+HashJoin(t1 *VALUES*) IndexScan(t1) IndexScan(*VALUES*)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, (VALUES(1,1),(2,2),(3,3)) AS t2(id,val) WHERE t1.id = t2.id;
+LOG: pg_hint_plan:
+used hint:
+IndexScan(t1)
+HashJoin(*VALUES* t1)
+not used hint:
+IndexScan(*VALUES*)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------
+ Hash Join
+ Hash Cond: (t1.id = "*VALUES*".column1)
+ -> Index Scan using t1_pkey on t1
+ -> Hash
+ -> Values Scan on "*VALUES*"
+(5 rows)
+
+-- single table scan hint test
+EXPLAIN SELECT (SELECT max(id) FROM t1 v_1 WHERE id < 10), id FROM v1 WHERE v1.id = (SELECT max(id) FROM t1 v_2 WHERE id < 10);
+ QUERY PLAN
+-----------------------------------------------------------------------------------------------------
+ Index Scan using t1_pkey on t1 (cost=1.89..10.16 rows=1 width=4)
+ Index Cond: (id = $3)
+ InitPlan 2 (returns $1)
+ -> Result (cost=0.94..0.95 rows=1 width=0)
+ InitPlan 1 (returns $0)
+ -> Limit (cost=0.00..0.94 rows=1 width=4)
+ -> Index Scan Backward using t1_pkey on t1 v_1 (cost=0.00..8.43 rows=9 width=4)
+ Index Cond: ((id IS NOT NULL) AND (id < 10))
+ InitPlan 4 (returns $3)
+ -> Result (cost=0.94..0.95 rows=1 width=0)
+ InitPlan 3 (returns $2)
+ -> Limit (cost=0.00..0.94 rows=1 width=4)
+ -> Index Scan Backward using t1_pkey on t1 v_2 (cost=0.00..8.43 rows=9 width=4)
+ Index Cond: ((id IS NOT NULL) AND (id < 10))
+(14 rows)
+
+/*+BitmapScan(v_1)*/
+EXPLAIN SELECT (SELECT max(id) FROM t1 v_1 WHERE id < 10), id FROM v1 WHERE v1.id = (SELECT max(id) FROM t1 v_2 WHERE id < 10);
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(v_1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------------------------------
+ Index Scan using t1_pkey on t1 (cost=29.34..37.61 rows=1 width=4)
+ Index Cond: (id = $2)
+ InitPlan 1 (returns $0)
+ -> Aggregate (cost=28.38..28.39 rows=1 width=4)
+ -> Bitmap Heap Scan on t1 v_1 (cost=4.32..28.36 rows=9 width=4)
+ Recheck Cond: (id < 10)
+ -> Bitmap Index Scan on t1_pkey (cost=0.00..4.32 rows=9 width=0)
+ Index Cond: (id < 10)
+ InitPlan 3 (returns $2)
+ -> Result (cost=0.94..0.95 rows=1 width=0)
+ InitPlan 2 (returns $1)
+ -> Limit (cost=0.00..0.94 rows=1 width=4)
+ -> Index Scan Backward using t1_pkey on t1 v_2 (cost=0.00..8.43 rows=9 width=4)
+ Index Cond: ((id IS NOT NULL) AND (id < 10))
+(14 rows)
+
+/*+BitmapScan(v_2)*/
+EXPLAIN SELECT (SELECT max(id) FROM t1 v_1 WHERE id < 10), id FROM v1 WHERE v1.id = (SELECT max(id) FROM t1 v_2 WHERE id < 10);
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(v_2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------------------------------
+ Index Scan using t1_pkey on t1 (cost=29.34..37.61 rows=1 width=4)
+ Index Cond: (id = $2)
+ InitPlan 2 (returns $1)
+ -> Result (cost=0.94..0.95 rows=1 width=0)
+ InitPlan 1 (returns $0)
+ -> Limit (cost=0.00..0.94 rows=1 width=4)
+ -> Index Scan Backward using t1_pkey on t1 v_1 (cost=0.00..8.43 rows=9 width=4)
+ Index Cond: ((id IS NOT NULL) AND (id < 10))
+ InitPlan 3 (returns $2)
+ -> Aggregate (cost=28.38..28.39 rows=1 width=4)
+ -> Bitmap Heap Scan on t1 v_2 (cost=4.32..28.36 rows=9 width=4)
+ Recheck Cond: (id < 10)
+ -> Bitmap Index Scan on t1_pkey (cost=0.00..4.32 rows=9 width=0)
+ Index Cond: (id < 10)
+(14 rows)
+
+/*+BitmapScan(t1)*/
+EXPLAIN SELECT (SELECT max(id) FROM t1 v_1 WHERE id < 10), id FROM v1 WHERE v1.id = (SELECT max(id) FROM t1 v_2 WHERE id < 10);
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------------------------------
+ Bitmap Heap Scan on t1 (cost=6.15..10.17 rows=1 width=4)
+ Recheck Cond: (id = $3)
+ InitPlan 2 (returns $1)
+ -> Result (cost=0.94..0.95 rows=1 width=0)
+ InitPlan 1 (returns $0)
+ -> Limit (cost=0.00..0.94 rows=1 width=4)
+ -> Index Scan Backward using t1_pkey on t1 v_1 (cost=0.00..8.43 rows=9 width=4)
+ Index Cond: ((id IS NOT NULL) AND (id < 10))
+ InitPlan 4 (returns $3)
+ -> Result (cost=0.94..0.95 rows=1 width=0)
+ InitPlan 3 (returns $2)
+ -> Limit (cost=0.00..0.94 rows=1 width=4)
+ -> Index Scan Backward using t1_pkey on t1 v_2 (cost=0.00..8.43 rows=9 width=4)
+ Index Cond: ((id IS NOT NULL) AND (id < 10))
+ -> Bitmap Index Scan on t1_pkey (cost=0.00..4.26 rows=1 width=0)
+ Index Cond: (id = $3)
+(16 rows)
+
+/*+BitmapScan(v_1)BitmapScan(v_2)*/
+EXPLAIN SELECT (SELECT max(id) FROM t1 v_1 WHERE id < 10), id FROM v1 WHERE v1.id = (SELECT max(id) FROM t1 v_2 WHERE id < 10);
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(v_1)
+BitmapScan(v_2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------------------------------------
+ Index Scan using t1_pkey on t1 (cost=56.78..65.05 rows=1 width=4)
+ Index Cond: (id = $1)
+ InitPlan 1 (returns $0)
+ -> Aggregate (cost=28.38..28.39 rows=1 width=4)
+ -> Bitmap Heap Scan on t1 v_1 (cost=4.32..28.36 rows=9 width=4)
+ Recheck Cond: (id < 10)
+ -> Bitmap Index Scan on t1_pkey (cost=0.00..4.32 rows=9 width=0)
+ Index Cond: (id < 10)
+ InitPlan 2 (returns $1)
+ -> Aggregate (cost=28.38..28.39 rows=1 width=4)
+ -> Bitmap Heap Scan on t1 v_2 (cost=4.32..28.36 rows=9 width=4)
+ Recheck Cond: (id < 10)
+ -> Bitmap Index Scan on t1_pkey (cost=0.00..4.32 rows=9 width=0)
+ Index Cond: (id < 10)
+(14 rows)
+
+/*+BitmapScan(v_1)BitmapScan(t1)*/
+EXPLAIN SELECT (SELECT max(id) FROM t1 v_1 WHERE id < 10), id FROM v1 WHERE v1.id = (SELECT max(id) FROM t1 v_2 WHERE id < 10);
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+BitmapScan(v_1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------------------------------
+ Bitmap Heap Scan on t1 (cost=33.60..37.61 rows=1 width=4)
+ Recheck Cond: (id = $2)
+ InitPlan 1 (returns $0)
+ -> Aggregate (cost=28.38..28.39 rows=1 width=4)
+ -> Bitmap Heap Scan on t1 v_1 (cost=4.32..28.36 rows=9 width=4)
+ Recheck Cond: (id < 10)
+ -> Bitmap Index Scan on t1_pkey (cost=0.00..4.32 rows=9 width=0)
+ Index Cond: (id < 10)
+ InitPlan 3 (returns $2)
+ -> Result (cost=0.94..0.95 rows=1 width=0)
+ InitPlan 2 (returns $1)
+ -> Limit (cost=0.00..0.94 rows=1 width=4)
+ -> Index Scan Backward using t1_pkey on t1 v_2 (cost=0.00..8.43 rows=9 width=4)
+ Index Cond: ((id IS NOT NULL) AND (id < 10))
+ -> Bitmap Index Scan on t1_pkey (cost=0.00..4.26 rows=1 width=0)
+ Index Cond: (id = $2)
+(16 rows)
+
+/*+BitmapScan(v_2)BitmapScan(t1)*/
+EXPLAIN SELECT (SELECT max(id) FROM t1 v_1 WHERE id < 10), id FROM v1 WHERE v1.id = (SELECT max(id) FROM t1 v_2 WHERE id < 10);
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+BitmapScan(v_2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------------------------------
+ Bitmap Heap Scan on t1 (cost=33.60..37.61 rows=1 width=4)
+ Recheck Cond: (id = $2)
+ InitPlan 2 (returns $1)
+ -> Result (cost=0.94..0.95 rows=1 width=0)
+ InitPlan 1 (returns $0)
+ -> Limit (cost=0.00..0.94 rows=1 width=4)
+ -> Index Scan Backward using t1_pkey on t1 v_1 (cost=0.00..8.43 rows=9 width=4)
+ Index Cond: ((id IS NOT NULL) AND (id < 10))
+ InitPlan 3 (returns $2)
+ -> Aggregate (cost=28.38..28.39 rows=1 width=4)
+ -> Bitmap Heap Scan on t1 v_2 (cost=4.32..28.36 rows=9 width=4)
+ Recheck Cond: (id < 10)
+ -> Bitmap Index Scan on t1_pkey (cost=0.00..4.32 rows=9 width=0)
+ Index Cond: (id < 10)
+ -> Bitmap Index Scan on t1_pkey (cost=0.00..4.26 rows=1 width=0)
+ Index Cond: (id = $2)
+(16 rows)
+
+/*+BitmapScan(v_1)BitmapScan(v_2)BitmapScan(t1)*/
+EXPLAIN SELECT (SELECT max(id) FROM t1 v_1 WHERE id < 10), id FROM v1 WHERE v1.id = (SELECT max(id) FROM t1 v_2 WHERE id < 10);
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+BitmapScan(v_1)
+BitmapScan(v_2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------------------------------------
+ Bitmap Heap Scan on t1 (cost=61.04..65.05 rows=1 width=4)
+ Recheck Cond: (id = $1)
+ InitPlan 1 (returns $0)
+ -> Aggregate (cost=28.38..28.39 rows=1 width=4)
+ -> Bitmap Heap Scan on t1 v_1 (cost=4.32..28.36 rows=9 width=4)
+ Recheck Cond: (id < 10)
+ -> Bitmap Index Scan on t1_pkey (cost=0.00..4.32 rows=9 width=0)
+ Index Cond: (id < 10)
+ InitPlan 2 (returns $1)
+ -> Aggregate (cost=28.38..28.39 rows=1 width=4)
+ -> Bitmap Heap Scan on t1 v_2 (cost=4.32..28.36 rows=9 width=4)
+ Recheck Cond: (id < 10)
+ -> Bitmap Index Scan on t1_pkey (cost=0.00..4.32 rows=9 width=0)
+ Index Cond: (id < 10)
+ -> Bitmap Index Scan on t1_pkey (cost=0.00..4.26 rows=1 width=0)
+ Index Cond: (id = $1)
+(16 rows)
+
+-- full scan hint pattern test
+EXPLAIN (COSTS false) SELECT * FROM t1 WHERE id < 10 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (id < 10)
+(3 rows)
+
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1 WHERE id < 10 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------
+ Seq Scan on t1
+ Filter: ((id < 10) AND (ctid = '(1,1)'::tid))
+(2 rows)
+
+/*+IndexScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1 WHERE id < 10 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------
+ Index Scan using t1_pkey on t1
+ Index Cond: (id < 10)
+ Filter: (ctid = '(1,1)'::tid)
+(3 rows)
+
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1 WHERE id < 10 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (id < 10)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: (id < 10)
+(5 rows)
+
+/*+TidScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1 WHERE id < 10 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+TidScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (id < 10)
+(3 rows)
+
+/*+NoSeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1 WHERE id < 10 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoSeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (id < 10)
+(3 rows)
+
+/*+NoIndexScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1 WHERE id < 10 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoIndexScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (id < 10)
+(3 rows)
+
+/*+NoBitmapScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1 WHERE id < 10 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoBitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (id < 10)
+(3 rows)
+
+/*+NoTidScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1 WHERE id < 10 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoTidScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------
+ Index Scan using t1_pkey on t1
+ Index Cond: (id < 10)
+ Filter: (ctid = '(1,1)'::tid)
+(3 rows)
+
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Seq Scan on t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+SeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+SeqScan(t1) SeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+SeqScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Seq Scan on t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+SeqScan(t1) IndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+IndexScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------
+ Nested Loop
+ -> Seq Scan on t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t2_pkey on t2
+ Index Cond: (id = t1.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+SeqScan(t1) BitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+BitmapScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Seq Scan on t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t2
+ Recheck Cond: (id = t1.id)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t2_pkey
+ Index Cond: (id = t1.id)
+(8 rows)
+
+/*+SeqScan(t1) TidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+TidScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Seq Scan on t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+SeqScan(t1) NoSeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+NoSeqScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Seq Scan on t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+SeqScan(t1) NoIndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+NoIndexScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Seq Scan on t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+SeqScan(t1) NoBitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+NoBitmapScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Seq Scan on t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+SeqScan(t1) NoTidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+NoTidScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------
+ Nested Loop
+ -> Seq Scan on t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t2_pkey on t2
+ Index Cond: (id = t1.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+IndexScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+IndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Index Scan using t2_pkey on t2
+ Index Cond: (id = t1.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+IndexScan(t1) SeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(t1)
+SeqScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------
+ Nested Loop
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+IndexScan(t1) IndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(t1)
+IndexScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------
+ Nested Loop
+ -> Index Scan using t2_pkey on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+IndexScan(t1) BitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(t1)
+BitmapScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Index Scan using t1_pkey on t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t2
+ Recheck Cond: (id = t1.id)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t2_pkey
+ Index Cond: (id = t1.id)
+(8 rows)
+
+/*+IndexScan(t1) TidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(t1)
+TidScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+IndexScan(t1) NoSeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(t1)
+NoSeqScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+IndexScan(t1) NoIndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(t1)
+NoIndexScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+IndexScan(t1) NoBitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(t1)
+NoBitmapScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+IndexScan(t1) NoTidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(t1)
+NoTidScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------
+ Nested Loop
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t1
+ Recheck Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: (id = t2.id)
+(8 rows)
+
+/*+BitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t2
+ Recheck Cond: (id = t1.id)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t2_pkey
+ Index Cond: (id = t1.id)
+(8 rows)
+
+/*+BitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t2
+ Recheck Cond: (id = t1.id)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t2_pkey
+ Index Cond: (id = t1.id)
+(8 rows)
+
+/*+BitmapScan(t1) SeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+SeqScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t1
+ Recheck Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: (id = t2.id)
+(8 rows)
+
+/*+BitmapScan(t1) IndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+IndexScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Index Scan using t2_pkey on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t1
+ Recheck Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: (id = t2.id)
+(8 rows)
+
+/*+BitmapScan(t1) BitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+BitmapScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Index Scan using t2_pkey on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t1
+ Recheck Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: (id = t2.id)
+(8 rows)
+
+/*+BitmapScan(t1) TidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+TidScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t1
+ Recheck Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: (id = t2.id)
+(8 rows)
+
+/*+BitmapScan(t1) NoSeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+NoSeqScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t1
+ Recheck Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: (id = t2.id)
+(8 rows)
+
+/*+BitmapScan(t1) NoIndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+NoIndexScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t1
+ Recheck Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: (id = t2.id)
+(8 rows)
+
+/*+BitmapScan(t1) NoBitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+NoBitmapScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t1
+ Recheck Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: (id = t2.id)
+(8 rows)
+
+/*+BitmapScan(t1) NoTidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+NoTidScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t1
+ Recheck Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: (id = t2.id)
+(8 rows)
+
+/*+TidScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+TidScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+TidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+TidScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+TidScan(t1) SeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+TidScan(t1)
+SeqScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+TidScan(t1) IndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+TidScan(t1)
+IndexScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Index Scan using t2_pkey on t2
+ Index Cond: (id = t1.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+TidScan(t1) BitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+TidScan(t1)
+BitmapScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t2
+ Recheck Cond: (id = t1.id)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t2_pkey
+ Index Cond: (id = t1.id)
+(8 rows)
+
+/*+TidScan(t1) TidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+TidScan(t1)
+TidScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+TidScan(t1) NoSeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+TidScan(t1)
+NoSeqScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+TidScan(t1) NoIndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+TidScan(t1)
+NoIndexScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+TidScan(t1) NoBitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+TidScan(t1)
+NoBitmapScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+TidScan(t1) NoTidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+TidScan(t1)
+NoTidScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Index Scan using t2_pkey on t2
+ Index Cond: (id = t1.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoSeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoSeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoSeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoSeqScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoSeqScan(t1) SeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoSeqScan(t1)
+SeqScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoSeqScan(t1) IndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoSeqScan(t1)
+IndexScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Index Scan using t2_pkey on t2
+ Index Cond: (id = t1.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoSeqScan(t1) BitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoSeqScan(t1)
+BitmapScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t2
+ Recheck Cond: (id = t1.id)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t2_pkey
+ Index Cond: (id = t1.id)
+(8 rows)
+
+/*+NoSeqScan(t1) TidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoSeqScan(t1)
+TidScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoSeqScan(t1) NoSeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoSeqScan(t1)
+NoSeqScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoSeqScan(t1) NoIndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoSeqScan(t1)
+NoIndexScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoSeqScan(t1) NoBitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoSeqScan(t1)
+NoBitmapScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoSeqScan(t1) NoTidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoSeqScan(t1)
+NoTidScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Index Scan using t2_pkey on t2
+ Index Cond: (id = t1.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoIndexScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoIndexScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoIndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoIndexScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoIndexScan(t1) SeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoIndexScan(t1)
+SeqScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoIndexScan(t1) IndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoIndexScan(t1)
+IndexScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Index Scan using t2_pkey on t2
+ Index Cond: (id = t1.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoIndexScan(t1) BitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoIndexScan(t1)
+BitmapScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t2
+ Recheck Cond: (id = t1.id)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t2_pkey
+ Index Cond: (id = t1.id)
+(8 rows)
+
+/*+NoIndexScan(t1) TidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoIndexScan(t1)
+TidScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoIndexScan(t1) NoSeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoIndexScan(t1)
+NoSeqScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoIndexScan(t1) NoIndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoIndexScan(t1)
+NoIndexScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoIndexScan(t1) NoBitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoIndexScan(t1)
+NoBitmapScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoIndexScan(t1) NoTidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoIndexScan(t1)
+NoTidScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Index Scan using t2_pkey on t2
+ Index Cond: (id = t1.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoBitmapScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoBitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoBitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoBitmapScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoBitmapScan(t1) SeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoBitmapScan(t1)
+SeqScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoBitmapScan(t1) IndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoBitmapScan(t1)
+IndexScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Index Scan using t2_pkey on t2
+ Index Cond: (id = t1.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoBitmapScan(t1) BitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoBitmapScan(t1)
+BitmapScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t2
+ Recheck Cond: (id = t1.id)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t2_pkey
+ Index Cond: (id = t1.id)
+(8 rows)
+
+/*+NoBitmapScan(t1) TidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoBitmapScan(t1)
+TidScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoBitmapScan(t1) NoSeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoBitmapScan(t1)
+NoSeqScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoBitmapScan(t1) NoIndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoBitmapScan(t1)
+NoIndexScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoBitmapScan(t1) NoBitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoBitmapScan(t1)
+NoBitmapScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoBitmapScan(t1) NoTidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoBitmapScan(t1)
+NoTidScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Index Scan using t2_pkey on t2
+ Index Cond: (id = t1.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoTidScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoTidScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoTidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoTidScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Index Scan using t2_pkey on t2
+ Index Cond: (id = t1.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoTidScan(t1) SeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoTidScan(t1)
+SeqScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------
+ Nested Loop
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoTidScan(t1) IndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoTidScan(t1)
+IndexScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------
+ Nested Loop
+ -> Index Scan using t2_pkey on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoTidScan(t1) BitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoTidScan(t1)
+BitmapScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Seq Scan on t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t2
+ Recheck Cond: (id = t1.id)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t2_pkey
+ Index Cond: (id = t1.id)
+(8 rows)
+
+/*+NoTidScan(t1) TidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoTidScan(t1)
+TidScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoTidScan(t1) NoSeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoTidScan(t1)
+NoSeqScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoTidScan(t1) NoIndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoTidScan(t1)
+NoIndexScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoTidScan(t1) NoBitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoTidScan(t1)
+NoBitmapScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoTidScan(t1) NoTidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoTidScan(t1)
+NoTidScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------
+ Nested Loop
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+-- additional test
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)' AND t1.id < 10 AND t2.id < 10;
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (id < 10)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (id < 10)
+(8 rows)
+
+/*+BitmapScan(t1) BitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)' AND t1.id < 10 AND t2.id < 10;
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+BitmapScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------------
+ Nested Loop
+ -> Bitmap Heap Scan on t2
+ Recheck Cond: (id < 10)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t2_pkey
+ Index Cond: (id < 10)
+ -> Bitmap Heap Scan on t1
+ Recheck Cond: ((id < 10) AND (id = t2.id))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: ((id < 10) AND (id = t2.id))
+(11 rows)
+
+-- outer join test
+EXPLAIN (COSTS false) SELECT * FROM t1 FULL OUTER JOIN t2 ON (t1.id = t2.id);
+ QUERY PLAN
+------------------------------
+ Hash Full Join
+ Hash Cond: (t1.id = t2.id)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+/*+MergeJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1 FULL OUTER JOIN t2 ON (t1.id = t2.id);
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------
+ Merge Full Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+(4 rows)
+
+/*+NestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1 FULL OUTER JOIN t2 ON (t1.id = t2.id);
+LOG: pg_hint_plan:
+used hint:
+NestLoop(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Hash Full Join
+ Hash Cond: (t1.id = t2.id)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+-- inherite table test
+SET constraint_exclusion TO off;
+EXPLAIN (COSTS false) SELECT * FROM p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------------------
+ Result
+ -> Append
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c2 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c3 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Tid Scan on p1_c4 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c3_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c3_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+(25 rows)
+
+SET constraint_exclusion TO on;
+EXPLAIN (COSTS false) SELECT * FROM p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------------------
+ Result
+ -> Append
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Tid Scan on p1_c1_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+(12 rows)
+
+SET constraint_exclusion TO off;
+/*+SeqScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+SeqScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------
+ Result
+ -> Append
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c2 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c3 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c4 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1_c1 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1_c2 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c3_c1 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c3_c2 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+(20 rows)
+
+/*+IndexScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------
+ Result
+ -> Append
+ -> Index Scan using p1_pkey on p1
+ Index Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using p1_c1_pkey on p1_c1 p1
+ Index Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using p1_c2_pkey on p1_c2 p1
+ Index Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using p1_c3_pkey on p1_c3 p1
+ Index Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using p1_c4_pkey on p1_c4 p1
+ Index Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using p1_c1_c1_pkey on p1_c1_c1 p1
+ Index Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using p1_c1_c2_pkey on p1_c1_c2 p1
+ Index Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using p1_c3_c1_pkey on p1_c3_c1 p1
+ Index Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using p1_c3_c2_pkey on p1_c3_c2 p1
+ Index Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+(29 rows)
+
+/*+BitmapScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------------
+ Result
+ -> Append
+ -> Bitmap Heap Scan on p1
+ Recheck Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on p1_pkey
+ Index Cond: ((id >= 50) AND (id <= 51))
+ -> Bitmap Heap Scan on p1_c1 p1
+ Recheck Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on p1_c1_pkey
+ Index Cond: ((id >= 50) AND (id <= 51))
+ -> Bitmap Heap Scan on p1_c2 p1
+ Recheck Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on p1_c2_pkey
+ Index Cond: ((id >= 50) AND (id <= 51))
+ -> Bitmap Heap Scan on p1_c3 p1
+ Recheck Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on p1_c3_pkey
+ Index Cond: ((id >= 50) AND (id <= 51))
+ -> Bitmap Heap Scan on p1_c4 p1
+ Recheck Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on p1_c4_pkey
+ Index Cond: ((id >= 50) AND (id <= 51))
+ -> Bitmap Heap Scan on p1_c1_c1 p1
+ Recheck Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on p1_c1_c1_pkey
+ Index Cond: ((id >= 50) AND (id <= 51))
+ -> Bitmap Heap Scan on p1_c1_c2 p1
+ Recheck Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on p1_c1_c2_pkey
+ Index Cond: ((id >= 50) AND (id <= 51))
+ -> Bitmap Heap Scan on p1_c3_c1 p1
+ Recheck Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on p1_c3_c1_pkey
+ Index Cond: ((id >= 50) AND (id <= 51))
+ -> Bitmap Heap Scan on p1_c3_c2 p1
+ Recheck Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on p1_c3_c2_pkey
+ Index Cond: ((id >= 50) AND (id <= 51))
+(47 rows)
+
+/*+TidScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+TidScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------
+ Result
+ -> Append
+ -> Tid Scan on p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c3 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c4 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c3_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c3_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+(29 rows)
+
+SET constraint_exclusion TO on;
+/*+SeqScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+SeqScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------
+ Result
+ -> Append
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1_c1 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1_c2 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+(10 rows)
+
+/*+IndexScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------
+ Result
+ -> Append
+ -> Index Scan using p1_pkey on p1
+ Index Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using p1_c1_pkey on p1_c1 p1
+ Index Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using p1_c1_c1_pkey on p1_c1_c1 p1
+ Index Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using p1_c1_c2_pkey on p1_c1_c2 p1
+ Index Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+(14 rows)
+
+/*+BitmapScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------------
+ Result
+ -> Append
+ -> Bitmap Heap Scan on p1
+ Recheck Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on p1_pkey
+ Index Cond: ((id >= 50) AND (id <= 51))
+ -> Bitmap Heap Scan on p1_c1 p1
+ Recheck Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on p1_c1_pkey
+ Index Cond: ((id >= 50) AND (id <= 51))
+ -> Bitmap Heap Scan on p1_c1_c1 p1
+ Recheck Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on p1_c1_c1_pkey
+ Index Cond: ((id >= 50) AND (id <= 51))
+ -> Bitmap Heap Scan on p1_c1_c2 p1
+ Recheck Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on p1_c1_c2_pkey
+ Index Cond: ((id >= 50) AND (id <= 51))
+(22 rows)
+
+/*+TidScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+TidScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------
+ Result
+ -> Append
+ -> Tid Scan on p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+(14 rows)
+
+SET constraint_exclusion TO off;
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+ QUERY PLAN
+-----------------------------------------------------------------------------------
+ Merge Join
+ Merge Cond: (public.p1.id = t1.id)
+ -> Sort
+ Sort Key: public.p1.id
+ -> Append
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c2 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c3 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Tid Scan on p1_c4 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c3_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c3_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id < 10)
+(30 rows)
+
+SET constraint_exclusion TO on;
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+ QUERY PLAN
+-----------------------------------------------------------------------------------
+ Merge Join
+ Merge Cond: (public.p1.id = t1.id)
+ -> Sort
+ Sort Key: public.p1.id
+ -> Append
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Tid Scan on p1_c1_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id < 10)
+(17 rows)
+
+SET constraint_exclusion TO off;
+/*+SeqScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------------
+ Merge Join
+ Merge Cond: (public.p1.id = t1.id)
+ -> Sort
+ Sort Key: public.p1.id
+ -> Append
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c2 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c3 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Tid Scan on p1_c4 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c3_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c3_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id < 10)
+(30 rows)
+
+/*+IndexScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+IndexScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------------
+ Merge Join
+ Merge Cond: (public.p1.id = t1.id)
+ -> Sort
+ Sort Key: public.p1.id
+ -> Append
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c2 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c3 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Tid Scan on p1_c4 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c3_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c3_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id < 10)
+(30 rows)
+
+/*+BitmapScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------------
+ Merge Join
+ Merge Cond: (public.p1.id = t1.id)
+ -> Sort
+ Sort Key: public.p1.id
+ -> Append
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c2 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c3 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Tid Scan on p1_c4 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c3_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c3_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id < 10)
+(30 rows)
+
+/*+TidScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+TidScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------------
+ Merge Join
+ Merge Cond: (public.p1.id = t1.id)
+ -> Sort
+ Sort Key: public.p1.id
+ -> Append
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c2 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c3 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Tid Scan on p1_c4 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c3_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c3_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id < 10)
+(30 rows)
+
+/*+NestLoop(p1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+NestLoop(p1 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------
+ Nested Loop
+ Join Filter: (public.p1.id = t1.id)
+ -> Append
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c2 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c3 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Tid Scan on p1_c4 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c3_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c3_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Materialize
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id < 10)
+(29 rows)
+
+/*+MergeJoin(p1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(p1 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------------
+ Merge Join
+ Merge Cond: (public.p1.id = t1.id)
+ -> Sort
+ Sort Key: public.p1.id
+ -> Append
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c2 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c3 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Tid Scan on p1_c4 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c3_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c3_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id < 10)
+(30 rows)
+
+/*+HashJoin(p1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(p1 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------
+ Hash Join
+ Hash Cond: (public.p1.id = t1.id)
+ -> Append
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c2 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c3 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Tid Scan on p1_c4 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c3_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c3_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Hash
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id < 10)
+(29 rows)
+
+SET constraint_exclusion TO on;
+/*+SeqScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------------
+ Merge Join
+ Merge Cond: (public.p1.id = t1.id)
+ -> Sort
+ Sort Key: public.p1.id
+ -> Append
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Tid Scan on p1_c1_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id < 10)
+(17 rows)
+
+/*+IndexScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+IndexScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------------
+ Merge Join
+ Merge Cond: (public.p1.id = t1.id)
+ -> Sort
+ Sort Key: public.p1.id
+ -> Append
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Tid Scan on p1_c1_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id < 10)
+(17 rows)
+
+/*+BitmapScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------------
+ Merge Join
+ Merge Cond: (public.p1.id = t1.id)
+ -> Sort
+ Sort Key: public.p1.id
+ -> Append
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Tid Scan on p1_c1_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id < 10)
+(17 rows)
+
+/*+TidScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+TidScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------------
+ Merge Join
+ Merge Cond: (public.p1.id = t1.id)
+ -> Sort
+ Sort Key: public.p1.id
+ -> Append
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Tid Scan on p1_c1_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id < 10)
+(17 rows)
+
+/*+NestLoop(p1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+NestLoop(p1 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------------
+ Nested Loop
+ Join Filter: (public.p1.id = t1.id)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id < 10)
+ -> Materialize
+ -> Append
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Tid Scan on p1_c1_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+(16 rows)
+
+/*+MergeJoin(p1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(p1 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------------
+ Merge Join
+ Merge Cond: (public.p1.id = t1.id)
+ -> Sort
+ Sort Key: public.p1.id
+ -> Append
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Tid Scan on p1_c1_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id < 10)
+(17 rows)
+
+/*+HashJoin(p1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(p1 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------------
+ Hash Join
+ Hash Cond: (t1.id = public.p1.id)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id < 10)
+ -> Hash
+ -> Append
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Tid Scan on p1_c1_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+(16 rows)
+
+SET constraint_exclusion TO off;
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+(2 rows)
+
+SET constraint_exclusion TO on;
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+(2 rows)
+
+SET constraint_exclusion TO off;
+/*+SeqScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+SeqScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------
+ Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+(2 rows)
+
+/*+IndexScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------
+ Index Scan using p1_pkey on p1
+ Index Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+(3 rows)
+
+/*+BitmapScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------
+ Bitmap Heap Scan on p1
+ Recheck Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on p1_pkey
+ Index Cond: ((id >= 50) AND (id <= 51))
+(5 rows)
+
+/*+TidScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+TidScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------
+ Tid Scan on p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+(3 rows)
+
+/*+NestLoop(p1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+NestLoop(p1 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------
+ Nested Loop
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: ((id < 10) AND (id = p1.id))
+(5 rows)
+
+/*+MergeJoin(p1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(p1 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------
+ Merge Join
+ Merge Cond: (p1.id = t1.id)
+ -> Sort
+ Sort Key: p1.id
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id < 10)
+(8 rows)
+
+/*+HashJoin(p1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(p1 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------
+ Hash Join
+ Hash Cond: (t1.id = p1.id)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id < 10)
+ -> Hash
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+(7 rows)
+
+SET constraint_exclusion TO on;
+/*+SeqScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+SeqScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------
+ Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+(2 rows)
+
+/*+IndexScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------
+ Index Scan using p1_pkey on p1
+ Index Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+(3 rows)
+
+/*+BitmapScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------
+ Bitmap Heap Scan on p1
+ Recheck Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on p1_pkey
+ Index Cond: ((id >= 50) AND (id <= 51))
+(5 rows)
+
+/*+TidScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+TidScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------
+ Tid Scan on p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+(3 rows)
+
+/*+NestLoop(p1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+NestLoop(p1 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------
+ Nested Loop
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: ((id < 10) AND (id = p1.id))
+(5 rows)
+
+/*+MergeJoin(p1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(p1 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------
+ Merge Join
+ Merge Cond: (p1.id = t1.id)
+ -> Sort
+ Sort Key: p1.id
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id < 10)
+(8 rows)
+
+/*+HashJoin(p1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(p1 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------
+ Hash Join
+ Hash Cond: (t1.id = p1.id)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id < 10)
+ -> Hash
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+(7 rows)
+
+SET constraint_exclusion TO off;
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+ QUERY PLAN
+-----------------------------------------------------------------------
+ Nested Loop
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: ((id < 10) AND (id = p1.id))
+(5 rows)
+
+SET constraint_exclusion TO on;
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+ QUERY PLAN
+-----------------------------------------------------------------------
+ Nested Loop
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: ((id < 10) AND (id = p1.id))
+(5 rows)
+
+SET constraint_exclusion TO off;
+/*+SeqScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------
+ Nested Loop
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: ((id < 10) AND (id = p1.id))
+(5 rows)
+
+/*+IndexScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+IndexScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------
+ Nested Loop
+ -> Index Scan using p1_pkey on p1
+ Index Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: ((id < 10) AND (id = p1.id))
+(6 rows)
+
+/*+BitmapScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------
+ Nested Loop
+ -> Bitmap Heap Scan on p1
+ Recheck Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on p1_pkey
+ Index Cond: ((id >= 50) AND (id <= 51))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: ((id < 10) AND (id = p1.id))
+(8 rows)
+
+/*+TidScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+TidScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------
+ Nested Loop
+ -> Tid Scan on p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: ((id < 10) AND (id = p1.id))
+(6 rows)
+
+SET constraint_exclusion TO on;
+/*+SeqScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------
+ Nested Loop
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: ((id < 10) AND (id = p1.id))
+(5 rows)
+
+/*+IndexScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+IndexScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------
+ Nested Loop
+ -> Index Scan using p1_pkey on p1
+ Index Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: ((id < 10) AND (id = p1.id))
+(6 rows)
+
+/*+BitmapScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------
+ Nested Loop
+ -> Bitmap Heap Scan on p1
+ Recheck Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on p1_pkey
+ Index Cond: ((id >= 50) AND (id <= 51))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: ((id < 10) AND (id = p1.id))
+(8 rows)
+
+/*+TidScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+TidScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------
+ Nested Loop
+ -> Tid Scan on p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: ((id < 10) AND (id = p1.id))
+(6 rows)
+
+-- quote test
+/*+SeqScan("""t1 ) ")IndexScan("t 2 """)HashJoin("""t1 ) "T3"t 2 """)Leading("""t1 ) "T3"t 2 """)Set(application_name"a a a"" a A")*/
+EXPLAIN (COSTS false) SELECT * FROM t1 """t1 ) ", t2 "t 2 """, t3 "T3" WHERE """t1 ) ".id = "t 2 """.id AND """t1 ) ".id = "T3".id;
+LOG: pg_hint_plan:
+used hint:
+SeqScan("""t1 ) ")
+IndexScan("t 2 """)
+HashJoin("""t1 ) " T3 "t 2 """)
+Leading("""t1 ) " T3 "t 2 """)
+Set(application_name "a a a"" a A")
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------
+ Hash Join
+ Hash Cond: ("t 2 """.id = """t1 ) ".id)
+ -> Index Scan using t2_pkey on t2 "t 2 """
+ -> Hash
+ -> Hash Join
+ Hash Cond: ("""t1 ) ".id = "T3".id)
+ -> Seq Scan on t1 """t1 ) "
+ -> Hash
+ -> Seq Scan on t3 "T3"
+(9 rows)
+
+-- duplicate hint test
+/*+SeqScan(t1)SeqScan(t2)IndexScan(t1)IndexScan(t2)BitmapScan(t1)BitmapScan(t2)TidScan(t1)TidScan(t2)HashJoin(t1 t2)NestLoop(t2 t1)MergeJoin(t1 t2)Leading(t1 t2)Leading(t2 t1)Set(enable_seqscan off)Set(enable_mergejoin on)Set(enable_seqscan on)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+INFO: hint syntax error at or near "SeqScan(t1)SeqScan(t2)IndexScan(t1)IndexScan(t2)BitmapScan(t1)BitmapScan(t2)TidScan(t1)TidScan(t2)HashJoin(t1 t2)NestLoop(t2 t1)MergeJoin(t1 t2)Leading(t1 t2)Leading(t2 t1)Set(enable_seqscan off)Set(enable_mergejoin on)Set(enable_seqscan on)"
+DETAIL: Conflict scan method hint.
+INFO: hint syntax error at or near "IndexScan(t1)IndexScan(t2)BitmapScan(t1)BitmapScan(t2)TidScan(t1)TidScan(t2)HashJoin(t1 t2)NestLoop(t2 t1)MergeJoin(t1 t2)Leading(t1 t2)Leading(t2 t1)Set(enable_seqscan off)Set(enable_mergejoin on)Set(enable_seqscan on)"
+DETAIL: Conflict scan method hint.
+INFO: hint syntax error at or near "BitmapScan(t1)BitmapScan(t2)TidScan(t1)TidScan(t2)HashJoin(t1 t2)NestLoop(t2 t1)MergeJoin(t1 t2)Leading(t1 t2)Leading(t2 t1)Set(enable_seqscan off)Set(enable_mergejoin on)Set(enable_seqscan on)"
+DETAIL: Conflict scan method hint.
+INFO: hint syntax error at or near "SeqScan(t2)IndexScan(t1)IndexScan(t2)BitmapScan(t1)BitmapScan(t2)TidScan(t1)TidScan(t2)HashJoin(t1 t2)NestLoop(t2 t1)MergeJoin(t1 t2)Leading(t1 t2)Leading(t2 t1)Set(enable_seqscan off)Set(enable_mergejoin on)Set(enable_seqscan on)"
+DETAIL: Conflict scan method hint.
+INFO: hint syntax error at or near "IndexScan(t2)BitmapScan(t1)BitmapScan(t2)TidScan(t1)TidScan(t2)HashJoin(t1 t2)NestLoop(t2 t1)MergeJoin(t1 t2)Leading(t1 t2)Leading(t2 t1)Set(enable_seqscan off)Set(enable_mergejoin on)Set(enable_seqscan on)"
+DETAIL: Conflict scan method hint.
+INFO: hint syntax error at or near "BitmapScan(t2)TidScan(t1)TidScan(t2)HashJoin(t1 t2)NestLoop(t2 t1)MergeJoin(t1 t2)Leading(t1 t2)Leading(t2 t1)Set(enable_seqscan off)Set(enable_mergejoin on)Set(enable_seqscan on)"
+DETAIL: Conflict scan method hint.
+INFO: hint syntax error at or near "HashJoin(t1 t2)NestLoop(t2 t1)MergeJoin(t1 t2)Leading(t1 t2)Leading(t2 t1)Set(enable_seqscan off)Set(enable_mergejoin on)Set(enable_seqscan on)"
+DETAIL: Conflict join method hint.
+INFO: hint syntax error at or near "NestLoop(t2 t1)MergeJoin(t1 t2)Leading(t1 t2)Leading(t2 t1)Set(enable_seqscan off)Set(enable_mergejoin on)Set(enable_seqscan on)"
+DETAIL: Conflict join method hint.
+INFO: hint syntax error at or near "Leading(t1 t2)Leading(t2 t1)Set(enable_seqscan off)Set(enable_mergejoin on)Set(enable_seqscan on)"
+DETAIL: Conflict leading hint.
+INFO: hint syntax error at or near "Set(enable_seqscan off)Set(enable_mergejoin on)Set(enable_seqscan on)"
+DETAIL: Conflict set hint.
+LOG: pg_hint_plan:
+used hint:
+TidScan(t1)
+TidScan(t2)
+MergeJoin(t1 t2)
+Leading(t2 t1)
+Set(enable_mergejoin on)
+Set(enable_seqscan on)
+not used hint:
+duplication hint:
+SeqScan(t1)
+IndexScan(t1)
+BitmapScan(t1)
+SeqScan(t2)
+IndexScan(t2)
+BitmapScan(t2)
+HashJoin(t1 t2)
+NestLoop(t1 t2)
+Leading(t1 t2)
+Set(enable_seqscan off)
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------
+ Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Sort
+ Sort Key: t1.id
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: t2.id
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(10 rows)
+
+-- sub query Leading hint test
+SET from_collapse_limit TO 100;
+SET geqo_threshold TO 100;
+EXPLAIN (COSTS false)
+WITH c1_1(id) AS (
+SELECT max(t1_5.id) FROM t1 t1_5, t2 t2_5, t3 t3_5 WHERE t1_5.id = t2_5.id AND t2_5.id = t3_5.id
+)
+SELECT t1_1.id, (
+SELECT max(t1_2.id) FROM t1 t1_2, t2 t2_2, t3 t3_2 WHERE t1_2.id = t2_2.id AND t2_2.id = t3_2.id
+) FROM t1 t1_1, t2 t2_1, t3 t3_1, (
+SELECT t1_3.id FROM t1 t1_3, t2 t2_3, t3 t3_3 WHERE t1_3.id = t2_3.id AND t2_3.id = t3_3.id
+) v1_1(id), c1_1 WHERE t1_1.id = t2_1.id AND t2_1.id = t3_1.id AND t2_1.id = v1_1.id AND v1_1.id = c1_1.id AND t1_1.id = (
+SELECT max(t1_4.id) FROM t1 t1_4, t2 t2_4, t3 t3_4 WHERE t1_4.id = t2_4.id AND t2_4.id = t3_4.id
+);
+ QUERY PLAN
+-------------------------------------------------------------------------
+ Nested Loop
+ CTE c1_1
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t1_5.id = t3_5.id)
+ -> Merge Join
+ Merge Cond: (t1_5.id = t2_5.id)
+ -> Index Scan using t1_pkey on t1 t1_5
+ -> Index Scan using t2_pkey on t2 t2_5
+ -> Sort
+ Sort Key: t3_5.id
+ -> Seq Scan on t3 t3_5
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t1_2.id = t3_2.id)
+ -> Merge Join
+ Merge Cond: (t1_2.id = t2_2.id)
+ -> Index Scan using t1_pkey on t1 t1_2
+ -> Index Scan using t2_pkey on t2 t2_2
+ -> Sort
+ Sort Key: t3_2.id
+ -> Seq Scan on t3 t3_2
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t1_4.id = t3_4.id)
+ -> Merge Join
+ Merge Cond: (t1_4.id = t2_4.id)
+ -> Index Scan using t1_pkey on t1 t1_4
+ -> Index Scan using t2_pkey on t2 t2_4
+ -> Sort
+ Sort Key: t3_4.id
+ -> Seq Scan on t3 t3_4
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ -> Index Scan using t1_pkey on t1 t1_1
+ Index Cond: (id = $2)
+ -> Seq Scan on t3 t3_1
+ Filter: (id = $2)
+ -> Index Scan using t2_pkey on t2 t2_1
+ Index Cond: (id = $2)
+ -> Index Scan using t1_pkey on t1 t1_3
+ Index Cond: (id = $2)
+ -> Index Scan using t2_pkey on t2 t2_3
+ Index Cond: (id = $2)
+ -> Seq Scan on t3 t3_3
+ Filter: (id = $2)
+ -> CTE Scan on c1_1
+ Filter: (id = $2)
+(53 rows)
+
+/*+HashJoin(t1_1 t3_1)MergeJoin(t1_3 t3_3)NestLoop(t1_2 t2_2)NestLoop(t1_4 t2_4)NestLoop(t1_5 t2_5)*/
+EXPLAIN (COSTS false)
+WITH c1_1(id) AS (
+SELECT max(t1_5.id) FROM t1 t1_5, t2 t2_5, t3 t3_5 WHERE t1_5.id = t2_5.id AND t2_5.id = t3_5.id
+)
+SELECT t1_1.id, (
+SELECT max(t1_2.id) FROM t1 t1_2, t2 t2_2, t3 t3_2 WHERE t1_2.id = t2_2.id AND t2_2.id = t3_2.id
+) FROM t1 t1_1, t2 t2_1, t3 t3_1, (
+SELECT t1_3.id FROM t1 t1_3, t2 t2_3, t3 t3_3 WHERE t1_3.id = t2_3.id AND t2_3.id = t3_3.id
+) v1_1(id), c1_1 WHERE t1_1.id = t2_1.id AND t2_1.id = t3_1.id AND t2_1.id = v1_1.id AND v1_1.id = c1_1.id AND t1_1.id = (
+SELECT max(t1_4.id) FROM t1 t1_4, t2 t2_4, t3 t3_4 WHERE t1_4.id = t2_4.id AND t2_4.id = t3_4.id
+);
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t1_1 t3_1)
+NestLoop(t1_2 t2_2)
+MergeJoin(t1_3 t3_3)
+NestLoop(t1_4 t2_4)
+NestLoop(t1_5 t2_5)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------------------------
+ Nested Loop
+ CTE c1_1
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t1_5.id = t3_5.id)
+ -> Nested Loop
+ -> Index Scan using t2_pkey on t2 t2_5
+ -> Index Scan using t1_pkey on t1 t1_5
+ Index Cond: (id = t2_5.id)
+ -> Sort
+ Sort Key: t3_5.id
+ -> Seq Scan on t3 t3_5
+ InitPlan 2 (returns $2)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t1_2.id = t3_2.id)
+ -> Nested Loop
+ -> Index Scan using t2_pkey on t2 t2_2
+ -> Index Scan using t1_pkey on t1 t1_2
+ Index Cond: (id = t2_2.id)
+ -> Sort
+ Sort Key: t3_2.id
+ -> Seq Scan on t3 t3_2
+ InitPlan 3 (returns $3)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t1_4.id = t3_4.id)
+ -> Nested Loop
+ -> Index Scan using t2_pkey on t2 t2_4
+ -> Index Scan using t1_pkey on t1 t1_4
+ Index Cond: (id = t2_4.id)
+ -> Sort
+ Sort Key: t3_4.id
+ -> Seq Scan on t3 t3_4
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ -> Index Scan using t2_pkey on t2 t2_1
+ Index Cond: (id = $3)
+ -> Seq Scan on t3 t3_1
+ Filter: (id = $3)
+ -> Index Scan using t1_pkey on t1 t1_1
+ Index Cond: (id = $3)
+ -> Index Scan using t1_pkey on t1 t1_3
+ Index Cond: (id = $3)
+ -> Index Scan using t2_pkey on t2 t2_3
+ Index Cond: (id = $3)
+ -> Seq Scan on t3 t3_3
+ Filter: (id = $3)
+ -> CTE Scan on c1_1
+ Filter: (id = $3)
+(53 rows)
+
+/*+HashJoin(t1_1 t3_1)MergeJoin(t1_3 t3_3)NestLoop(t1_2 t2_2)NestLoop(t1_4 t2_4)NestLoop(t1_5 t2_5)Leading(a t1_1 t1_2 t1_4 t1_5)*/
+EXPLAIN (COSTS false)
+WITH c1_1(id) AS (
+SELECT max(t1_5.id) FROM t1 t1_5, t2 t2_5, t3 t3_5 WHERE t1_5.id = t2_5.id AND t2_5.id = t3_5.id
+)
+SELECT t1_1.id, (
+SELECT max(t1_2.id) FROM t1 t1_2, t2 t2_2, t3 t3_2 WHERE t1_2.id = t2_2.id AND t2_2.id = t3_2.id
+) FROM t1 t1_1, t2 t2_1, t3 t3_1, (
+SELECT t1_3.id FROM t1 t1_3, t2 t2_3, t3 t3_3 WHERE t1_3.id = t2_3.id AND t2_3.id = t3_3.id
+) v1_1(id), c1_1 WHERE t1_1.id = t2_1.id AND t2_1.id = t3_1.id AND t2_1.id = v1_1.id AND v1_1.id = c1_1.id AND t1_1.id = (
+SELECT max(t1_4.id) FROM t1 t1_4, t2 t2_4, t3 t3_4 WHERE t1_4.id = t2_4.id AND t2_4.id = t3_4.id
+);
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t1_1 t3_1)
+NestLoop(t1_2 t2_2)
+MergeJoin(t1_3 t3_3)
+NestLoop(t1_4 t2_4)
+NestLoop(t1_5 t2_5)
+not used hint:
+Leading(a t1_1 t1_2 t1_4 t1_5)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------------------------
+ Nested Loop
+ CTE c1_1
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t1_5.id = t3_5.id)
+ -> Nested Loop
+ -> Index Scan using t2_pkey on t2 t2_5
+ -> Index Scan using t1_pkey on t1 t1_5
+ Index Cond: (id = t2_5.id)
+ -> Sort
+ Sort Key: t3_5.id
+ -> Seq Scan on t3 t3_5
+ InitPlan 2 (returns $2)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t1_2.id = t3_2.id)
+ -> Nested Loop
+ -> Index Scan using t2_pkey on t2 t2_2
+ -> Index Scan using t1_pkey on t1 t1_2
+ Index Cond: (id = t2_2.id)
+ -> Sort
+ Sort Key: t3_2.id
+ -> Seq Scan on t3 t3_2
+ InitPlan 3 (returns $3)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t1_4.id = t3_4.id)
+ -> Nested Loop
+ -> Index Scan using t2_pkey on t2 t2_4
+ -> Index Scan using t1_pkey on t1 t1_4
+ Index Cond: (id = t2_4.id)
+ -> Sort
+ Sort Key: t3_4.id
+ -> Seq Scan on t3 t3_4
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ -> Index Scan using t2_pkey on t2 t2_1
+ Index Cond: (id = $3)
+ -> Seq Scan on t3 t3_1
+ Filter: (id = $3)
+ -> Index Scan using t1_pkey on t1 t1_1
+ Index Cond: (id = $3)
+ -> Index Scan using t1_pkey on t1 t1_3
+ Index Cond: (id = $3)
+ -> Index Scan using t2_pkey on t2 t2_3
+ Index Cond: (id = $3)
+ -> Seq Scan on t3 t3_3
+ Filter: (id = $3)
+ -> CTE Scan on c1_1
+ Filter: (id = $3)
+(53 rows)
+
+/*+HashJoin(t1_1 t3_1)MergeJoin(t1_3 t3_3)NestLoop(t1_2 t2_2)NestLoop(t1_4 t2_4)NestLoop(t1_5 t2_5)Leading(a t3_2 t3_5 t2_2 c1_1 t3_4 t3_3 t2_3 t2_4 t1_3 t2_5 t1_2 t3_1 t1_4 t2_1 t1_5 t1_1)*/
+EXPLAIN (COSTS false)
+WITH c1_1(id) AS (
+SELECT max(t1_5.id) FROM t1 t1_5, t2 t2_5, t3 t3_5 WHERE t1_5.id = t2_5.id AND t2_5.id = t3_5.id
+)
+SELECT t1_1.id, (
+SELECT max(t1_2.id) FROM t1 t1_2, t2 t2_2, t3 t3_2 WHERE t1_2.id = t2_2.id AND t2_2.id = t3_2.id
+) FROM t1 t1_1, t2 t2_1, t3 t3_1, (
+SELECT t1_3.id FROM t1 t1_3, t2 t2_3, t3 t3_3 WHERE t1_3.id = t2_3.id AND t2_3.id = t3_3.id
+) v1_1(id), c1_1 WHERE t1_1.id = t2_1.id AND t2_1.id = t3_1.id AND t2_1.id = v1_1.id AND v1_1.id = c1_1.id AND t1_1.id = (
+SELECT max(t1_4.id) FROM t1 t1_4, t2 t2_4, t3 t3_4 WHERE t1_4.id = t2_4.id AND t2_4.id = t3_4.id
+);
+LOG: pg_hint_plan:
+used hint:
+Leading(a t3_2 t3_5 t2_2 c1_1 t3_4 t3_3 t2_3 t2_4 t1_3 t2_5 t1_2 t3_1 t1_4 t2_1 t1_5 t1_1)
+not used hint:
+HashJoin(t1_1 t3_1)
+NestLoop(t1_2 t2_2)
+MergeJoin(t1_3 t3_3)
+NestLoop(t1_4 t2_4)
+NestLoop(t1_5 t2_5)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------------------
+ Nested Loop
+ CTE c1_1
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t2_5.id = t1_5.id)
+ -> Merge Join
+ Merge Cond: (t2_5.id = t3_5.id)
+ -> Index Scan using t2_pkey on t2 t2_5
+ -> Sort
+ Sort Key: t3_5.id
+ -> Seq Scan on t3 t3_5
+ -> Index Scan using t1_pkey on t1 t1_5
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t2_2.id = t1_2.id)
+ -> Merge Join
+ Merge Cond: (t2_2.id = t3_2.id)
+ -> Index Scan using t2_pkey on t2 t2_2
+ -> Sort
+ Sort Key: t3_2.id
+ -> Seq Scan on t3 t3_2
+ -> Index Scan using t1_pkey on t1 t1_2
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t2_4.id = t1_4.id)
+ -> Merge Join
+ Merge Cond: (t2_4.id = t3_4.id)
+ -> Index Scan using t2_pkey on t2 t2_4
+ -> Sort
+ Sort Key: t3_4.id
+ -> Seq Scan on t3 t3_4
+ -> Index Scan using t1_pkey on t1 t1_4
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ -> Seq Scan on t3 t3_3
+ Filter: (id = $2)
+ -> CTE Scan on c1_1
+ Filter: (id = $2)
+ -> Index Scan using t2_pkey on t2 t2_3
+ Index Cond: (id = $2)
+ -> Index Scan using t1_pkey on t1 t1_3
+ Index Cond: (id = $2)
+ -> Seq Scan on t3 t3_1
+ Filter: (id = $2)
+ -> Index Scan using t2_pkey on t2 t2_1
+ Index Cond: (id = $2)
+ -> Index Scan using t1_pkey on t1 t1_1
+ Index Cond: (id = $2)
+(53 rows)
+
+SET from_collapse_limit TO 1;
+EXPLAIN (COSTS false)
+WITH c1_1(id) AS (
+SELECT max(t1_5.id) FROM t1 t1_5, t2 t2_5, t3 t3_5 WHERE t1_5.id = t2_5.id AND t2_5.id = t3_5.id
+)
+SELECT t1_1.id, (
+SELECT max(t1_2.id) FROM t1 t1_2, t2 t2_2, t3 t3_2 WHERE t1_2.id = t2_2.id AND t2_2.id = t3_2.id
+) FROM t1 t1_1, t2 t2_1, t3 t3_1, (
+SELECT t1_3.id FROM t1 t1_3, t2 t2_3, t3 t3_3 WHERE t1_3.id = t2_3.id AND t2_3.id = t3_3.id
+) v1_1(id), c1_1 WHERE t1_1.id = t2_1.id AND t2_1.id = t3_1.id AND t2_1.id = v1_1.id AND v1_1.id = c1_1.id AND t1_1.id = (
+SELECT max(t1_4.id) FROM t1 t1_4, t2 t2_4, t3 t3_4 WHERE t1_4.id = t2_4.id AND t2_4.id = t3_4.id
+);
+ QUERY PLAN
+---------------------------------------------------------------
+ Nested Loop
+ CTE c1_1
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t1_5.id = t3_5.id)
+ -> Merge Join
+ Merge Cond: (t1_5.id = t2_5.id)
+ -> Index Scan using t1_pkey on t1 t1_5
+ -> Index Scan using t2_pkey on t2 t2_5
+ -> Sort
+ Sort Key: t3_5.id
+ -> Seq Scan on t3 t3_5
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t1_2.id = t3_2.id)
+ -> Merge Join
+ Merge Cond: (t1_2.id = t2_2.id)
+ -> Index Scan using t1_pkey on t1 t1_2
+ -> Index Scan using t2_pkey on t2 t2_2
+ -> Sort
+ Sort Key: t3_2.id
+ -> Seq Scan on t3 t3_2
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t1_4.id = t3_4.id)
+ -> Merge Join
+ Merge Cond: (t1_4.id = t2_4.id)
+ -> Index Scan using t1_pkey on t1 t1_4
+ -> Index Scan using t2_pkey on t2 t2_4
+ -> Sort
+ Sort Key: t3_4.id
+ -> Seq Scan on t3 t3_4
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ -> Index Scan using t1_pkey on t1 t1_1
+ Index Cond: (id = $2)
+ -> Seq Scan on t3 t3_1
+ Filter: (id = $2)
+ -> Index Scan using t2_pkey on t2 t2_1
+ Index Cond: (id = $2)
+ -> Nested Loop
+ -> Nested Loop
+ -> Index Scan using t1_pkey on t1 t1_3
+ Index Cond: (id = $2)
+ -> Seq Scan on t3 t3_3
+ Filter: (id = $2)
+ -> Index Scan using t2_pkey on t2 t2_3
+ Index Cond: (id = $2)
+ -> CTE Scan on c1_1
+ Filter: (id = $2)
+(53 rows)
+
+/*+HashJoin(t1_1 t3_1)MergeJoin(t1_3 t3_3)NestLoop(t1_2 t2_2)NestLoop(t1_4 t2_4)NestLoop(t1_5 t2_5)*/
+EXPLAIN (COSTS false)
+WITH c1_1(id) AS (
+SELECT max(t1_5.id) FROM t1 t1_5, t2 t2_5, t3 t3_5 WHERE t1_5.id = t2_5.id AND t2_5.id = t3_5.id
+)
+SELECT t1_1.id, (
+SELECT max(t1_2.id) FROM t1 t1_2, t2 t2_2, t3 t3_2 WHERE t1_2.id = t2_2.id AND t2_2.id = t3_2.id
+) FROM t1 t1_1, t2 t2_1, t3 t3_1, (
+SELECT t1_3.id FROM t1 t1_3, t2 t2_3, t3 t3_3 WHERE t1_3.id = t2_3.id AND t2_3.id = t3_3.id
+) v1_1(id), c1_1 WHERE t1_1.id = t2_1.id AND t2_1.id = t3_1.id AND t2_1.id = v1_1.id AND v1_1.id = c1_1.id AND t1_1.id = (
+SELECT max(t1_4.id) FROM t1 t1_4, t2 t2_4, t3 t3_4 WHERE t1_4.id = t2_4.id AND t2_4.id = t3_4.id
+);
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t1_1 t3_1)
+NestLoop(t1_2 t2_2)
+MergeJoin(t1_3 t3_3)
+NestLoop(t1_4 t2_4)
+NestLoop(t1_5 t2_5)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------
+ Nested Loop
+ CTE c1_1
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t1_5.id = t3_5.id)
+ -> Nested Loop
+ -> Index Scan using t2_pkey on t2 t2_5
+ -> Index Scan using t1_pkey on t1 t1_5
+ Index Cond: (id = t2_5.id)
+ -> Sort
+ Sort Key: t3_5.id
+ -> Seq Scan on t3 t3_5
+ InitPlan 2 (returns $2)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t1_2.id = t3_2.id)
+ -> Nested Loop
+ -> Index Scan using t2_pkey on t2 t2_2
+ -> Index Scan using t1_pkey on t1 t1_2
+ Index Cond: (id = t2_2.id)
+ -> Sort
+ Sort Key: t3_2.id
+ -> Seq Scan on t3 t3_2
+ InitPlan 3 (returns $3)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t1_4.id = t3_4.id)
+ -> Nested Loop
+ -> Index Scan using t2_pkey on t2 t2_4
+ -> Index Scan using t1_pkey on t1 t1_4
+ Index Cond: (id = t2_4.id)
+ -> Sort
+ Sort Key: t3_4.id
+ -> Seq Scan on t3 t3_4
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ -> Index Scan using t2_pkey on t2 t2_1
+ Index Cond: (id = $3)
+ -> Seq Scan on t3 t3_1
+ Filter: (id = $3)
+ -> Index Scan using t1_pkey on t1 t1_1
+ Index Cond: (id = $3)
+ -> Nested Loop
+ -> Nested Loop
+ -> Index Scan using t2_pkey on t2 t2_3
+ Index Cond: (id = $3)
+ -> Seq Scan on t3 t3_3
+ Filter: (id = $3)
+ -> Index Scan using t1_pkey on t1 t1_3
+ Index Cond: (id = $3)
+ -> CTE Scan on c1_1
+ Filter: (id = $3)
+(53 rows)
+
+/*+HashJoin(t1_1 t3_1)MergeJoin(t1_3 t3_3)NestLoop(t1_2 t2_2)NestLoop(t1_4 t2_4)NestLoop(t1_5 t2_5)Leading(a t1_1 t1_2 t1_4 t1_5)*/
+EXPLAIN (COSTS false)
+WITH c1_1(id) AS (
+SELECT max(t1_5.id) FROM t1 t1_5, t2 t2_5, t3 t3_5 WHERE t1_5.id = t2_5.id AND t2_5.id = t3_5.id
+)
+SELECT t1_1.id, (
+SELECT max(t1_2.id) FROM t1 t1_2, t2 t2_2, t3 t3_2 WHERE t1_2.id = t2_2.id AND t2_2.id = t3_2.id
+) FROM t1 t1_1, t2 t2_1, t3 t3_1, (
+SELECT t1_3.id FROM t1 t1_3, t2 t2_3, t3 t3_3 WHERE t1_3.id = t2_3.id AND t2_3.id = t3_3.id
+) v1_1(id), c1_1 WHERE t1_1.id = t2_1.id AND t2_1.id = t3_1.id AND t2_1.id = v1_1.id AND v1_1.id = c1_1.id AND t1_1.id = (
+SELECT max(t1_4.id) FROM t1 t1_4, t2 t2_4, t3 t3_4 WHERE t1_4.id = t2_4.id AND t2_4.id = t3_4.id
+);
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t1_1 t3_1)
+NestLoop(t1_2 t2_2)
+MergeJoin(t1_3 t3_3)
+NestLoop(t1_4 t2_4)
+NestLoop(t1_5 t2_5)
+not used hint:
+Leading(a t1_1 t1_2 t1_4 t1_5)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------
+ Nested Loop
+ CTE c1_1
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t1_5.id = t3_5.id)
+ -> Nested Loop
+ -> Index Scan using t2_pkey on t2 t2_5
+ -> Index Scan using t1_pkey on t1 t1_5
+ Index Cond: (id = t2_5.id)
+ -> Sort
+ Sort Key: t3_5.id
+ -> Seq Scan on t3 t3_5
+ InitPlan 2 (returns $2)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t1_2.id = t3_2.id)
+ -> Nested Loop
+ -> Index Scan using t2_pkey on t2 t2_2
+ -> Index Scan using t1_pkey on t1 t1_2
+ Index Cond: (id = t2_2.id)
+ -> Sort
+ Sort Key: t3_2.id
+ -> Seq Scan on t3 t3_2
+ InitPlan 3 (returns $3)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t1_4.id = t3_4.id)
+ -> Nested Loop
+ -> Index Scan using t2_pkey on t2 t2_4
+ -> Index Scan using t1_pkey on t1 t1_4
+ Index Cond: (id = t2_4.id)
+ -> Sort
+ Sort Key: t3_4.id
+ -> Seq Scan on t3 t3_4
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ -> Index Scan using t2_pkey on t2 t2_1
+ Index Cond: (id = $3)
+ -> Seq Scan on t3 t3_1
+ Filter: (id = $3)
+ -> Index Scan using t1_pkey on t1 t1_1
+ Index Cond: (id = $3)
+ -> Nested Loop
+ -> Nested Loop
+ -> Index Scan using t2_pkey on t2 t2_3
+ Index Cond: (id = $3)
+ -> Seq Scan on t3 t3_3
+ Filter: (id = $3)
+ -> Index Scan using t1_pkey on t1 t1_3
+ Index Cond: (id = $3)
+ -> CTE Scan on c1_1
+ Filter: (id = $3)
+(53 rows)
+
+/*+HashJoin(t1_1 t3_1)MergeJoin(t1_3 t3_3)NestLoop(t1_2 t2_2)NestLoop(t1_4 t2_4)NestLoop(t1_5 t2_5)Leading(a t3_2 t3_5 t2_2 c1_1 t3_4 t3_3 t2_3 t2_4 t1_3 t2_5 t1_2 t3_1 t1_4 t2_1 t1_5 t1_1)*/
+EXPLAIN (COSTS false)
+WITH c1_1(id) AS (
+SELECT max(t1_5.id) FROM t1 t1_5, t2 t2_5, t3 t3_5 WHERE t1_5.id = t2_5.id AND t2_5.id = t3_5.id
+)
+SELECT t1_1.id, (
+SELECT max(t1_2.id) FROM t1 t1_2, t2 t2_2, t3 t3_2 WHERE t1_2.id = t2_2.id AND t2_2.id = t3_2.id
+) FROM t1 t1_1, t2 t2_1, t3 t3_1, (
+SELECT t1_3.id FROM t1 t1_3, t2 t2_3, t3 t3_3 WHERE t1_3.id = t2_3.id AND t2_3.id = t3_3.id
+) v1_1(id), c1_1 WHERE t1_1.id = t2_1.id AND t2_1.id = t3_1.id AND t2_1.id = v1_1.id AND v1_1.id = c1_1.id AND t1_1.id = (
+SELECT max(t1_4.id) FROM t1 t1_4, t2 t2_4, t3 t3_4 WHERE t1_4.id = t2_4.id AND t2_4.id = t3_4.id
+);
+LOG: pg_hint_plan:
+used hint:
+Leading(a t3_2 t3_5 t2_2 c1_1 t3_4 t3_3 t2_3 t2_4 t1_3 t2_5 t1_2 t3_1 t1_4 t2_1 t1_5 t1_1)
+not used hint:
+HashJoin(t1_1 t3_1)
+NestLoop(t1_2 t2_2)
+MergeJoin(t1_3 t3_3)
+NestLoop(t1_4 t2_4)
+NestLoop(t1_5 t2_5)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------------------------
+ Nested Loop
+ CTE c1_1
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t2_5.id = t1_5.id)
+ -> Merge Join
+ Merge Cond: (t2_5.id = t3_5.id)
+ -> Index Scan using t2_pkey on t2 t2_5
+ -> Sort
+ Sort Key: t3_5.id
+ -> Seq Scan on t3 t3_5
+ -> Index Scan using t1_pkey on t1 t1_5
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t2_2.id = t1_2.id)
+ -> Merge Join
+ Merge Cond: (t2_2.id = t3_2.id)
+ -> Index Scan using t2_pkey on t2 t2_2
+ -> Sort
+ Sort Key: t3_2.id
+ -> Seq Scan on t3 t3_2
+ -> Index Scan using t1_pkey on t1 t1_2
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t2_4.id = t1_4.id)
+ -> Merge Join
+ Merge Cond: (t2_4.id = t3_4.id)
+ -> Index Scan using t2_pkey on t2 t2_4
+ -> Sort
+ Sort Key: t3_4.id
+ -> Seq Scan on t3 t3_4
+ -> Index Scan using t1_pkey on t1 t1_4
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ -> Index Scan using t2_pkey on t2 t2_3
+ Index Cond: (id = $2)
+ -> Seq Scan on t3 t3_3
+ Filter: (id = $2)
+ -> Index Scan using t1_pkey on t1 t1_3
+ Index Cond: (id = $2)
+ -> CTE Scan on c1_1
+ Filter: (id = $2)
+ -> Seq Scan on t3 t3_1
+ Filter: (id = $2)
+ -> Index Scan using t2_pkey on t2 t2_1
+ Index Cond: (id = $2)
+ -> Index Scan using t1_pkey on t1 t1_1
+ Index Cond: (id = $2)
+(53 rows)
+
+-- ambigous error
+EXPLAIN (COSTS false) SELECT * FROM t1, s0.t1, t2 WHERE public.t1.id = s0.t1.id AND public.t1.id = t2.id;
+ QUERY PLAN
+-----------------------------------------------
+ Merge Join
+ Merge Cond: (public.t1.id = t2.id)
+ -> Merge Join
+ Merge Cond: (public.t1.id = s0.t1.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+(7 rows)
+
+/*+NestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, s0.t1, t2 WHERE public.t1.id = s0.t1.id AND public.t1.id = t2.id;
+INFO: hint syntax error at or near "NestLoop(t1 t2)"
+DETAIL: Relation name "t1" is ambiguous.
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+NestLoop(t1 t2)
+
+ QUERY PLAN
+-----------------------------------------------
+ Merge Join
+ Merge Cond: (public.t1.id = t2.id)
+ -> Merge Join
+ Merge Cond: (public.t1.id = s0.t1.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+(7 rows)
+
+/*+Leading(t1 t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, s0.t1, t2 WHERE public.t1.id = s0.t1.id AND public.t1.id = t2.id;
+INFO: hint syntax error at or near "Leading(t1 t2 t1)"
+DETAIL: Relation name "t1" is ambiguous.
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+Leading(t1 t2 t1)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------
+ Merge Join
+ Merge Cond: (public.t1.id = t2.id)
+ -> Merge Join
+ Merge Cond: (public.t1.id = s0.t1.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+(7 rows)
+
+-- identifier length test
+EXPLAIN (COSTS false) SELECT * FROM t1 "123456789012345678901234567890123456789012345678901234567890123" JOIN t2 ON ("123456789012345678901234567890123456789012345678901234567890123".id = t2.id) JOIN t3 ON (t2.id = t3.id);
+ QUERY PLAN
+--------------------------------------------------------------------------------------------------------------
+ Merge Join
+ Merge Cond: ("123456789012345678901234567890123456789012345678901234567890123".id = t3.id)
+ -> Merge Join
+ Merge Cond: ("123456789012345678901234567890123456789012345678901234567890123".id = t2.id)
+ -> Index Scan using t1_pkey on t1 "123456789012345678901234567890123456789012345678901234567890123"
+ -> Index Scan using t2_pkey on t2
+ -> Sort
+ Sort Key: t3.id
+ -> Seq Scan on t3
+(9 rows)
+
+/*+
+Leading(123456789012345678901234567890123456789012345678901234567890123 t2 t3)
+SeqScan(123456789012345678901234567890123456789012345678901234567890123)
+MergeJoin(123456789012345678901234567890123456789012345678901234567890123 t2)
+Set(123456789012345678901234567890123456789012345678901234567890123 1)
+*/
+EXPLAIN (COSTS false) SELECT * FROM t1 "123456789012345678901234567890123456789012345678901234567890123" JOIN t2 ON ("123456789012345678901234567890123456789012345678901234567890123".id = t2.id) JOIN t3 ON (t2.id = t3.id);
+INFO: unrecognized configuration parameter "123456789012345678901234567890123456789012345678901234567890123"
+LOG: pg_hint_plan:
+used hint:
+SeqScan(123456789012345678901234567890123456789012345678901234567890123)
+MergeJoin(123456789012345678901234567890123456789012345678901234567890123 t2)
+Leading(123456789012345678901234567890123456789012345678901234567890123 t2 t3)
+not used hint:
+duplication hint:
+error hint:
+Set(123456789012345678901234567890123456789012345678901234567890123 1)
+
+ QUERY PLAN
+----------------------------------------------------------------------------------------------------
+ Merge Join
+ Merge Cond: ("123456789012345678901234567890123456789012345678901234567890123".id = t3.id)
+ -> Merge Join
+ Merge Cond: (t2.id = "123456789012345678901234567890123456789012345678901234567890123".id)
+ -> Index Scan using t2_pkey on t2
+ -> Sort
+ Sort Key: "123456789012345678901234567890123456789012345678901234567890123".id
+ -> Seq Scan on t1 "123456789012345678901234567890123456789012345678901234567890123"
+ -> Sort
+ Sort Key: t3.id
+ -> Seq Scan on t3
+(11 rows)
+
+/*+
+Leading(1234567890123456789012345678901234567890123456789012345678901234 t2 t3)
+SeqScan(1234567890123456789012345678901234567890123456789012345678901234)
+MergeJoin(1234567890123456789012345678901234567890123456789012345678901234 t2)
+Set(1234567890123456789012345678901234567890123456789012345678901234 1)
+Set(cursor_tuple_fraction 0.1234567890123456789012345678901234567890123456789012345678901234)
+*/
+EXPLAIN (COSTS false) SELECT * FROM t1 "1234567890123456789012345678901234567890123456789012345678901234" JOIN t2 ON ("1234567890123456789012345678901234567890123456789012345678901234".id = t2.id) JOIN t3 ON (t2.id = t3.id);
+NOTICE: identifier "1234567890123456789012345678901234567890123456789012345678901234" will be truncated to "123456789012345678901234567890123456789012345678901234567890123"
+NOTICE: identifier "1234567890123456789012345678901234567890123456789012345678901234" will be truncated to "123456789012345678901234567890123456789012345678901234567890123"
+NOTICE: identifier "1234567890123456789012345678901234567890123456789012345678901234" will be truncated to "123456789012345678901234567890123456789012345678901234567890123"
+NOTICE: identifier "1234567890123456789012345678901234567890123456789012345678901234" will be truncated to "123456789012345678901234567890123456789012345678901234567890123"
+NOTICE: identifier "1234567890123456789012345678901234567890123456789012345678901234" will be truncated to "123456789012345678901234567890123456789012345678901234567890123"
+NOTICE: identifier "1234567890123456789012345678901234567890123456789012345678901234" will be truncated to "123456789012345678901234567890123456789012345678901234567890123"
+INFO: unrecognized configuration parameter "123456789012345678901234567890123456789012345678901234567890123"
+LOG: pg_hint_plan:
+used hint:
+SeqScan(123456789012345678901234567890123456789012345678901234567890123)
+MergeJoin(123456789012345678901234567890123456789012345678901234567890123 t2)
+Leading(123456789012345678901234567890123456789012345678901234567890123 t2 t3)
+Set(cursor_tuple_fraction 0.1234567890123456789012345678901234567890123456789012345678901234)
+not used hint:
+duplication hint:
+error hint:
+Set(123456789012345678901234567890123456789012345678901234567890123 1)
+
+ QUERY PLAN
+----------------------------------------------------------------------------------------------------
+ Merge Join
+ Merge Cond: ("123456789012345678901234567890123456789012345678901234567890123".id = t3.id)
+ -> Merge Join
+ Merge Cond: (t2.id = "123456789012345678901234567890123456789012345678901234567890123".id)
+ -> Index Scan using t2_pkey on t2
+ -> Sort
+ Sort Key: "123456789012345678901234567890123456789012345678901234567890123".id
+ -> Seq Scan on t1 "123456789012345678901234567890123456789012345678901234567890123"
+ -> Sort
+ Sort Key: t3.id
+ -> Seq Scan on t3
+(11 rows)
+
+SET "123456789012345678901234567890123456789012345678901234567890123" TO 1;
+ERROR: unrecognized configuration parameter "123456789012345678901234567890123456789012345678901234567890123"
+SET "1234567890123456789012345678901234567890123456789012345678901234" TO 1;
+NOTICE: identifier "1234567890123456789012345678901234567890123456789012345678901234" will be truncated to "123456789012345678901234567890123456789012345678901234567890123"
+ERROR: unrecognized configuration parameter "123456789012345678901234567890123456789012345678901234567890123"
+SET cursor_tuple_fraction TO 1234567890123456789012345678901234567890123456789012345678901234;
+ERROR: 1.23457e+63 is outside the valid range for parameter "cursor_tuple_fraction" (0 .. 1)
+-- multi error
+/*+ Set(enable_seqscan 100)Set(seq_page_cost on)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+INFO: parameter "enable_seqscan" requires a Boolean value
+INFO: parameter "seq_page_cost" requires a numeric value
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+Set(enable_seqscan 100)
+Set(seq_page_cost on)
+
+ QUERY PLAN
+--------------------------------------
+ Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+(4 rows)
+
--- /dev/null
+SET search_path TO public;
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+ QUERY PLAN
+--------------------------------------
+ Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+(4 rows)
+
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.val = t2.val;
+ QUERY PLAN
+-------------------------------------------
+ Merge Join
+ Merge Cond: (t2.val = t1.val)
+ -> Index Scan using t2_val on t2
+ -> Materialize
+ -> Index Scan using t1_val on t1
+(5 rows)
+
+LOAD 'pg_hint_plan';
+SET pg_hint_plan.debug_print TO on;
+SET client_min_messages TO LOG;
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+ QUERY PLAN
+--------------------------------------
+ Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+(4 rows)
+
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.val = t2.val;
+ QUERY PLAN
+-------------------------------------------
+ Merge Join
+ Merge Cond: (t2.val = t1.val)
+ -> Index Scan using t2_val on t2
+ -> Materialize
+ -> Index Scan using t1_val on t1
+(5 rows)
+
+/*+ Test (t1 t2) */
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+INFO: hint syntax error at or near "Test (t1 t2) "
+DETAIL: Unrecognized hint keyword "Test".
+ QUERY PLAN
+--------------------------------------
+ Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+(4 rows)
+
+SET pg_hint_plan.enable_hint TO off;
+/*+ Test (t1 t2) */
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+ QUERY PLAN
+--------------------------------------
+ Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+(4 rows)
+
+SET pg_hint_plan.enable_hint TO on;
+/*Set(enable_indexscan off)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+ QUERY PLAN
+--------------------------------------
+ Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+(4 rows)
+
+--+Set(enable_indexscan off)
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+ QUERY PLAN
+--------------------------------------
+ Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+(4 rows)
+
+/*+Set(enable_indexscan off) /* nest comment */ */
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+INFO: hint syntax error at or near "/* nest comment */ */
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;"
+DETAIL: Nested block comments are not supported.
+ QUERY PLAN
+--------------------------------------
+ Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+(4 rows)
+
+/*+Set(enable_indexscan off)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.id = t2.id)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+/*+ Set(enable_indexscan off) Set(enable_hashjoin off) */
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_hashjoin off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------
+ Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Sort
+ Sort Key: t1.id
+ -> Seq Scan on t1
+ -> Sort
+ Sort Key: t2.id
+ -> Seq Scan on t2
+(8 rows)
+
+/*+ Set ( enable_indexscan off ) */
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.id = t2.id)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+/*+
+ Set
+ (
+ enable_indexscan
+ off
+ )
+ */
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.id = t2.id)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+/*+ Set(enable_indexscan off)Set(enable_nestloop off)Set(enable_mergejoin off)
+ Set(enable_seqscan off)
+ */
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_indexscan off)
+Set(enable_mergejoin off)
+Set(enable_nestloop off)
+Set(enable_seqscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Index Scan using t2_pkey on t2
+ -> Bitmap Heap Scan on t1
+ Recheck Cond: (id = t2.id)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: (id = t2.id)
+(6 rows)
+
+/*+Set(work_mem "1M")*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+INFO: invalid value for parameter "work_mem": "1M"
+HINT: Valid units for this parameter are "kB", "MB", and "GB".
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+Set(work_mem 1M)
+
+ QUERY PLAN
+--------------------------------------
+ Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+(4 rows)
+
+/*+Set(work_mem "1MB")*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+LOG: pg_hint_plan:
+used hint:
+Set(work_mem 1MB)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------
+ Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+(4 rows)
+
+/*+Set(work_mem TO "1MB")*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+INFO: hint syntax error at or near ""1MB")"
+DETAIL: Closing parenthesis is necessary.
+ QUERY PLAN
+--------------------------------------
+ Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+(4 rows)
+
+/*+SeqScan(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+INFO: hint syntax error at or near "t2)"
+DETAIL: Closing parenthesis is necessary.
+ QUERY PLAN
+--------------------------------------
+ Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+(4 rows)
+
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.id = t2.id)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+/*+SeqScan(t1)IndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+IndexScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------
+ Hash Join
+ Hash Cond: (t1.id = t2.id)
+ -> Seq Scan on t1
+ -> Hash
+ -> Index Scan using t2_pkey on t2
+(5 rows)
+
+/*+BitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Seq Scan on t1
+ -> Bitmap Heap Scan on t2
+ Recheck Cond: (id = t1.id)
+ -> Bitmap Index Scan on t2_pkey
+ Index Cond: (id = t1.id)
+(6 rows)
+
+/*+BitmapScan(t2)NoSeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+LOG: pg_hint_plan:
+used hint:
+NoSeqScan(t1)
+BitmapScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Index Scan using t1_pkey on t1
+ -> Bitmap Heap Scan on t2
+ Recheck Cond: (id = t1.id)
+ -> Bitmap Index Scan on t2_pkey
+ Index Cond: (id = t1.id)
+(6 rows)
+
+/*+NoIndexScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+LOG: pg_hint_plan:
+used hint:
+NoIndexScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.id = t2.id)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+/*+NoBitmapScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t4 WHERE t1.val < 10;
+LOG: pg_hint_plan:
+used hint:
+NoBitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------
+ Nested Loop
+ -> Seq Scan on t1
+ Filter: (val < 10)
+ -> Materialize
+ -> Seq Scan on t4
+(5 rows)
+
+/*+TidScan(t4)*/
+EXPLAIN (COSTS false) SELECT * FROM t3, t4 WHERE t3.id = t4.id AND t4.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+TidScan(t4)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------
+ Merge Join
+ Merge Cond: (t3.id = t4.id)
+ -> Index Scan using t3_pkey on t3
+ -> Sort
+ Sort Key: t4.id
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(7 rows)
+
+/*+NoTidScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoTidScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------
+ Nested Loop
+ -> Seq Scan on t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t2_pkey on t2
+ Index Cond: (id = t1.id)
+(5 rows)
+
+/*+HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.id = t2.id)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+/*+NestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+LOG: pg_hint_plan:
+used hint:
+NestLoop(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------
+ Nested Loop
+ -> Seq Scan on t2
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id = t2.id)
+(4 rows)
+
+/*+NoMergeJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+LOG: pg_hint_plan:
+used hint:
+NoMergeJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.id = t2.id)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+/*+MergeJoin(t1 t3)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t3 WHERE t1.val = t3.val;
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(t1 t3)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------
+ Merge Join
+ Merge Cond: (t1.val = t3.val)
+ -> Index Scan using t1_val on t1
+ -> Sort
+ Sort Key: t3.val
+ -> Seq Scan on t3
+(6 rows)
+
+/*+NestLoop(t1 t3)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t3 WHERE t1.val = t3.val;
+LOG: pg_hint_plan:
+used hint:
+NestLoop(t1 t3)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------
+ Nested Loop
+ -> Seq Scan on t3
+ -> Index Scan using t1_val on t1
+ Index Cond: (val = t3.val)
+(4 rows)
+
+/*+NoHashJoin(t1 t3)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t3 WHERE t1.val = t3.val;
+LOG: pg_hint_plan:
+used hint:
+NoHashJoin(t1 t3)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------
+ Nested Loop
+ -> Seq Scan on t3
+ -> Index Scan using t1_val on t1
+ Index Cond: (val = t3.val)
+(4 rows)
+
+/*+MergeJoin(t4 t1 t2 t3)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(t1 t2 t3 t4)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.id = t4.id)
+ -> Merge Join
+ Merge Cond: (t1.id = t3.id)
+ -> Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+ -> Index Scan using t3_pkey on t3
+ -> Sort
+ Sort Key: t4.id
+ -> Seq Scan on t4
+(12 rows)
+
+/*+HashJoin(t3 t4 t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t1 t2 t3 t4)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------------
+ Hash Join
+ Hash Cond: (t3.id = t1.id)
+ -> Seq Scan on t3
+ -> Hash
+ -> Merge Join
+ Merge Cond: (t1.id = t4.id)
+ -> Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+ -> Sort
+ Sort Key: t4.id
+ -> Seq Scan on t4
+(13 rows)
+
+/*+NestLoop(t2 t3 t4 t1) IndexScan(t3)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
+LOG: pg_hint_plan:
+used hint:
+IndexScan(t3)
+NestLoop(t1 t2 t3 t4)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------
+ Nested Loop
+ -> Merge Join
+ Merge Cond: (t1.id = t4.id)
+ -> Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+ -> Sort
+ Sort Key: t4.id
+ -> Seq Scan on t4
+ -> Index Scan using t3_pkey on t3
+ Index Cond: (id = t1.id)
+(12 rows)
+
+/*+NoNestLoop(t4 t1 t3 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
+LOG: pg_hint_plan:
+used hint:
+NoNestLoop(t1 t2 t3 t4)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.id = t4.id)
+ -> Merge Join
+ Merge Cond: (t1.id = t3.id)
+ -> Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+ -> Index Scan using t3_pkey on t3
+ -> Sort
+ Sort Key: t4.id
+ -> Seq Scan on t4
+(12 rows)
+
+/*+Leading( */
+EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
+INFO: hint syntax error at or near ""
+DETAIL: Relation name is necessary.
+ QUERY PLAN
+--------------------------------------------------
+ Nested Loop
+ -> Merge Join
+ Merge Cond: (t1.id = t4.id)
+ -> Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+ -> Sort
+ Sort Key: t4.id
+ -> Seq Scan on t4
+ -> Index Scan using t3_pkey on t3
+ Index Cond: (id = t1.id)
+(12 rows)
+
+/*+Leading( )*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
+INFO: hint syntax error at or near "Leading( )"
+DETAIL: Leading hint requires at least two relations.
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+Leading()
+
+ QUERY PLAN
+--------------------------------------------------
+ Nested Loop
+ -> Merge Join
+ Merge Cond: (t1.id = t4.id)
+ -> Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+ -> Sort
+ Sort Key: t4.id
+ -> Seq Scan on t4
+ -> Index Scan using t3_pkey on t3
+ Index Cond: (id = t1.id)
+(12 rows)
+
+/*+Leading( t3 )*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
+INFO: hint syntax error at or near "Leading( t3 )"
+DETAIL: Leading hint requires at least two relations.
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+Leading(t3)
+
+ QUERY PLAN
+--------------------------------------------------
+ Nested Loop
+ -> Merge Join
+ Merge Cond: (t1.id = t4.id)
+ -> Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+ -> Sort
+ Sort Key: t4.id
+ -> Seq Scan on t4
+ -> Index Scan using t3_pkey on t3
+ Index Cond: (id = t1.id)
+(12 rows)
+
+/*+Leading( t3 t4 )*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
+LOG: pg_hint_plan:
+used hint:
+Leading(t3 t4)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------
+ Nested Loop
+ -> Nested Loop
+ -> Merge Join
+ Merge Cond: (t3.id = t4.id)
+ -> Index Scan using t3_pkey on t3
+ -> Sort
+ Sort Key: t4.id
+ -> Seq Scan on t4
+ -> Index Scan using t2_pkey on t2
+ Index Cond: (id = t3.id)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id = t2.id)
+(12 rows)
+
+/*+Leading(t3 t4 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
+LOG: pg_hint_plan:
+used hint:
+Leading(t3 t4 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------
+ Nested Loop
+ -> Merge Join
+ Merge Cond: (t3.id = t1.id)
+ -> Merge Join
+ Merge Cond: (t3.id = t4.id)
+ -> Index Scan using t3_pkey on t3
+ -> Sort
+ Sort Key: t4.id
+ -> Seq Scan on t4
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+ Index Cond: (id = t1.id)
+(12 rows)
+
+/*+Leading(t3 t4 t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
+LOG: pg_hint_plan:
+used hint:
+Leading(t3 t4 t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------
+ Nested Loop
+ -> Merge Join
+ Merge Cond: (t3.id = t1.id)
+ -> Merge Join
+ Merge Cond: (t3.id = t4.id)
+ -> Index Scan using t3_pkey on t3
+ -> Sort
+ Sort Key: t4.id
+ -> Seq Scan on t4
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+ Index Cond: (id = t1.id)
+(12 rows)
+
+/*+Leading(t3 t4 t1 t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
+LOG: pg_hint_plan:
+used hint:
+Leading(t3 t4 t1 t2 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------
+ Nested Loop
+ -> Merge Join
+ Merge Cond: (t3.id = t1.id)
+ -> Merge Join
+ Merge Cond: (t3.id = t4.id)
+ -> Index Scan using t3_pkey on t3
+ -> Sort
+ Sort Key: t4.id
+ -> Seq Scan on t4
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+ Index Cond: (id = t1.id)
+(12 rows)
+
+/*+Leading(t3 t4 t4)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
+INFO: hint syntax error at or near "Leading(t3 t4 t4)"
+DETAIL: Relation name "t4" is duplicated.
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+Leading(t3 t4 t4)
+
+ QUERY PLAN
+--------------------------------------------------
+ Nested Loop
+ -> Merge Join
+ Merge Cond: (t1.id = t4.id)
+ -> Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+ -> Sort
+ Sort Key: t4.id
+ -> Seq Scan on t4
+ -> Index Scan using t3_pkey on t3
+ Index Cond: (id = t1.id)
+(12 rows)
+
+EXPLAIN (COSTS false) SELECT * FROM t1, (VALUES(1,1),(2,2),(3,3)) AS t2(id,val) WHERE t1.id = t2.id;
+ QUERY PLAN
+-----------------------------------------------
+ Nested Loop
+ -> Values Scan on "*VALUES*"
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id = "*VALUES*".column1)
+(4 rows)
+
+/*+HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, (VALUES(1,1),(2,2),(3,3)) AS t2(id,val) WHERE t1.id = t2.id;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+HashJoin(t1 t2)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------
+ Nested Loop
+ -> Values Scan on "*VALUES*"
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id = "*VALUES*".column1)
+(4 rows)
+
+/*+HashJoin(t1 *VALUES*)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, (VALUES(1,1),(2,2),(3,3)) AS t2(id,val) WHERE t1.id = t2.id;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(*VALUES* t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------
+ Hash Join
+ Hash Cond: (t1.id = "*VALUES*".column1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Values Scan on "*VALUES*"
+(5 rows)
+
+/*+HashJoin(t1 *VALUES*) IndexScan(t1) IndexScan(*VALUES*)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, (VALUES(1,1),(2,2),(3,3)) AS t2(id,val) WHERE t1.id = t2.id;
+LOG: pg_hint_plan:
+used hint:
+IndexScan(t1)
+HashJoin(*VALUES* t1)
+not used hint:
+IndexScan(*VALUES*)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------
+ Hash Join
+ Hash Cond: (t1.id = "*VALUES*".column1)
+ -> Index Scan using t1_pkey on t1
+ -> Hash
+ -> Values Scan on "*VALUES*"
+(5 rows)
+
+-- single table scan hint test
+EXPLAIN SELECT (SELECT max(id) FROM t1 v_1 WHERE id < 10), id FROM v1 WHERE v1.id = (SELECT max(id) FROM t1 v_2 WHERE id < 10);
+ QUERY PLAN
+----------------------------------------------------------------------------------------------------------
+ Index Only Scan using t1_pkey on t1 (cost=1.90..10.18 rows=1 width=4)
+ Index Cond: (id = $3)
+ InitPlan 2 (returns $1)
+ -> Result (cost=0.94..0.95 rows=1 width=0)
+ InitPlan 1 (returns $0)
+ -> Limit (cost=0.00..0.94 rows=1 width=4)
+ -> Index Only Scan Backward using t1_pkey on t1 v_1 (cost=0.00..8.44 rows=9 width=4)
+ Index Cond: ((id IS NOT NULL) AND (id < 10))
+ InitPlan 4 (returns $3)
+ -> Result (cost=0.94..0.95 rows=1 width=0)
+ InitPlan 3 (returns $2)
+ -> Limit (cost=0.00..0.94 rows=1 width=4)
+ -> Index Only Scan Backward using t1_pkey on t1 v_2 (cost=0.00..8.44 rows=9 width=4)
+ Index Cond: ((id IS NOT NULL) AND (id < 10))
+(14 rows)
+
+/*+BitmapScan(v_1)*/
+EXPLAIN SELECT (SELECT max(id) FROM t1 v_1 WHERE id < 10), id FROM v1 WHERE v1.id = (SELECT max(id) FROM t1 v_2 WHERE id < 10);
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(v_1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------------------------------------------------------------------
+ Index Only Scan using t1_pkey on t1 (cost=29.35..37.63 rows=1 width=4)
+ Index Cond: (id = $2)
+ InitPlan 1 (returns $0)
+ -> Aggregate (cost=28.39..28.40 rows=1 width=4)
+ -> Bitmap Heap Scan on t1 v_1 (cost=4.33..28.37 rows=9 width=4)
+ Recheck Cond: (id < 10)
+ -> Bitmap Index Scan on t1_pkey (cost=0.00..4.33 rows=9 width=0)
+ Index Cond: (id < 10)
+ InitPlan 3 (returns $2)
+ -> Result (cost=0.94..0.95 rows=1 width=0)
+ InitPlan 2 (returns $1)
+ -> Limit (cost=0.00..0.94 rows=1 width=4)
+ -> Index Only Scan Backward using t1_pkey on t1 v_2 (cost=0.00..8.44 rows=9 width=4)
+ Index Cond: ((id IS NOT NULL) AND (id < 10))
+(14 rows)
+
+/*+BitmapScan(v_2)*/
+EXPLAIN SELECT (SELECT max(id) FROM t1 v_1 WHERE id < 10), id FROM v1 WHERE v1.id = (SELECT max(id) FROM t1 v_2 WHERE id < 10);
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(v_2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------------------------------------------------------------------
+ Index Only Scan using t1_pkey on t1 (cost=29.35..37.63 rows=1 width=4)
+ Index Cond: (id = $2)
+ InitPlan 2 (returns $1)
+ -> Result (cost=0.94..0.95 rows=1 width=0)
+ InitPlan 1 (returns $0)
+ -> Limit (cost=0.00..0.94 rows=1 width=4)
+ -> Index Only Scan Backward using t1_pkey on t1 v_1 (cost=0.00..8.44 rows=9 width=4)
+ Index Cond: ((id IS NOT NULL) AND (id < 10))
+ InitPlan 3 (returns $2)
+ -> Aggregate (cost=28.39..28.40 rows=1 width=4)
+ -> Bitmap Heap Scan on t1 v_2 (cost=4.33..28.37 rows=9 width=4)
+ Recheck Cond: (id < 10)
+ -> Bitmap Index Scan on t1_pkey (cost=0.00..4.33 rows=9 width=0)
+ Index Cond: (id < 10)
+(14 rows)
+
+/*+BitmapScan(t1)*/
+EXPLAIN SELECT (SELECT max(id) FROM t1 v_1 WHERE id < 10), id FROM v1 WHERE v1.id = (SELECT max(id) FROM t1 v_2 WHERE id < 10);
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------------------------------------------------------------------
+ Bitmap Heap Scan on t1 (cost=6.17..10.18 rows=1 width=4)
+ Recheck Cond: (id = $3)
+ InitPlan 2 (returns $1)
+ -> Result (cost=0.94..0.95 rows=1 width=0)
+ InitPlan 1 (returns $0)
+ -> Limit (cost=0.00..0.94 rows=1 width=4)
+ -> Index Only Scan Backward using t1_pkey on t1 v_1 (cost=0.00..8.44 rows=9 width=4)
+ Index Cond: ((id IS NOT NULL) AND (id < 10))
+ InitPlan 4 (returns $3)
+ -> Result (cost=0.94..0.95 rows=1 width=0)
+ InitPlan 3 (returns $2)
+ -> Limit (cost=0.00..0.94 rows=1 width=4)
+ -> Index Only Scan Backward using t1_pkey on t1 v_2 (cost=0.00..8.44 rows=9 width=4)
+ Index Cond: ((id IS NOT NULL) AND (id < 10))
+ -> Bitmap Index Scan on t1_pkey (cost=0.00..4.27 rows=1 width=0)
+ Index Cond: (id = $3)
+(16 rows)
+
+/*+BitmapScan(v_1)BitmapScan(v_2)*/
+EXPLAIN SELECT (SELECT max(id) FROM t1 v_1 WHERE id < 10), id FROM v1 WHERE v1.id = (SELECT max(id) FROM t1 v_2 WHERE id < 10);
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(v_1)
+BitmapScan(v_2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------------------------------------
+ Index Only Scan using t1_pkey on t1 (cost=56.80..65.08 rows=1 width=4)
+ Index Cond: (id = $1)
+ InitPlan 1 (returns $0)
+ -> Aggregate (cost=28.39..28.40 rows=1 width=4)
+ -> Bitmap Heap Scan on t1 v_1 (cost=4.33..28.37 rows=9 width=4)
+ Recheck Cond: (id < 10)
+ -> Bitmap Index Scan on t1_pkey (cost=0.00..4.33 rows=9 width=0)
+ Index Cond: (id < 10)
+ InitPlan 2 (returns $1)
+ -> Aggregate (cost=28.39..28.40 rows=1 width=4)
+ -> Bitmap Heap Scan on t1 v_2 (cost=4.33..28.37 rows=9 width=4)
+ Recheck Cond: (id < 10)
+ -> Bitmap Index Scan on t1_pkey (cost=0.00..4.33 rows=9 width=0)
+ Index Cond: (id < 10)
+(14 rows)
+
+/*+BitmapScan(v_1)BitmapScan(t1)*/
+EXPLAIN SELECT (SELECT max(id) FROM t1 v_1 WHERE id < 10), id FROM v1 WHERE v1.id = (SELECT max(id) FROM t1 v_2 WHERE id < 10);
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+BitmapScan(v_1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------------------------------------------------------------------
+ Bitmap Heap Scan on t1 (cost=33.62..37.63 rows=1 width=4)
+ Recheck Cond: (id = $2)
+ InitPlan 1 (returns $0)
+ -> Aggregate (cost=28.39..28.40 rows=1 width=4)
+ -> Bitmap Heap Scan on t1 v_1 (cost=4.33..28.37 rows=9 width=4)
+ Recheck Cond: (id < 10)
+ -> Bitmap Index Scan on t1_pkey (cost=0.00..4.33 rows=9 width=0)
+ Index Cond: (id < 10)
+ InitPlan 3 (returns $2)
+ -> Result (cost=0.94..0.95 rows=1 width=0)
+ InitPlan 2 (returns $1)
+ -> Limit (cost=0.00..0.94 rows=1 width=4)
+ -> Index Only Scan Backward using t1_pkey on t1 v_2 (cost=0.00..8.44 rows=9 width=4)
+ Index Cond: ((id IS NOT NULL) AND (id < 10))
+ -> Bitmap Index Scan on t1_pkey (cost=0.00..4.27 rows=1 width=0)
+ Index Cond: (id = $2)
+(16 rows)
+
+/*+BitmapScan(v_2)BitmapScan(t1)*/
+EXPLAIN SELECT (SELECT max(id) FROM t1 v_1 WHERE id < 10), id FROM v1 WHERE v1.id = (SELECT max(id) FROM t1 v_2 WHERE id < 10);
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+BitmapScan(v_2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------------------------------------------------------------------
+ Bitmap Heap Scan on t1 (cost=33.62..37.63 rows=1 width=4)
+ Recheck Cond: (id = $2)
+ InitPlan 2 (returns $1)
+ -> Result (cost=0.94..0.95 rows=1 width=0)
+ InitPlan 1 (returns $0)
+ -> Limit (cost=0.00..0.94 rows=1 width=4)
+ -> Index Only Scan Backward using t1_pkey on t1 v_1 (cost=0.00..8.44 rows=9 width=4)
+ Index Cond: ((id IS NOT NULL) AND (id < 10))
+ InitPlan 3 (returns $2)
+ -> Aggregate (cost=28.39..28.40 rows=1 width=4)
+ -> Bitmap Heap Scan on t1 v_2 (cost=4.33..28.37 rows=9 width=4)
+ Recheck Cond: (id < 10)
+ -> Bitmap Index Scan on t1_pkey (cost=0.00..4.33 rows=9 width=0)
+ Index Cond: (id < 10)
+ -> Bitmap Index Scan on t1_pkey (cost=0.00..4.27 rows=1 width=0)
+ Index Cond: (id = $2)
+(16 rows)
+
+/*+BitmapScan(v_1)BitmapScan(v_2)BitmapScan(t1)*/
+EXPLAIN SELECT (SELECT max(id) FROM t1 v_1 WHERE id < 10), id FROM v1 WHERE v1.id = (SELECT max(id) FROM t1 v_2 WHERE id < 10);
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+BitmapScan(v_1)
+BitmapScan(v_2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------------------------------------
+ Bitmap Heap Scan on t1 (cost=61.07..65.09 rows=1 width=4)
+ Recheck Cond: (id = $1)
+ InitPlan 1 (returns $0)
+ -> Aggregate (cost=28.39..28.40 rows=1 width=4)
+ -> Bitmap Heap Scan on t1 v_1 (cost=4.33..28.37 rows=9 width=4)
+ Recheck Cond: (id < 10)
+ -> Bitmap Index Scan on t1_pkey (cost=0.00..4.33 rows=9 width=0)
+ Index Cond: (id < 10)
+ InitPlan 2 (returns $1)
+ -> Aggregate (cost=28.39..28.40 rows=1 width=4)
+ -> Bitmap Heap Scan on t1 v_2 (cost=4.33..28.37 rows=9 width=4)
+ Recheck Cond: (id < 10)
+ -> Bitmap Index Scan on t1_pkey (cost=0.00..4.33 rows=9 width=0)
+ Index Cond: (id < 10)
+ -> Bitmap Index Scan on t1_pkey (cost=0.00..4.27 rows=1 width=0)
+ Index Cond: (id = $1)
+(16 rows)
+
+-- full scan hint pattern test
+EXPLAIN (COSTS false) SELECT * FROM t1 WHERE id < 10 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (id < 10)
+(3 rows)
+
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1 WHERE id < 10 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------
+ Seq Scan on t1
+ Filter: ((id < 10) AND (ctid = '(1,1)'::tid))
+(2 rows)
+
+/*+IndexScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1 WHERE id < 10 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------
+ Index Scan using t1_pkey on t1
+ Index Cond: (id < 10)
+ Filter: (ctid = '(1,1)'::tid)
+(3 rows)
+
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1 WHERE id < 10 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (id < 10)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: (id < 10)
+(5 rows)
+
+/*+TidScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1 WHERE id < 10 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+TidScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (id < 10)
+(3 rows)
+
+/*+NoSeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1 WHERE id < 10 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoSeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (id < 10)
+(3 rows)
+
+/*+NoIndexScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1 WHERE id < 10 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoIndexScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (id < 10)
+(3 rows)
+
+/*+NoBitmapScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1 WHERE id < 10 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoBitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (id < 10)
+(3 rows)
+
+/*+NoTidScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1 WHERE id < 10 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoTidScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------
+ Index Scan using t1_pkey on t1
+ Index Cond: (id < 10)
+ Filter: (ctid = '(1,1)'::tid)
+(3 rows)
+
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Seq Scan on t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+SeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+SeqScan(t1) SeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+SeqScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Seq Scan on t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+SeqScan(t1) IndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+IndexScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------
+ Nested Loop
+ -> Seq Scan on t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t2_pkey on t2
+ Index Cond: (id = t1.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+SeqScan(t1) BitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+BitmapScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Seq Scan on t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t2
+ Recheck Cond: (id = t1.id)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t2_pkey
+ Index Cond: (id = t1.id)
+(8 rows)
+
+/*+SeqScan(t1) TidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+TidScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Seq Scan on t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+SeqScan(t1) NoSeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+NoSeqScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Seq Scan on t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+SeqScan(t1) NoIndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+NoIndexScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Seq Scan on t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+SeqScan(t1) NoBitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+NoBitmapScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Seq Scan on t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+SeqScan(t1) NoTidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+NoTidScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------
+ Nested Loop
+ -> Seq Scan on t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t2_pkey on t2
+ Index Cond: (id = t1.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+IndexScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+IndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Index Scan using t2_pkey on t2
+ Index Cond: (id = t1.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+IndexScan(t1) SeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(t1)
+SeqScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------
+ Nested Loop
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+IndexScan(t1) IndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(t1)
+IndexScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------
+ Nested Loop
+ -> Index Scan using t2_pkey on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+IndexScan(t1) BitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(t1)
+BitmapScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Index Scan using t1_pkey on t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t2
+ Recheck Cond: (id = t1.id)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t2_pkey
+ Index Cond: (id = t1.id)
+(8 rows)
+
+/*+IndexScan(t1) TidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(t1)
+TidScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+IndexScan(t1) NoSeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(t1)
+NoSeqScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+IndexScan(t1) NoIndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(t1)
+NoIndexScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+IndexScan(t1) NoBitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(t1)
+NoBitmapScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+IndexScan(t1) NoTidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(t1)
+NoTidScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------
+ Nested Loop
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t1
+ Recheck Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: (id = t2.id)
+(8 rows)
+
+/*+BitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t2
+ Recheck Cond: (id = t1.id)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t2_pkey
+ Index Cond: (id = t1.id)
+(8 rows)
+
+/*+BitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t2
+ Recheck Cond: (id = t1.id)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t2_pkey
+ Index Cond: (id = t1.id)
+(8 rows)
+
+/*+BitmapScan(t1) SeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+SeqScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t1
+ Recheck Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: (id = t2.id)
+(8 rows)
+
+/*+BitmapScan(t1) IndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+IndexScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Index Scan using t2_pkey on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t1
+ Recheck Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: (id = t2.id)
+(8 rows)
+
+/*+BitmapScan(t1) BitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+BitmapScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Index Scan using t2_pkey on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t1
+ Recheck Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: (id = t2.id)
+(8 rows)
+
+/*+BitmapScan(t1) TidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+TidScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t1
+ Recheck Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: (id = t2.id)
+(8 rows)
+
+/*+BitmapScan(t1) NoSeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+NoSeqScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t1
+ Recheck Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: (id = t2.id)
+(8 rows)
+
+/*+BitmapScan(t1) NoIndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+NoIndexScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t1
+ Recheck Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: (id = t2.id)
+(8 rows)
+
+/*+BitmapScan(t1) NoBitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+NoBitmapScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t1
+ Recheck Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: (id = t2.id)
+(8 rows)
+
+/*+BitmapScan(t1) NoTidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+NoTidScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t1
+ Recheck Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: (id = t2.id)
+(8 rows)
+
+/*+TidScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+TidScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+TidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+TidScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+TidScan(t1) SeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+TidScan(t1)
+SeqScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+TidScan(t1) IndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+TidScan(t1)
+IndexScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Index Scan using t2_pkey on t2
+ Index Cond: (id = t1.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+TidScan(t1) BitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+TidScan(t1)
+BitmapScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t2
+ Recheck Cond: (id = t1.id)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t2_pkey
+ Index Cond: (id = t1.id)
+(8 rows)
+
+/*+TidScan(t1) TidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+TidScan(t1)
+TidScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+TidScan(t1) NoSeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+TidScan(t1)
+NoSeqScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+TidScan(t1) NoIndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+TidScan(t1)
+NoIndexScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+TidScan(t1) NoBitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+TidScan(t1)
+NoBitmapScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+TidScan(t1) NoTidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+TidScan(t1)
+NoTidScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Index Scan using t2_pkey on t2
+ Index Cond: (id = t1.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoSeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoSeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoSeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoSeqScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoSeqScan(t1) SeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoSeqScan(t1)
+SeqScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoSeqScan(t1) IndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoSeqScan(t1)
+IndexScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Index Scan using t2_pkey on t2
+ Index Cond: (id = t1.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoSeqScan(t1) BitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoSeqScan(t1)
+BitmapScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t2
+ Recheck Cond: (id = t1.id)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t2_pkey
+ Index Cond: (id = t1.id)
+(8 rows)
+
+/*+NoSeqScan(t1) TidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoSeqScan(t1)
+TidScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoSeqScan(t1) NoSeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoSeqScan(t1)
+NoSeqScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoSeqScan(t1) NoIndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoSeqScan(t1)
+NoIndexScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoSeqScan(t1) NoBitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoSeqScan(t1)
+NoBitmapScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoSeqScan(t1) NoTidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoSeqScan(t1)
+NoTidScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Index Scan using t2_pkey on t2
+ Index Cond: (id = t1.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoIndexScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoIndexScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoIndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoIndexScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoIndexScan(t1) SeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoIndexScan(t1)
+SeqScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoIndexScan(t1) IndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoIndexScan(t1)
+IndexScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Index Scan using t2_pkey on t2
+ Index Cond: (id = t1.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoIndexScan(t1) BitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoIndexScan(t1)
+BitmapScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t2
+ Recheck Cond: (id = t1.id)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t2_pkey
+ Index Cond: (id = t1.id)
+(8 rows)
+
+/*+NoIndexScan(t1) TidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoIndexScan(t1)
+TidScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoIndexScan(t1) NoSeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoIndexScan(t1)
+NoSeqScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoIndexScan(t1) NoIndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoIndexScan(t1)
+NoIndexScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoIndexScan(t1) NoBitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoIndexScan(t1)
+NoBitmapScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoIndexScan(t1) NoTidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoIndexScan(t1)
+NoTidScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Index Scan using t2_pkey on t2
+ Index Cond: (id = t1.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoBitmapScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoBitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoBitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoBitmapScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoBitmapScan(t1) SeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoBitmapScan(t1)
+SeqScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoBitmapScan(t1) IndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoBitmapScan(t1)
+IndexScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Index Scan using t2_pkey on t2
+ Index Cond: (id = t1.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoBitmapScan(t1) BitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoBitmapScan(t1)
+BitmapScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t2
+ Recheck Cond: (id = t1.id)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t2_pkey
+ Index Cond: (id = t1.id)
+(8 rows)
+
+/*+NoBitmapScan(t1) TidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoBitmapScan(t1)
+TidScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoBitmapScan(t1) NoSeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoBitmapScan(t1)
+NoSeqScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoBitmapScan(t1) NoIndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoBitmapScan(t1)
+NoIndexScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoBitmapScan(t1) NoBitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoBitmapScan(t1)
+NoBitmapScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoBitmapScan(t1) NoTidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoBitmapScan(t1)
+NoTidScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Index Scan using t2_pkey on t2
+ Index Cond: (id = t1.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoTidScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoTidScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoTidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoTidScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Index Scan using t2_pkey on t2
+ Index Cond: (id = t1.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoTidScan(t1) SeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoTidScan(t1)
+SeqScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------
+ Nested Loop
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoTidScan(t1) IndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoTidScan(t1)
+IndexScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------
+ Nested Loop
+ -> Index Scan using t2_pkey on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoTidScan(t1) BitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoTidScan(t1)
+BitmapScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Seq Scan on t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t2
+ Recheck Cond: (id = t1.id)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t2_pkey
+ Index Cond: (id = t1.id)
+(8 rows)
+
+/*+NoTidScan(t1) TidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoTidScan(t1)
+TidScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoTidScan(t1) NoSeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoTidScan(t1)
+NoSeqScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoTidScan(t1) NoIndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoTidScan(t1)
+NoIndexScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoTidScan(t1) NoBitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoTidScan(t1)
+NoBitmapScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+/*+NoTidScan(t1) NoTidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoTidScan(t1)
+NoTidScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------
+ Nested Loop
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id = t2.id)
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+-- additional test
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)' AND t1.id < 10 AND t2.id < 10;
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.id = t2.id)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (id < 10)
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (id < 10)
+(8 rows)
+
+/*+BitmapScan(t1) BitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)' AND t1.id < 10 AND t2.id < 10;
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+BitmapScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------------
+ Nested Loop
+ -> Bitmap Heap Scan on t2
+ Recheck Cond: (id < 10)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t2_pkey
+ Index Cond: (id < 10)
+ -> Bitmap Heap Scan on t1
+ Recheck Cond: ((id = t2.id) AND (id < 10))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: ((id = t2.id) AND (id < 10))
+(11 rows)
+
+-- outer join test
+EXPLAIN (COSTS false) SELECT * FROM t1 FULL OUTER JOIN t2 ON (t1.id = t2.id);
+ QUERY PLAN
+------------------------------
+ Hash Full Join
+ Hash Cond: (t1.id = t2.id)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+/*+MergeJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1 FULL OUTER JOIN t2 ON (t1.id = t2.id);
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------
+ Merge Full Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+(4 rows)
+
+/*+NestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1 FULL OUTER JOIN t2 ON (t1.id = t2.id);
+LOG: pg_hint_plan:
+used hint:
+NestLoop(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------
+ Merge Full Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+(4 rows)
+
+-- inherite table test
+SET constraint_exclusion TO off;
+EXPLAIN (COSTS false) SELECT * FROM p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------------------
+ Result
+ -> Append
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c2 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c3 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Tid Scan on p1_c4 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c3_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c3_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+(25 rows)
+
+SET constraint_exclusion TO on;
+EXPLAIN (COSTS false) SELECT * FROM p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------------------
+ Result
+ -> Append
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Tid Scan on p1_c1_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+(12 rows)
+
+SET constraint_exclusion TO off;
+/*+SeqScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+SeqScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------
+ Result
+ -> Append
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c2 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c3 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c4 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1_c1 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1_c2 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c3_c1 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c3_c2 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+(20 rows)
+
+/*+IndexScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------
+ Result
+ -> Append
+ -> Index Scan using p1_pkey on p1
+ Index Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using p1_c1_pkey on p1_c1 p1
+ Index Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using p1_c2_pkey on p1_c2 p1
+ Index Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using p1_c3_pkey on p1_c3 p1
+ Index Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using p1_c4_pkey on p1_c4 p1
+ Index Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using p1_c1_c1_pkey on p1_c1_c1 p1
+ Index Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using p1_c1_c2_pkey on p1_c1_c2 p1
+ Index Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using p1_c3_c1_pkey on p1_c3_c1 p1
+ Index Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using p1_c3_c2_pkey on p1_c3_c2 p1
+ Index Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+(29 rows)
+
+/*+BitmapScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------------
+ Result
+ -> Append
+ -> Bitmap Heap Scan on p1
+ Recheck Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on p1_pkey
+ Index Cond: ((id >= 50) AND (id <= 51))
+ -> Bitmap Heap Scan on p1_c1 p1
+ Recheck Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on p1_c1_pkey
+ Index Cond: ((id >= 50) AND (id <= 51))
+ -> Bitmap Heap Scan on p1_c2 p1
+ Recheck Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on p1_c2_pkey
+ Index Cond: ((id >= 50) AND (id <= 51))
+ -> Bitmap Heap Scan on p1_c3 p1
+ Recheck Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on p1_c3_pkey
+ Index Cond: ((id >= 50) AND (id <= 51))
+ -> Bitmap Heap Scan on p1_c4 p1
+ Recheck Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on p1_c4_pkey
+ Index Cond: ((id >= 50) AND (id <= 51))
+ -> Bitmap Heap Scan on p1_c1_c1 p1
+ Recheck Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on p1_c1_c1_pkey
+ Index Cond: ((id >= 50) AND (id <= 51))
+ -> Bitmap Heap Scan on p1_c1_c2 p1
+ Recheck Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on p1_c1_c2_pkey
+ Index Cond: ((id >= 50) AND (id <= 51))
+ -> Bitmap Heap Scan on p1_c3_c1 p1
+ Recheck Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on p1_c3_c1_pkey
+ Index Cond: ((id >= 50) AND (id <= 51))
+ -> Bitmap Heap Scan on p1_c3_c2 p1
+ Recheck Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on p1_c3_c2_pkey
+ Index Cond: ((id >= 50) AND (id <= 51))
+(47 rows)
+
+/*+TidScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+TidScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------
+ Result
+ -> Append
+ -> Tid Scan on p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c3 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c4 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c3_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c3_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+(29 rows)
+
+SET constraint_exclusion TO on;
+/*+SeqScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+SeqScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------
+ Result
+ -> Append
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1_c1 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1_c2 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+(10 rows)
+
+/*+IndexScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------
+ Result
+ -> Append
+ -> Index Scan using p1_pkey on p1
+ Index Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using p1_c1_pkey on p1_c1 p1
+ Index Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using p1_c1_c1_pkey on p1_c1_c1 p1
+ Index Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using p1_c1_c2_pkey on p1_c1_c2 p1
+ Index Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+(14 rows)
+
+/*+BitmapScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------------
+ Result
+ -> Append
+ -> Bitmap Heap Scan on p1
+ Recheck Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on p1_pkey
+ Index Cond: ((id >= 50) AND (id <= 51))
+ -> Bitmap Heap Scan on p1_c1 p1
+ Recheck Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on p1_c1_pkey
+ Index Cond: ((id >= 50) AND (id <= 51))
+ -> Bitmap Heap Scan on p1_c1_c1 p1
+ Recheck Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on p1_c1_c1_pkey
+ Index Cond: ((id >= 50) AND (id <= 51))
+ -> Bitmap Heap Scan on p1_c1_c2 p1
+ Recheck Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on p1_c1_c2_pkey
+ Index Cond: ((id >= 50) AND (id <= 51))
+(22 rows)
+
+/*+TidScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+TidScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------
+ Result
+ -> Append
+ -> Tid Scan on p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+(14 rows)
+
+SET constraint_exclusion TO off;
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+ QUERY PLAN
+-----------------------------------------------------------------------------------
+ Merge Join
+ Merge Cond: (public.p1.id = t1.id)
+ -> Sort
+ Sort Key: public.p1.id
+ -> Append
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c2 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c3 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Tid Scan on p1_c4 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c3_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c3_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id < 10)
+(30 rows)
+
+SET constraint_exclusion TO on;
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+ QUERY PLAN
+-----------------------------------------------------------------------------------
+ Merge Join
+ Merge Cond: (public.p1.id = t1.id)
+ -> Sort
+ Sort Key: public.p1.id
+ -> Append
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Tid Scan on p1_c1_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id < 10)
+(17 rows)
+
+SET constraint_exclusion TO off;
+/*+SeqScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------------
+ Merge Join
+ Merge Cond: (public.p1.id = t1.id)
+ -> Sort
+ Sort Key: public.p1.id
+ -> Append
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c2 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c3 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Tid Scan on p1_c4 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c3_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c3_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id < 10)
+(30 rows)
+
+/*+IndexScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+IndexScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------------
+ Merge Join
+ Merge Cond: (public.p1.id = t1.id)
+ -> Sort
+ Sort Key: public.p1.id
+ -> Append
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c2 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c3 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Tid Scan on p1_c4 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c3_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c3_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id < 10)
+(30 rows)
+
+/*+BitmapScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------------
+ Merge Join
+ Merge Cond: (public.p1.id = t1.id)
+ -> Sort
+ Sort Key: public.p1.id
+ -> Append
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c2 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c3 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Tid Scan on p1_c4 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c3_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c3_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id < 10)
+(30 rows)
+
+/*+TidScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+TidScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------------
+ Merge Join
+ Merge Cond: (public.p1.id = t1.id)
+ -> Sort
+ Sort Key: public.p1.id
+ -> Append
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c2 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c3 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Tid Scan on p1_c4 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c3_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c3_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id < 10)
+(30 rows)
+
+/*+NestLoop(p1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+NestLoop(p1 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------
+ Nested Loop
+ Join Filter: (public.p1.id = t1.id)
+ -> Append
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c2 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c3 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Tid Scan on p1_c4 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c3_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c3_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Materialize
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id < 10)
+(29 rows)
+
+/*+MergeJoin(p1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(p1 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------------
+ Merge Join
+ Merge Cond: (public.p1.id = t1.id)
+ -> Sort
+ Sort Key: public.p1.id
+ -> Append
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c2 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c3 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Tid Scan on p1_c4 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c3_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c3_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id < 10)
+(30 rows)
+
+/*+HashJoin(p1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(p1 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------
+ Hash Join
+ Hash Cond: (public.p1.id = t1.id)
+ -> Append
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c2 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c3 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Tid Scan on p1_c4 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c3_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c3_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Hash
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id < 10)
+(29 rows)
+
+SET constraint_exclusion TO on;
+/*+SeqScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------------
+ Merge Join
+ Merge Cond: (public.p1.id = t1.id)
+ -> Sort
+ Sort Key: public.p1.id
+ -> Append
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Tid Scan on p1_c1_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id < 10)
+(17 rows)
+
+/*+IndexScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+IndexScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------------
+ Merge Join
+ Merge Cond: (public.p1.id = t1.id)
+ -> Sort
+ Sort Key: public.p1.id
+ -> Append
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Tid Scan on p1_c1_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id < 10)
+(17 rows)
+
+/*+BitmapScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------------
+ Merge Join
+ Merge Cond: (public.p1.id = t1.id)
+ -> Sort
+ Sort Key: public.p1.id
+ -> Append
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Tid Scan on p1_c1_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id < 10)
+(17 rows)
+
+/*+TidScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+TidScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------------
+ Merge Join
+ Merge Cond: (public.p1.id = t1.id)
+ -> Sort
+ Sort Key: public.p1.id
+ -> Append
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Tid Scan on p1_c1_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id < 10)
+(17 rows)
+
+/*+NestLoop(p1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+NestLoop(p1 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------------
+ Nested Loop
+ Join Filter: (public.p1.id = t1.id)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id < 10)
+ -> Materialize
+ -> Append
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Tid Scan on p1_c1_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+(16 rows)
+
+/*+MergeJoin(p1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(p1 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------------
+ Merge Join
+ Merge Cond: (public.p1.id = t1.id)
+ -> Sort
+ Sort Key: public.p1.id
+ -> Append
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Tid Scan on p1_c1_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id < 10)
+(17 rows)
+
+/*+HashJoin(p1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(p1 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------------
+ Hash Join
+ Hash Cond: (t1.id = public.p1.id)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id < 10)
+ -> Hash
+ -> Append
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Seq Scan on p1_c1 p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Tid Scan on p1_c1_c1 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Tid Scan on p1_c1_c2 p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+(16 rows)
+
+SET constraint_exclusion TO off;
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+(2 rows)
+
+SET constraint_exclusion TO on;
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+(2 rows)
+
+SET constraint_exclusion TO off;
+/*+SeqScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+SeqScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------
+ Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+(2 rows)
+
+/*+IndexScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------
+ Index Scan using p1_pkey on p1
+ Index Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+(3 rows)
+
+/*+BitmapScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------
+ Bitmap Heap Scan on p1
+ Recheck Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on p1_pkey
+ Index Cond: ((id >= 50) AND (id <= 51))
+(5 rows)
+
+/*+TidScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+TidScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------
+ Tid Scan on p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+(3 rows)
+
+/*+NestLoop(p1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+NestLoop(p1 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------
+ Nested Loop
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: ((id = p1.id) AND (id < 10))
+(5 rows)
+
+/*+MergeJoin(p1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(p1 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------
+ Merge Join
+ Merge Cond: (p1.id = t1.id)
+ -> Sort
+ Sort Key: p1.id
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id < 10)
+(8 rows)
+
+/*+HashJoin(p1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(p1 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------
+ Hash Join
+ Hash Cond: (t1.id = p1.id)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id < 10)
+ -> Hash
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+(7 rows)
+
+SET constraint_exclusion TO on;
+/*+SeqScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+SeqScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------
+ Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+(2 rows)
+
+/*+IndexScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------
+ Index Scan using p1_pkey on p1
+ Index Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+(3 rows)
+
+/*+BitmapScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------
+ Bitmap Heap Scan on p1
+ Recheck Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on p1_pkey
+ Index Cond: ((id >= 50) AND (id <= 51))
+(5 rows)
+
+/*+TidScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+TidScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------
+ Tid Scan on p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+(3 rows)
+
+/*+NestLoop(p1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+NestLoop(p1 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------
+ Nested Loop
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: ((id = p1.id) AND (id < 10))
+(5 rows)
+
+/*+MergeJoin(p1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(p1 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------
+ Merge Join
+ Merge Cond: (p1.id = t1.id)
+ -> Sort
+ Sort Key: p1.id
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id < 10)
+(8 rows)
+
+/*+HashJoin(p1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(p1 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------
+ Hash Join
+ Hash Cond: (t1.id = p1.id)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (id < 10)
+ -> Hash
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+(7 rows)
+
+SET constraint_exclusion TO off;
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+ QUERY PLAN
+-----------------------------------------------------------------------
+ Nested Loop
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: ((id = p1.id) AND (id < 10))
+(5 rows)
+
+SET constraint_exclusion TO on;
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+ QUERY PLAN
+-----------------------------------------------------------------------
+ Nested Loop
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: ((id = p1.id) AND (id < 10))
+(5 rows)
+
+SET constraint_exclusion TO off;
+/*+SeqScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------
+ Nested Loop
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: ((id = p1.id) AND (id < 10))
+(5 rows)
+
+/*+IndexScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+IndexScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------
+ Nested Loop
+ -> Index Scan using p1_pkey on p1
+ Index Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: ((id = p1.id) AND (id < 10))
+(6 rows)
+
+/*+BitmapScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------
+ Nested Loop
+ -> Bitmap Heap Scan on p1
+ Recheck Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on p1_pkey
+ Index Cond: ((id >= 50) AND (id <= 51))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: ((id = p1.id) AND (id < 10))
+(8 rows)
+
+/*+TidScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+TidScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------
+ Nested Loop
+ -> Tid Scan on p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: ((id = p1.id) AND (id < 10))
+(6 rows)
+
+SET constraint_exclusion TO on;
+/*+SeqScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------
+ Nested Loop
+ -> Seq Scan on p1
+ Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: ((id = p1.id) AND (id < 10))
+(5 rows)
+
+/*+IndexScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+IndexScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------
+ Nested Loop
+ -> Index Scan using p1_pkey on p1
+ Index Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: ((id = p1.id) AND (id < 10))
+(6 rows)
+
+/*+BitmapScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------
+ Nested Loop
+ -> Bitmap Heap Scan on p1
+ Recheck Cond: ((id >= 50) AND (id <= 51))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on p1_pkey
+ Index Cond: ((id >= 50) AND (id <= 51))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: ((id = p1.id) AND (id < 10))
+(8 rows)
+
+/*+TidScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+LOG: pg_hint_plan:
+used hint:
+TidScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------
+ Nested Loop
+ -> Tid Scan on p1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((id >= 50) AND (id <= 51))
+ -> Index Scan using t1_pkey on t1
+ Index Cond: ((id = p1.id) AND (id < 10))
+(6 rows)
+
+-- quote test
+/*+SeqScan("""t1 ) ")IndexScan("t 2 """)HashJoin("""t1 ) "T3"t 2 """)Leading("""t1 ) "T3"t 2 """)Set(application_name"a a a"" a A")*/
+EXPLAIN (COSTS false) SELECT * FROM t1 """t1 ) ", t2 "t 2 """, t3 "T3" WHERE """t1 ) ".id = "t 2 """.id AND """t1 ) ".id = "T3".id;
+LOG: pg_hint_plan:
+used hint:
+SeqScan("""t1 ) ")
+IndexScan("t 2 """)
+HashJoin("""t1 ) " T3 "t 2 """)
+Leading("""t1 ) " T3 "t 2 """)
+Set(application_name "a a a"" a A")
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------
+ Hash Join
+ Hash Cond: ("t 2 """.id = """t1 ) ".id)
+ -> Index Scan using t2_pkey on t2 "t 2 """
+ -> Hash
+ -> Hash Join
+ Hash Cond: ("""t1 ) ".id = "T3".id)
+ -> Seq Scan on t1 """t1 ) "
+ -> Hash
+ -> Seq Scan on t3 "T3"
+(9 rows)
+
+-- duplicate hint test
+/*+SeqScan(t1)SeqScan(t2)IndexScan(t1)IndexScan(t2)BitmapScan(t1)BitmapScan(t2)TidScan(t1)TidScan(t2)HashJoin(t1 t2)NestLoop(t2 t1)MergeJoin(t1 t2)Leading(t1 t2)Leading(t2 t1)Set(enable_seqscan off)Set(enable_mergejoin on)Set(enable_seqscan on)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+INFO: hint syntax error at or near "SeqScan(t1)SeqScan(t2)IndexScan(t1)IndexScan(t2)BitmapScan(t1)BitmapScan(t2)TidScan(t1)TidScan(t2)HashJoin(t1 t2)NestLoop(t2 t1)MergeJoin(t1 t2)Leading(t1 t2)Leading(t2 t1)Set(enable_seqscan off)Set(enable_mergejoin on)Set(enable_seqscan on)"
+DETAIL: Conflict scan method hint.
+INFO: hint syntax error at or near "IndexScan(t1)IndexScan(t2)BitmapScan(t1)BitmapScan(t2)TidScan(t1)TidScan(t2)HashJoin(t1 t2)NestLoop(t2 t1)MergeJoin(t1 t2)Leading(t1 t2)Leading(t2 t1)Set(enable_seqscan off)Set(enable_mergejoin on)Set(enable_seqscan on)"
+DETAIL: Conflict scan method hint.
+INFO: hint syntax error at or near "BitmapScan(t1)BitmapScan(t2)TidScan(t1)TidScan(t2)HashJoin(t1 t2)NestLoop(t2 t1)MergeJoin(t1 t2)Leading(t1 t2)Leading(t2 t1)Set(enable_seqscan off)Set(enable_mergejoin on)Set(enable_seqscan on)"
+DETAIL: Conflict scan method hint.
+INFO: hint syntax error at or near "SeqScan(t2)IndexScan(t1)IndexScan(t2)BitmapScan(t1)BitmapScan(t2)TidScan(t1)TidScan(t2)HashJoin(t1 t2)NestLoop(t2 t1)MergeJoin(t1 t2)Leading(t1 t2)Leading(t2 t1)Set(enable_seqscan off)Set(enable_mergejoin on)Set(enable_seqscan on)"
+DETAIL: Conflict scan method hint.
+INFO: hint syntax error at or near "IndexScan(t2)BitmapScan(t1)BitmapScan(t2)TidScan(t1)TidScan(t2)HashJoin(t1 t2)NestLoop(t2 t1)MergeJoin(t1 t2)Leading(t1 t2)Leading(t2 t1)Set(enable_seqscan off)Set(enable_mergejoin on)Set(enable_seqscan on)"
+DETAIL: Conflict scan method hint.
+INFO: hint syntax error at or near "BitmapScan(t2)TidScan(t1)TidScan(t2)HashJoin(t1 t2)NestLoop(t2 t1)MergeJoin(t1 t2)Leading(t1 t2)Leading(t2 t1)Set(enable_seqscan off)Set(enable_mergejoin on)Set(enable_seqscan on)"
+DETAIL: Conflict scan method hint.
+INFO: hint syntax error at or near "HashJoin(t1 t2)NestLoop(t2 t1)MergeJoin(t1 t2)Leading(t1 t2)Leading(t2 t1)Set(enable_seqscan off)Set(enable_mergejoin on)Set(enable_seqscan on)"
+DETAIL: Conflict join method hint.
+INFO: hint syntax error at or near "NestLoop(t2 t1)MergeJoin(t1 t2)Leading(t1 t2)Leading(t2 t1)Set(enable_seqscan off)Set(enable_mergejoin on)Set(enable_seqscan on)"
+DETAIL: Conflict join method hint.
+INFO: hint syntax error at or near "Leading(t1 t2)Leading(t2 t1)Set(enable_seqscan off)Set(enable_mergejoin on)Set(enable_seqscan on)"
+DETAIL: Conflict leading hint.
+INFO: hint syntax error at or near "Set(enable_seqscan off)Set(enable_mergejoin on)Set(enable_seqscan on)"
+DETAIL: Conflict set hint.
+LOG: pg_hint_plan:
+used hint:
+TidScan(t1)
+TidScan(t2)
+MergeJoin(t1 t2)
+Leading(t2 t1)
+Set(enable_mergejoin on)
+Set(enable_seqscan on)
+not used hint:
+duplication hint:
+SeqScan(t1)
+IndexScan(t1)
+BitmapScan(t1)
+SeqScan(t2)
+IndexScan(t2)
+BitmapScan(t2)
+HashJoin(t1 t2)
+NestLoop(t1 t2)
+Leading(t1 t2)
+Set(enable_seqscan off)
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------
+ Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Sort
+ Sort Key: t1.id
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: t2.id
+ -> Tid Scan on t2
+ TID Cond: (ctid = '(1,1)'::tid)
+(10 rows)
+
+-- sub query Leading hint test
+SET from_collapse_limit TO 100;
+SET geqo_threshold TO 100;
+EXPLAIN (COSTS false)
+WITH c1_1(id) AS (
+SELECT max(t1_5.id) FROM t1 t1_5, t2 t2_5, t3 t3_5 WHERE t1_5.id = t2_5.id AND t2_5.id = t3_5.id
+)
+SELECT t1_1.id, (
+SELECT max(t1_2.id) FROM t1 t1_2, t2 t2_2, t3 t3_2 WHERE t1_2.id = t2_2.id AND t2_2.id = t3_2.id
+) FROM t1 t1_1, t2 t2_1, t3 t3_1, (
+SELECT t1_3.id FROM t1 t1_3, t2 t2_3, t3 t3_3 WHERE t1_3.id = t2_3.id AND t2_3.id = t3_3.id
+) v1_1(id), c1_1 WHERE t1_1.id = t2_1.id AND t2_1.id = t3_1.id AND t2_1.id = v1_1.id AND v1_1.id = c1_1.id AND t1_1.id = (
+SELECT max(t1_4.id) FROM t1 t1_4, t2 t2_4, t3 t3_4 WHERE t1_4.id = t2_4.id AND t2_4.id = t3_4.id
+);
+ QUERY PLAN
+------------------------------------------------------------------------------
+ Nested Loop
+ CTE c1_1
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t1_5.id = t3_5.id)
+ -> Merge Join
+ Merge Cond: (t1_5.id = t2_5.id)
+ -> Index Only Scan using t1_pkey on t1 t1_5
+ -> Index Only Scan using t2_pkey on t2 t2_5
+ -> Sort
+ Sort Key: t3_5.id
+ -> Seq Scan on t3 t3_5
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t1_2.id = t3_2.id)
+ -> Merge Join
+ Merge Cond: (t1_2.id = t2_2.id)
+ -> Index Only Scan using t1_pkey on t1 t1_2
+ -> Index Only Scan using t2_pkey on t2 t2_2
+ -> Sort
+ Sort Key: t3_2.id
+ -> Seq Scan on t3 t3_2
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t1_4.id = t3_4.id)
+ -> Merge Join
+ Merge Cond: (t1_4.id = t2_4.id)
+ -> Index Only Scan using t1_pkey on t1 t1_4
+ -> Index Only Scan using t2_pkey on t2 t2_4
+ -> Sort
+ Sort Key: t3_4.id
+ -> Seq Scan on t3 t3_4
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ -> Index Only Scan using t1_pkey on t1 t1_1
+ Index Cond: (id = $2)
+ -> Index Only Scan using t2_pkey on t2 t2_1
+ Index Cond: (id = $2)
+ -> Seq Scan on t3 t3_1
+ Filter: (id = $2)
+ -> Index Only Scan using t1_pkey on t1 t1_3
+ Index Cond: (id = $2)
+ -> Index Only Scan using t2_pkey on t2 t2_3
+ Index Cond: (id = $2)
+ -> Seq Scan on t3 t3_3
+ Filter: (id = $2)
+ -> CTE Scan on c1_1
+ Filter: (id = $2)
+(53 rows)
+
+/*+HashJoin(t1_1 t3_1)MergeJoin(t1_3 t3_3)NestLoop(t1_2 t2_2)NestLoop(t1_4 t2_4)NestLoop(t1_5 t2_5)*/
+EXPLAIN (COSTS false)
+WITH c1_1(id) AS (
+SELECT max(t1_5.id) FROM t1 t1_5, t2 t2_5, t3 t3_5 WHERE t1_5.id = t2_5.id AND t2_5.id = t3_5.id
+)
+SELECT t1_1.id, (
+SELECT max(t1_2.id) FROM t1 t1_2, t2 t2_2, t3 t3_2 WHERE t1_2.id = t2_2.id AND t2_2.id = t3_2.id
+) FROM t1 t1_1, t2 t2_1, t3 t3_1, (
+SELECT t1_3.id FROM t1 t1_3, t2 t2_3, t3 t3_3 WHERE t1_3.id = t2_3.id AND t2_3.id = t3_3.id
+) v1_1(id), c1_1 WHERE t1_1.id = t2_1.id AND t2_1.id = t3_1.id AND t2_1.id = v1_1.id AND v1_1.id = c1_1.id AND t1_1.id = (
+SELECT max(t1_4.id) FROM t1 t1_4, t2 t2_4, t3 t3_4 WHERE t1_4.id = t2_4.id AND t2_4.id = t3_4.id
+);
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t1_1 t3_1)
+NestLoop(t1_2 t2_2)
+MergeJoin(t1_3 t3_3)
+NestLoop(t1_4 t2_4)
+NestLoop(t1_5 t2_5)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------------------------------
+ Nested Loop
+ CTE c1_1
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t1_5.id = t3_5.id)
+ -> Nested Loop
+ -> Index Only Scan using t2_pkey on t2 t2_5
+ -> Index Only Scan using t1_pkey on t1 t1_5
+ Index Cond: (id = t2_5.id)
+ -> Sort
+ Sort Key: t3_5.id
+ -> Seq Scan on t3 t3_5
+ InitPlan 2 (returns $3)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t1_2.id = t3_2.id)
+ -> Nested Loop
+ -> Index Only Scan using t2_pkey on t2 t2_2
+ -> Index Only Scan using t1_pkey on t1 t1_2
+ Index Cond: (id = t2_2.id)
+ -> Sort
+ Sort Key: t3_2.id
+ -> Seq Scan on t3 t3_2
+ InitPlan 3 (returns $5)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t1_4.id = t3_4.id)
+ -> Nested Loop
+ -> Index Only Scan using t2_pkey on t2 t2_4
+ -> Index Only Scan using t1_pkey on t1 t1_4
+ Index Cond: (id = t2_4.id)
+ -> Sort
+ Sort Key: t3_4.id
+ -> Seq Scan on t3 t3_4
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ -> Index Only Scan using t1_pkey on t1 t1_1
+ Index Cond: (id = $5)
+ -> Index Only Scan using t2_pkey on t2 t2_1
+ Index Cond: (id = $5)
+ -> Seq Scan on t3 t3_1
+ Filter: (id = $5)
+ -> Index Only Scan using t1_pkey on t1 t1_3
+ Index Cond: (id = $5)
+ -> Index Only Scan using t2_pkey on t2 t2_3
+ Index Cond: (id = $5)
+ -> Seq Scan on t3 t3_3
+ Filter: (id = $5)
+ -> CTE Scan on c1_1
+ Filter: (id = $5)
+(53 rows)
+
+/*+HashJoin(t1_1 t3_1)MergeJoin(t1_3 t3_3)NestLoop(t1_2 t2_2)NestLoop(t1_4 t2_4)NestLoop(t1_5 t2_5)Leading(a t1_1 t1_2 t1_4 t1_5)*/
+EXPLAIN (COSTS false)
+WITH c1_1(id) AS (
+SELECT max(t1_5.id) FROM t1 t1_5, t2 t2_5, t3 t3_5 WHERE t1_5.id = t2_5.id AND t2_5.id = t3_5.id
+)
+SELECT t1_1.id, (
+SELECT max(t1_2.id) FROM t1 t1_2, t2 t2_2, t3 t3_2 WHERE t1_2.id = t2_2.id AND t2_2.id = t3_2.id
+) FROM t1 t1_1, t2 t2_1, t3 t3_1, (
+SELECT t1_3.id FROM t1 t1_3, t2 t2_3, t3 t3_3 WHERE t1_3.id = t2_3.id AND t2_3.id = t3_3.id
+) v1_1(id), c1_1 WHERE t1_1.id = t2_1.id AND t2_1.id = t3_1.id AND t2_1.id = v1_1.id AND v1_1.id = c1_1.id AND t1_1.id = (
+SELECT max(t1_4.id) FROM t1 t1_4, t2 t2_4, t3 t3_4 WHERE t1_4.id = t2_4.id AND t2_4.id = t3_4.id
+);
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t1_1 t3_1)
+NestLoop(t1_2 t2_2)
+MergeJoin(t1_3 t3_3)
+NestLoop(t1_4 t2_4)
+NestLoop(t1_5 t2_5)
+not used hint:
+Leading(a t1_1 t1_2 t1_4 t1_5)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------------------------------
+ Nested Loop
+ CTE c1_1
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t1_5.id = t3_5.id)
+ -> Nested Loop
+ -> Index Only Scan using t2_pkey on t2 t2_5
+ -> Index Only Scan using t1_pkey on t1 t1_5
+ Index Cond: (id = t2_5.id)
+ -> Sort
+ Sort Key: t3_5.id
+ -> Seq Scan on t3 t3_5
+ InitPlan 2 (returns $3)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t1_2.id = t3_2.id)
+ -> Nested Loop
+ -> Index Only Scan using t2_pkey on t2 t2_2
+ -> Index Only Scan using t1_pkey on t1 t1_2
+ Index Cond: (id = t2_2.id)
+ -> Sort
+ Sort Key: t3_2.id
+ -> Seq Scan on t3 t3_2
+ InitPlan 3 (returns $5)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t1_4.id = t3_4.id)
+ -> Nested Loop
+ -> Index Only Scan using t2_pkey on t2 t2_4
+ -> Index Only Scan using t1_pkey on t1 t1_4
+ Index Cond: (id = t2_4.id)
+ -> Sort
+ Sort Key: t3_4.id
+ -> Seq Scan on t3 t3_4
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ -> Index Only Scan using t1_pkey on t1 t1_1
+ Index Cond: (id = $5)
+ -> Index Only Scan using t2_pkey on t2 t2_1
+ Index Cond: (id = $5)
+ -> Seq Scan on t3 t3_1
+ Filter: (id = $5)
+ -> Index Only Scan using t1_pkey on t1 t1_3
+ Index Cond: (id = $5)
+ -> Index Only Scan using t2_pkey on t2 t2_3
+ Index Cond: (id = $5)
+ -> Seq Scan on t3 t3_3
+ Filter: (id = $5)
+ -> CTE Scan on c1_1
+ Filter: (id = $5)
+(53 rows)
+
+/*+HashJoin(t1_1 t3_1)MergeJoin(t1_3 t3_3)NestLoop(t1_2 t2_2)NestLoop(t1_4 t2_4)NestLoop(t1_5 t2_5)Leading(a t3_2 t3_5 t2_2 c1_1 t3_4 t3_3 t2_3 t2_4 t1_3 t2_5 t1_2 t3_1 t1_4 t2_1 t1_5 t1_1)*/
+EXPLAIN (COSTS false)
+WITH c1_1(id) AS (
+SELECT max(t1_5.id) FROM t1 t1_5, t2 t2_5, t3 t3_5 WHERE t1_5.id = t2_5.id AND t2_5.id = t3_5.id
+)
+SELECT t1_1.id, (
+SELECT max(t1_2.id) FROM t1 t1_2, t2 t2_2, t3 t3_2 WHERE t1_2.id = t2_2.id AND t2_2.id = t3_2.id
+) FROM t1 t1_1, t2 t2_1, t3 t3_1, (
+SELECT t1_3.id FROM t1 t1_3, t2 t2_3, t3 t3_3 WHERE t1_3.id = t2_3.id AND t2_3.id = t3_3.id
+) v1_1(id), c1_1 WHERE t1_1.id = t2_1.id AND t2_1.id = t3_1.id AND t2_1.id = v1_1.id AND v1_1.id = c1_1.id AND t1_1.id = (
+SELECT max(t1_4.id) FROM t1 t1_4, t2 t2_4, t3 t3_4 WHERE t1_4.id = t2_4.id AND t2_4.id = t3_4.id
+);
+LOG: pg_hint_plan:
+used hint:
+Leading(a t3_2 t3_5 t2_2 c1_1 t3_4 t3_3 t2_3 t2_4 t1_3 t2_5 t1_2 t3_1 t1_4 t2_1 t1_5 t1_1)
+not used hint:
+HashJoin(t1_1 t3_1)
+NestLoop(t1_2 t2_2)
+MergeJoin(t1_3 t3_3)
+NestLoop(t1_4 t2_4)
+NestLoop(t1_5 t2_5)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------------------------
+ Nested Loop
+ CTE c1_1
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t2_5.id = t1_5.id)
+ -> Merge Join
+ Merge Cond: (t2_5.id = t3_5.id)
+ -> Index Only Scan using t2_pkey on t2 t2_5
+ -> Sort
+ Sort Key: t3_5.id
+ -> Seq Scan on t3 t3_5
+ -> Index Only Scan using t1_pkey on t1 t1_5
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t2_2.id = t1_2.id)
+ -> Merge Join
+ Merge Cond: (t2_2.id = t3_2.id)
+ -> Index Only Scan using t2_pkey on t2 t2_2
+ -> Sort
+ Sort Key: t3_2.id
+ -> Seq Scan on t3 t3_2
+ -> Index Only Scan using t1_pkey on t1 t1_2
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t2_4.id = t1_4.id)
+ -> Merge Join
+ Merge Cond: (t2_4.id = t3_4.id)
+ -> Index Only Scan using t2_pkey on t2 t2_4
+ -> Sort
+ Sort Key: t3_4.id
+ -> Seq Scan on t3 t3_4
+ -> Index Only Scan using t1_pkey on t1 t1_4
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ -> Seq Scan on t3 t3_3
+ Filter: (id = $2)
+ -> CTE Scan on c1_1
+ Filter: (id = $2)
+ -> Index Only Scan using t2_pkey on t2 t2_3
+ Index Cond: (id = $2)
+ -> Index Only Scan using t1_pkey on t1 t1_3
+ Index Cond: (id = $2)
+ -> Seq Scan on t3 t3_1
+ Filter: (id = $2)
+ -> Index Only Scan using t2_pkey on t2 t2_1
+ Index Cond: (id = $2)
+ -> Index Only Scan using t1_pkey on t1 t1_1
+ Index Cond: (id = $2)
+(53 rows)
+
+SET from_collapse_limit TO 1;
+EXPLAIN (COSTS false)
+WITH c1_1(id) AS (
+SELECT max(t1_5.id) FROM t1 t1_5, t2 t2_5, t3 t3_5 WHERE t1_5.id = t2_5.id AND t2_5.id = t3_5.id
+)
+SELECT t1_1.id, (
+SELECT max(t1_2.id) FROM t1 t1_2, t2 t2_2, t3 t3_2 WHERE t1_2.id = t2_2.id AND t2_2.id = t3_2.id
+) FROM t1 t1_1, t2 t2_1, t3 t3_1, (
+SELECT t1_3.id FROM t1 t1_3, t2 t2_3, t3 t3_3 WHERE t1_3.id = t2_3.id AND t2_3.id = t3_3.id
+) v1_1(id), c1_1 WHERE t1_1.id = t2_1.id AND t2_1.id = t3_1.id AND t2_1.id = v1_1.id AND v1_1.id = c1_1.id AND t1_1.id = (
+SELECT max(t1_4.id) FROM t1 t1_4, t2 t2_4, t3 t3_4 WHERE t1_4.id = t2_4.id AND t2_4.id = t3_4.id
+);
+ QUERY PLAN
+--------------------------------------------------------------------
+ Nested Loop
+ CTE c1_1
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t1_5.id = t3_5.id)
+ -> Merge Join
+ Merge Cond: (t1_5.id = t2_5.id)
+ -> Index Only Scan using t1_pkey on t1 t1_5
+ -> Index Only Scan using t2_pkey on t2 t2_5
+ -> Sort
+ Sort Key: t3_5.id
+ -> Seq Scan on t3 t3_5
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t1_2.id = t3_2.id)
+ -> Merge Join
+ Merge Cond: (t1_2.id = t2_2.id)
+ -> Index Only Scan using t1_pkey on t1 t1_2
+ -> Index Only Scan using t2_pkey on t2 t2_2
+ -> Sort
+ Sort Key: t3_2.id
+ -> Seq Scan on t3 t3_2
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t1_4.id = t3_4.id)
+ -> Merge Join
+ Merge Cond: (t1_4.id = t2_4.id)
+ -> Index Only Scan using t1_pkey on t1 t1_4
+ -> Index Only Scan using t2_pkey on t2 t2_4
+ -> Sort
+ Sort Key: t3_4.id
+ -> Seq Scan on t3 t3_4
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ -> Index Only Scan using t1_pkey on t1 t1_1
+ Index Cond: (id = $2)
+ -> Index Only Scan using t2_pkey on t2 t2_1
+ Index Cond: (id = $2)
+ -> Seq Scan on t3 t3_1
+ Filter: (id = $2)
+ -> Nested Loop
+ -> Nested Loop
+ -> Index Only Scan using t1_pkey on t1 t1_3
+ Index Cond: (id = $2)
+ -> Index Only Scan using t2_pkey on t2 t2_3
+ Index Cond: (id = $2)
+ -> Seq Scan on t3 t3_3
+ Filter: (id = $2)
+ -> CTE Scan on c1_1
+ Filter: (id = $2)
+(53 rows)
+
+/*+HashJoin(t1_1 t3_1)MergeJoin(t1_3 t3_3)NestLoop(t1_2 t2_2)NestLoop(t1_4 t2_4)NestLoop(t1_5 t2_5)*/
+EXPLAIN (COSTS false)
+WITH c1_1(id) AS (
+SELECT max(t1_5.id) FROM t1 t1_5, t2 t2_5, t3 t3_5 WHERE t1_5.id = t2_5.id AND t2_5.id = t3_5.id
+)
+SELECT t1_1.id, (
+SELECT max(t1_2.id) FROM t1 t1_2, t2 t2_2, t3 t3_2 WHERE t1_2.id = t2_2.id AND t2_2.id = t3_2.id
+) FROM t1 t1_1, t2 t2_1, t3 t3_1, (
+SELECT t1_3.id FROM t1 t1_3, t2 t2_3, t3 t3_3 WHERE t1_3.id = t2_3.id AND t2_3.id = t3_3.id
+) v1_1(id), c1_1 WHERE t1_1.id = t2_1.id AND t2_1.id = t3_1.id AND t2_1.id = v1_1.id AND v1_1.id = c1_1.id AND t1_1.id = (
+SELECT max(t1_4.id) FROM t1 t1_4, t2 t2_4, t3 t3_4 WHERE t1_4.id = t2_4.id AND t2_4.id = t3_4.id
+);
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t1_1 t3_1)
+NestLoop(t1_2 t2_2)
+MergeJoin(t1_3 t3_3)
+NestLoop(t1_4 t2_4)
+NestLoop(t1_5 t2_5)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------------------------
+ Nested Loop
+ CTE c1_1
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t1_5.id = t3_5.id)
+ -> Nested Loop
+ -> Index Only Scan using t2_pkey on t2 t2_5
+ -> Index Only Scan using t1_pkey on t1 t1_5
+ Index Cond: (id = t2_5.id)
+ -> Sort
+ Sort Key: t3_5.id
+ -> Seq Scan on t3 t3_5
+ InitPlan 2 (returns $3)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t1_2.id = t3_2.id)
+ -> Nested Loop
+ -> Index Only Scan using t2_pkey on t2 t2_2
+ -> Index Only Scan using t1_pkey on t1 t1_2
+ Index Cond: (id = t2_2.id)
+ -> Sort
+ Sort Key: t3_2.id
+ -> Seq Scan on t3 t3_2
+ InitPlan 3 (returns $5)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t1_4.id = t3_4.id)
+ -> Nested Loop
+ -> Index Only Scan using t2_pkey on t2 t2_4
+ -> Index Only Scan using t1_pkey on t1 t1_4
+ Index Cond: (id = t2_4.id)
+ -> Sort
+ Sort Key: t3_4.id
+ -> Seq Scan on t3 t3_4
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ -> Index Only Scan using t1_pkey on t1 t1_1
+ Index Cond: (id = $5)
+ -> Index Only Scan using t2_pkey on t2 t2_1
+ Index Cond: (id = $5)
+ -> Seq Scan on t3 t3_1
+ Filter: (id = $5)
+ -> Nested Loop
+ -> Nested Loop
+ -> Index Only Scan using t1_pkey on t1 t1_3
+ Index Cond: (id = $5)
+ -> Index Only Scan using t2_pkey on t2 t2_3
+ Index Cond: (id = $5)
+ -> Seq Scan on t3 t3_3
+ Filter: (id = $5)
+ -> CTE Scan on c1_1
+ Filter: (id = $5)
+(53 rows)
+
+/*+HashJoin(t1_1 t3_1)MergeJoin(t1_3 t3_3)NestLoop(t1_2 t2_2)NestLoop(t1_4 t2_4)NestLoop(t1_5 t2_5)Leading(a t1_1 t1_2 t1_4 t1_5)*/
+EXPLAIN (COSTS false)
+WITH c1_1(id) AS (
+SELECT max(t1_5.id) FROM t1 t1_5, t2 t2_5, t3 t3_5 WHERE t1_5.id = t2_5.id AND t2_5.id = t3_5.id
+)
+SELECT t1_1.id, (
+SELECT max(t1_2.id) FROM t1 t1_2, t2 t2_2, t3 t3_2 WHERE t1_2.id = t2_2.id AND t2_2.id = t3_2.id
+) FROM t1 t1_1, t2 t2_1, t3 t3_1, (
+SELECT t1_3.id FROM t1 t1_3, t2 t2_3, t3 t3_3 WHERE t1_3.id = t2_3.id AND t2_3.id = t3_3.id
+) v1_1(id), c1_1 WHERE t1_1.id = t2_1.id AND t2_1.id = t3_1.id AND t2_1.id = v1_1.id AND v1_1.id = c1_1.id AND t1_1.id = (
+SELECT max(t1_4.id) FROM t1 t1_4, t2 t2_4, t3 t3_4 WHERE t1_4.id = t2_4.id AND t2_4.id = t3_4.id
+);
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t1_1 t3_1)
+NestLoop(t1_2 t2_2)
+MergeJoin(t1_3 t3_3)
+NestLoop(t1_4 t2_4)
+NestLoop(t1_5 t2_5)
+not used hint:
+Leading(a t1_1 t1_2 t1_4 t1_5)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------------------------
+ Nested Loop
+ CTE c1_1
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t1_5.id = t3_5.id)
+ -> Nested Loop
+ -> Index Only Scan using t2_pkey on t2 t2_5
+ -> Index Only Scan using t1_pkey on t1 t1_5
+ Index Cond: (id = t2_5.id)
+ -> Sort
+ Sort Key: t3_5.id
+ -> Seq Scan on t3 t3_5
+ InitPlan 2 (returns $3)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t1_2.id = t3_2.id)
+ -> Nested Loop
+ -> Index Only Scan using t2_pkey on t2 t2_2
+ -> Index Only Scan using t1_pkey on t1 t1_2
+ Index Cond: (id = t2_2.id)
+ -> Sort
+ Sort Key: t3_2.id
+ -> Seq Scan on t3 t3_2
+ InitPlan 3 (returns $5)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t1_4.id = t3_4.id)
+ -> Nested Loop
+ -> Index Only Scan using t2_pkey on t2 t2_4
+ -> Index Only Scan using t1_pkey on t1 t1_4
+ Index Cond: (id = t2_4.id)
+ -> Sort
+ Sort Key: t3_4.id
+ -> Seq Scan on t3 t3_4
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ -> Index Only Scan using t1_pkey on t1 t1_1
+ Index Cond: (id = $5)
+ -> Index Only Scan using t2_pkey on t2 t2_1
+ Index Cond: (id = $5)
+ -> Seq Scan on t3 t3_1
+ Filter: (id = $5)
+ -> Nested Loop
+ -> Nested Loop
+ -> Index Only Scan using t1_pkey on t1 t1_3
+ Index Cond: (id = $5)
+ -> Index Only Scan using t2_pkey on t2 t2_3
+ Index Cond: (id = $5)
+ -> Seq Scan on t3 t3_3
+ Filter: (id = $5)
+ -> CTE Scan on c1_1
+ Filter: (id = $5)
+(53 rows)
+
+/*+HashJoin(t1_1 t3_1)MergeJoin(t1_3 t3_3)NestLoop(t1_2 t2_2)NestLoop(t1_4 t2_4)NestLoop(t1_5 t2_5)Leading(a t3_2 t3_5 t2_2 c1_1 t3_4 t3_3 t2_3 t2_4 t1_3 t2_5 t1_2 t3_1 t1_4 t2_1 t1_5 t1_1)*/
+EXPLAIN (COSTS false)
+WITH c1_1(id) AS (
+SELECT max(t1_5.id) FROM t1 t1_5, t2 t2_5, t3 t3_5 WHERE t1_5.id = t2_5.id AND t2_5.id = t3_5.id
+)
+SELECT t1_1.id, (
+SELECT max(t1_2.id) FROM t1 t1_2, t2 t2_2, t3 t3_2 WHERE t1_2.id = t2_2.id AND t2_2.id = t3_2.id
+) FROM t1 t1_1, t2 t2_1, t3 t3_1, (
+SELECT t1_3.id FROM t1 t1_3, t2 t2_3, t3 t3_3 WHERE t1_3.id = t2_3.id AND t2_3.id = t3_3.id
+) v1_1(id), c1_1 WHERE t1_1.id = t2_1.id AND t2_1.id = t3_1.id AND t2_1.id = v1_1.id AND v1_1.id = c1_1.id AND t1_1.id = (
+SELECT max(t1_4.id) FROM t1 t1_4, t2 t2_4, t3 t3_4 WHERE t1_4.id = t2_4.id AND t2_4.id = t3_4.id
+);
+LOG: pg_hint_plan:
+used hint:
+Leading(a t3_2 t3_5 t2_2 c1_1 t3_4 t3_3 t2_3 t2_4 t1_3 t2_5 t1_2 t3_1 t1_4 t2_1 t1_5 t1_1)
+not used hint:
+HashJoin(t1_1 t3_1)
+NestLoop(t1_2 t2_2)
+MergeJoin(t1_3 t3_3)
+NestLoop(t1_4 t2_4)
+NestLoop(t1_5 t2_5)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------------------------------
+ Nested Loop
+ CTE c1_1
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t2_5.id = t1_5.id)
+ -> Merge Join
+ Merge Cond: (t2_5.id = t3_5.id)
+ -> Index Only Scan using t2_pkey on t2 t2_5
+ -> Sort
+ Sort Key: t3_5.id
+ -> Seq Scan on t3 t3_5
+ -> Index Only Scan using t1_pkey on t1 t1_5
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t2_2.id = t1_2.id)
+ -> Merge Join
+ Merge Cond: (t2_2.id = t3_2.id)
+ -> Index Only Scan using t2_pkey on t2 t2_2
+ -> Sort
+ Sort Key: t3_2.id
+ -> Seq Scan on t3 t3_2
+ -> Index Only Scan using t1_pkey on t1 t1_2
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (t2_4.id = t1_4.id)
+ -> Merge Join
+ Merge Cond: (t2_4.id = t3_4.id)
+ -> Index Only Scan using t2_pkey on t2 t2_4
+ -> Sort
+ Sort Key: t3_4.id
+ -> Seq Scan on t3 t3_4
+ -> Index Only Scan using t1_pkey on t1 t1_4
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ -> Index Only Scan using t2_pkey on t2 t2_3
+ Index Cond: (id = $2)
+ -> Seq Scan on t3 t3_3
+ Filter: (id = $2)
+ -> Index Only Scan using t1_pkey on t1 t1_3
+ Index Cond: (id = $2)
+ -> CTE Scan on c1_1
+ Filter: (id = $2)
+ -> Seq Scan on t3 t3_1
+ Filter: (id = $2)
+ -> Index Only Scan using t2_pkey on t2 t2_1
+ Index Cond: (id = $2)
+ -> Index Only Scan using t1_pkey on t1 t1_1
+ Index Cond: (id = $2)
+(53 rows)
+
+-- ambigous error
+EXPLAIN (COSTS false) SELECT * FROM t1, s0.t1, t2 WHERE public.t1.id = s0.t1.id AND public.t1.id = t2.id;
+ QUERY PLAN
+-----------------------------------------------
+ Merge Join
+ Merge Cond: (public.t1.id = t2.id)
+ -> Merge Join
+ Merge Cond: (public.t1.id = s0.t1.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+(7 rows)
+
+/*+NestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, s0.t1, t2 WHERE public.t1.id = s0.t1.id AND public.t1.id = t2.id;
+INFO: hint syntax error at or near "NestLoop(t1 t2)"
+DETAIL: Relation name "t1" is ambiguous.
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+NestLoop(t1 t2)
+
+ QUERY PLAN
+-----------------------------------------------
+ Merge Join
+ Merge Cond: (public.t1.id = t2.id)
+ -> Merge Join
+ Merge Cond: (public.t1.id = s0.t1.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+(7 rows)
+
+/*+Leading(t1 t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, s0.t1, t2 WHERE public.t1.id = s0.t1.id AND public.t1.id = t2.id;
+INFO: hint syntax error at or near "Leading(t1 t2 t1)"
+DETAIL: Relation name "t1" is ambiguous.
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+Leading(t1 t2 t1)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------
+ Merge Join
+ Merge Cond: (public.t1.id = t2.id)
+ -> Merge Join
+ Merge Cond: (public.t1.id = s0.t1.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+(7 rows)
+
+-- identifier length test
+EXPLAIN (COSTS false) SELECT * FROM t1 "123456789012345678901234567890123456789012345678901234567890123" JOIN t2 ON ("123456789012345678901234567890123456789012345678901234567890123".id = t2.id) JOIN t3 ON (t2.id = t3.id);
+ QUERY PLAN
+--------------------------------------------------------------------------------------------------------------
+ Merge Join
+ Merge Cond: ("123456789012345678901234567890123456789012345678901234567890123".id = t3.id)
+ -> Merge Join
+ Merge Cond: ("123456789012345678901234567890123456789012345678901234567890123".id = t2.id)
+ -> Index Scan using t1_pkey on t1 "123456789012345678901234567890123456789012345678901234567890123"
+ -> Index Scan using t2_pkey on t2
+ -> Sort
+ Sort Key: t3.id
+ -> Seq Scan on t3
+(9 rows)
+
+/*+
+Leading(123456789012345678901234567890123456789012345678901234567890123 t2 t3)
+SeqScan(123456789012345678901234567890123456789012345678901234567890123)
+MergeJoin(123456789012345678901234567890123456789012345678901234567890123 t2)
+Set(123456789012345678901234567890123456789012345678901234567890123 1)
+*/
+EXPLAIN (COSTS false) SELECT * FROM t1 "123456789012345678901234567890123456789012345678901234567890123" JOIN t2 ON ("123456789012345678901234567890123456789012345678901234567890123".id = t2.id) JOIN t3 ON (t2.id = t3.id);
+INFO: unrecognized configuration parameter "123456789012345678901234567890123456789012345678901234567890123"
+LOG: pg_hint_plan:
+used hint:
+SeqScan(123456789012345678901234567890123456789012345678901234567890123)
+MergeJoin(123456789012345678901234567890123456789012345678901234567890123 t2)
+Leading(123456789012345678901234567890123456789012345678901234567890123 t2 t3)
+not used hint:
+duplication hint:
+error hint:
+Set(123456789012345678901234567890123456789012345678901234567890123 1)
+
+ QUERY PLAN
+----------------------------------------------------------------------------------------------------
+ Merge Join
+ Merge Cond: ("123456789012345678901234567890123456789012345678901234567890123".id = t3.id)
+ -> Merge Join
+ Merge Cond: (t2.id = "123456789012345678901234567890123456789012345678901234567890123".id)
+ -> Index Scan using t2_pkey on t2
+ -> Sort
+ Sort Key: "123456789012345678901234567890123456789012345678901234567890123".id
+ -> Seq Scan on t1 "123456789012345678901234567890123456789012345678901234567890123"
+ -> Sort
+ Sort Key: t3.id
+ -> Seq Scan on t3
+(11 rows)
+
+/*+
+Leading(1234567890123456789012345678901234567890123456789012345678901234 t2 t3)
+SeqScan(1234567890123456789012345678901234567890123456789012345678901234)
+MergeJoin(1234567890123456789012345678901234567890123456789012345678901234 t2)
+Set(1234567890123456789012345678901234567890123456789012345678901234 1)
+Set(cursor_tuple_fraction 0.1234567890123456789012345678901234567890123456789012345678901234)
+*/
+EXPLAIN (COSTS false) SELECT * FROM t1 "1234567890123456789012345678901234567890123456789012345678901234" JOIN t2 ON ("1234567890123456789012345678901234567890123456789012345678901234".id = t2.id) JOIN t3 ON (t2.id = t3.id);
+NOTICE: identifier "1234567890123456789012345678901234567890123456789012345678901234" will be truncated to "123456789012345678901234567890123456789012345678901234567890123"
+NOTICE: identifier "1234567890123456789012345678901234567890123456789012345678901234" will be truncated to "123456789012345678901234567890123456789012345678901234567890123"
+NOTICE: identifier "1234567890123456789012345678901234567890123456789012345678901234" will be truncated to "123456789012345678901234567890123456789012345678901234567890123"
+NOTICE: identifier "1234567890123456789012345678901234567890123456789012345678901234" will be truncated to "123456789012345678901234567890123456789012345678901234567890123"
+NOTICE: identifier "1234567890123456789012345678901234567890123456789012345678901234" will be truncated to "123456789012345678901234567890123456789012345678901234567890123"
+NOTICE: identifier "1234567890123456789012345678901234567890123456789012345678901234" will be truncated to "123456789012345678901234567890123456789012345678901234567890123"
+INFO: unrecognized configuration parameter "123456789012345678901234567890123456789012345678901234567890123"
+LOG: pg_hint_plan:
+used hint:
+SeqScan(123456789012345678901234567890123456789012345678901234567890123)
+MergeJoin(123456789012345678901234567890123456789012345678901234567890123 t2)
+Leading(123456789012345678901234567890123456789012345678901234567890123 t2 t3)
+Set(cursor_tuple_fraction 0.1234567890123456789012345678901234567890123456789012345678901234)
+not used hint:
+duplication hint:
+error hint:
+Set(123456789012345678901234567890123456789012345678901234567890123 1)
+
+ QUERY PLAN
+----------------------------------------------------------------------------------------------------
+ Merge Join
+ Merge Cond: ("123456789012345678901234567890123456789012345678901234567890123".id = t3.id)
+ -> Merge Join
+ Merge Cond: (t2.id = "123456789012345678901234567890123456789012345678901234567890123".id)
+ -> Index Scan using t2_pkey on t2
+ -> Sort
+ Sort Key: "123456789012345678901234567890123456789012345678901234567890123".id
+ -> Seq Scan on t1 "123456789012345678901234567890123456789012345678901234567890123"
+ -> Sort
+ Sort Key: t3.id
+ -> Seq Scan on t3
+(11 rows)
+
+SET "123456789012345678901234567890123456789012345678901234567890123" TO 1;
+ERROR: unrecognized configuration parameter "123456789012345678901234567890123456789012345678901234567890123"
+SET "1234567890123456789012345678901234567890123456789012345678901234" TO 1;
+NOTICE: identifier "1234567890123456789012345678901234567890123456789012345678901234" will be truncated to "123456789012345678901234567890123456789012345678901234567890123"
+ERROR: unrecognized configuration parameter "123456789012345678901234567890123456789012345678901234567890123"
+SET cursor_tuple_fraction TO 1234567890123456789012345678901234567890123456789012345678901234;
+ERROR: 1.23457e+63 is outside the valid range for parameter "cursor_tuple_fraction" (0 .. 1)
+-- multi error
+/*+ Set(enable_seqscan 100)Set(seq_page_cost on)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+INFO: parameter "enable_seqscan" requires a Boolean value
+INFO: parameter "seq_page_cost" requires a numeric value
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+Set(enable_seqscan 100)
+Set(seq_page_cost on)
+
+ QUERY PLAN
+--------------------------------------
+ Merge Join
+ Merge Cond: (t1.id = t2.id)
+ -> Index Scan using t1_pkey on t1
+ -> Index Scan using t2_pkey on t2
+(4 rows)
+
--- /dev/null
+LOAD 'pg_hint_plan';
+SET pg_hint_plan.enable_hint TO on;
+SET pg_hint_plan.debug_print TO on;
+SET client_min_messages TO LOG;
+SET search_path TO public;
+----
+---- No. A-5-1 hint format
+----
+-- No. A-5-1-1
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-1-2
+/* +SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. A-5-1-3
+--+SeqScan(t1)
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. A-5-1-4
+--+SeqScan(t1)
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. A-5-1-5
+-- +SeqScan(t1)
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. A-5-1-6
+--SeqScan(t1)
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. A-5-1-7
+/*+SeqScan(t1) /* nest comment */ */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+INFO: hint syntax error at or near "/* nest comment */ */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;"
+DETAIL: Nested block comments are not supported.
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. A-5-1-8
+/* +SeqScan(t1) /* nest comment */ */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. A-5-1-9
+/*SeqScan(t1) /* nest comment */ */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+----
+---- No. A-5-2 hint position
+----
+-- No. A-5-2-1
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-2-2
+/* normal comment */
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. A-5-2-3
+EXPLAIN (COSTS false) SELECT /*+SeqScan(t1)*/ * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+----
+---- No. A-5-4 hint delimiter
+----
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-1
+-- No. A-5-4-2
+-- No. A-5-4-3
+-- No. A-5-4-4
+-- No. A-5-4-5
+-- No. A-5-4-6
+-- No. A-5-4-7
+/*+Set(enable_indexscan"off")Set(enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-8
+/*+ Set(enable_indexscan"off")Set(enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-9
+/*+Set(enable_indexscan"off")Set(enable_bitmapscan"off") */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-10
+/*+ Set (enable_indexscan"off") Set (enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-11
+/*+Set ( enable_indexscan"off")Set ( enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-12
+/*+Set(enable_indexscan"off" ) Set(enable_bitmapscan"off" ) */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-13
+/*+Set( enable_indexscan "off" )Set( enable_bitmapscan "off" )*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-14
+/*+ Set ( enable_indexscan "off" ) Set ( enable_bitmapscan "off" ) */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-15
+/*+ Set(enable_indexscan"off")Set(enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-16
+/*+Set(enable_indexscan"off")Set(enable_bitmapscan"off") */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-17
+/*+ Set (enable_indexscan"off") Set (enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-18
+/*+Set ( enable_indexscan"off")Set ( enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-19
+/*+Set(enable_indexscan"off" ) Set(enable_bitmapscan"off" ) */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-20
+/*+Set( enable_indexscan "off" )Set( enable_bitmapscan "off" )*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-21
+/*+ Set ( enable_indexscan "off" ) Set ( enable_bitmapscan "off" ) */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-22
+/*+
+Set(enable_indexscan"off")Set(enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-23
+/*+Set(enable_indexscan"off")Set(enable_bitmapscan"off")
+*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-24
+/*+
+Set
+(enable_indexscan"off")
+Set
+(enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-25
+/*+Set
+(
+enable_indexscan"off")Set
+(
+enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-26
+/*+Set(enable_indexscan"off"
+)
+Set(enable_bitmapscan"off"
+)
+*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-27
+/*+Set(
+enable_indexscan
+"off"
+)Set(
+enable_bitmapscan
+"off"
+)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-28
+/*+
+Set
+(
+enable_indexscan
+"off"
+)
+Set
+(
+enable_bitmapscan
+"off"
+)
+*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-29
+/*+
+ Set(enable_indexscan"off")Set(enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-30
+/*+Set(enable_indexscan"off")Set(enable_bitmapscan"off")
+ */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-31
+/*+
+ Set
+ (enable_indexscan"off")
+ Set
+ (enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-32
+/*+Set
+ (
+ enable_indexscan"off")Set
+ (
+ enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-33
+/*+Set(enable_indexscan"off"
+ )
+ Set(enable_bitmapscan"off"
+ )
+ */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-34
+/*+Set(
+ enable_indexscan
+ "off"
+ )Set(
+ enable_bitmapscan
+ "off"
+ )*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-35
+/*+
+ Set
+ (
+ enable_indexscan
+ "off"
+ )
+ Set
+ (
+ enable_bitmapscan
+ "off"
+ )
+ */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+----
+---- No. A-5-5 hint object pattern
+---- No. A-7-2 message object pattern
+----
+-- No. A-5-5-1
+-- No. A-7-2-1
+/*+SeqScan(t)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 t WHERE t.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1 t
+ Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan(ttt)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 ttt WHERE ttt.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(ttt)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1 ttt
+ Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan("t")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 t WHERE t.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1 t
+ Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan("ttt")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 ttt WHERE ttt.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(ttt)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1 ttt
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-5-2
+-- No. A-7-2-2
+/*+SeqScan(T)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "T" WHERE "T".c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(T)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1 "T"
+ Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan(TTT)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "TTT" WHERE "TTT".c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(TTT)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------
+ Seq Scan on t1 "TTT"
+ Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan("T")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "T" WHERE "T".c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(T)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1 "T"
+ Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan("TTT")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "TTT" WHERE "TTT".c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(TTT)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------
+ Seq Scan on t1 "TTT"
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-5-3
+-- No. A-7-2-3
+/*+SeqScan(()*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "(" WHERE "(".c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(()
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1 "("
+ Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan(((()*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "(((" WHERE "(((".c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(((()
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------
+ Seq Scan on t1 "((("
+ Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan("(")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "(" WHERE "(".c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(()
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1 "("
+ Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan("(((")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "(((" WHERE "(((".c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(((()
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------
+ Seq Scan on t1 "((("
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-5-4
+-- No. A-7-2-4
+/*+SeqScan())*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 ")" WHERE ")".c1 = 1;
+INFO: hint syntax error at or near "))"
+DETAIL: Relation name is necessary.
+ QUERY PLAN
+----------------------------------
+ Index Scan using t1_i1 on t1 ")"
+ Index Cond: (c1 = 1)
+(2 rows)
+
+/*+SeqScan(")")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 ")" WHERE ")".c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(")")
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1 ")"
+ Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan(")))")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 ")))" WHERE ")))".c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(")))")
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------
+ Seq Scan on t1 ")))"
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-5-5
+-- No. A-7-2-5
+/*+SeqScan(")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 """" WHERE """".c1 = 1;
+INFO: hint syntax error at or near ""
+DETAIL: Unterminated quoted relation name.
+ QUERY PLAN
+-----------------------------------
+ Index Scan using t1_i1 on t1 """"
+ Index Cond: (c1 = 1)
+(2 rows)
+
+/*+SeqScan("""")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 """" WHERE """".c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan("""")
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------
+ Seq Scan on t1 """"
+ Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan("""""""")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 """""""" WHERE """""""".c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan("""""""")
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------
+ Seq Scan on t1 """"""""
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-5-6
+-- No. A-7-2-6
+/*+SeqScan( )*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 " " WHERE " ".c1 = 1;
+INFO: hint syntax error at or near ")"
+DETAIL: Relation name is necessary.
+ QUERY PLAN
+----------------------------------
+ Index Scan using t1_i1 on t1 " "
+ Index Cond: (c1 = 1)
+(2 rows)
+
+/*+SeqScan(" ")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 " " WHERE " ".c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(" ")
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1 " "
+ Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan(" ")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 " " WHERE " ".c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(" ")
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------
+ Seq Scan on t1 " "
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-5-7
+-- No. A-7-2-7
+/*+SeqScan( )*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 " " WHERE " ".c1 = 1;
+INFO: hint syntax error at or near ")"
+DETAIL: Relation name is necessary.
+ QUERY PLAN
+-----------------------------------
+ Index Scan using t1_i1 on t1 " "
+ Index Cond: (c1 = 1)
+(2 rows)
+
+/*+SeqScan(" ")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 " " WHERE " ".c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(" ")
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------
+ Seq Scan on t1 " "
+ Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan(" ")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 " " WHERE " ".c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(" ")
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------
+ Seq Scan on t1 " "
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-5-8
+-- No. A-7-2-8
+/*+SeqScan(
+)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "
+" WHERE "
+".c1 = 1;
+INFO: hint syntax error at or near ")"
+DETAIL: Relation name is necessary.
+ QUERY PLAN
+--------------------------------
+ Index Scan using t1_i1 on t1 "
+ "
+ Index Cond: (c1 = 1)
+(3 rows)
+
+/*+SeqScan("
+")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "
+" WHERE "
+".c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan("
+")
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1 "
+ "
+ Filter: (c1 = 1)
+(3 rows)
+
+/*+SeqScan("
+
+
+")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "
+
+
+" WHERE "
+
+
+".c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan("
+
+
+")
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1 "
+
+
+ "
+ Filter: (c1 = 1)
+(5 rows)
+
+-- No. A-5-5-9
+-- No. A-7-2-9
+/*+SeqScan(Set)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "Set" WHERE "Set".c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(Set)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------
+ Seq Scan on t1 "Set"
+ Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan("Set")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "Set" WHERE "Set".c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(Set)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------
+ Seq Scan on t1 "Set"
+ Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan("Set SeqScan Leading")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "Set SeqScan Leading" WHERE "Set SeqScan Leading".c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan("Set SeqScan Leading")
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------
+ Seq Scan on t1 "Set SeqScan Leading"
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-5-10
+-- No. A-7-2-10
+/*+SeqScan(あ)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 あ WHERE あ.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(あ)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------
+ Seq Scan on t1 "あ"
+ Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan(あいう)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 あいう WHERE あいう.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(あいう)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------
+ Seq Scan on t1 "あいう"
+ Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan("あ")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 あ WHERE あ.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(あ)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------
+ Seq Scan on t1 "あ"
+ Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan("あいう")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 あいう WHERE あいう.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(あいう)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------
+ Seq Scan on t1 "あいう"
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-5-11
+-- No. A-7-2-11
+/*+SeqScan(/**/)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "/**/" WHERE "/**/".c1 = 1;
+INFO: hint syntax error at or near "/**/)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "/**/" WHERE "/**/".c1 = 1;"
+DETAIL: Nested block comments are not supported.
+ QUERY PLAN
+-------------------------------------
+ Index Scan using t1_i1 on t1 "/**/"
+ Index Cond: (c1 = 1)
+(2 rows)
+
+/*+SeqScan(/**//**//**/)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "/**//**//**/" WHERE "/**//**//**/".c1 = 1;
+INFO: hint syntax error at or near "/**//**//**/)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "/**//**//**/" WHERE "/**//**//**/".c1 = 1;"
+DETAIL: Nested block comments are not supported.
+ QUERY PLAN
+---------------------------------------------
+ Index Scan using t1_i1 on t1 "/**//**//**/"
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. A-5-5-12
+-- No. A-7-2-12
+/*+SeqScan("tT()""
+Set/**/あ")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "tT()""
+Set/**/あ" WHERE "tT()""
+Set/**/あ".c1 = 1;
+INFO: hint syntax error at or near "/**/あ")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "tT()""
+Set/**/あ" WHERE "tT()""
+Set/**/あ".c1 = 1;"
+DETAIL: Nested block comments are not supported.
+ QUERY PLAN
+------------------------------------------
+ Index Scan using t1_i1 on t1 "tT()""
+ Set/**/あ"
+ Index Cond: (c1 = 1)
+(3 rows)
+
+--"
+/*+SeqScan("tT()""
+Setあ")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "tT()""
+Setあ" WHERE "tT()""
+Setあ".c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan("tT()""
+Setあ")
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------
+ Seq Scan on t1 "tT()""
+ Setあ"
+ Filter: (c1 = 1)
+(3 rows)
+
+----
+---- No. A-5-6 hint parse error
+----
+-- No. A-5-6-1
+/*+Set(enable_indexscan off)Set enable_tidscan off)Set(enable_bitmapscan off)SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+INFO: hint syntax error at or near "enable_tidscan off)Set(enable_bitmapscan off)SeqScan(t1)"
+DETAIL: Opening parenthesis is necessary.
+LOG: pg_hint_plan:
+used hint:
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 = 1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 = 1)
+(4 rows)
+
+-- No. A-5-6-2
+/*+Set(enable_indexscan off)Set(enable_tidscan off Set(enable_bitmapscan off)SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+INFO: hint syntax error at or near "Set(enable_bitmapscan off)SeqScan(t1)"
+DETAIL: Closing parenthesis is necessary.
+LOG: pg_hint_plan:
+used hint:
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 = 1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 = 1)
+(4 rows)
+
+-- No. A-5-6-3
+/*+Set(enable_indexscan off)Set(enable_tidscan "off)Set(enable_bitmapscan off)SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+INFO: hint syntax error at or near ""
+DETAIL: Unterminated quoted parameter value.
+LOG: pg_hint_plan:
+used hint:
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 = 1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 = 1)
+(4 rows)
+
+-- No. A-5-6-4
+/*+Set(enable_indexscan off)SeqScan("")Set(enable_bitmapscan off)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+INFO: hint syntax error at or near ")Set(enable_bitmapscan off)"
+DETAIL: Relation name is necessary.
+LOG: pg_hint_plan:
+used hint:
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 = 1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 = 1)
+(4 rows)
+
+-- No. A-5-6-5
+/*+Set(enable_indexscan off)NoSet(enable_tidscan off)Set(enable_bitmapscan off)SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+INFO: hint syntax error at or near "NoSet(enable_tidscan off)Set(enable_bitmapscan off)SeqScan(t1)"
+DETAIL: Unrecognized hint keyword "NoSet".
+LOG: pg_hint_plan:
+used hint:
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 = 1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 = 1)
+(4 rows)
+
+-- No. A-5-6-6
+/*+Set(enable_indexscan off)"Set"(enable_tidscan off)Set(enable_bitmapscan off)SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+INFO: hint syntax error at or near ""Set"(enable_tidscan off)Set(enable_bitmapscan off)SeqScan(t1)"
+DETAIL: Unrecognized hint keyword ""Set"".
+LOG: pg_hint_plan:
+used hint:
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 = 1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 = 1)
+(4 rows)
+
+-- No. A-5-6-7
+/*+Set(enable_indexscan off)Set(enable_tidscan /* value */off)Set(enable_bitmapscan off)SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+INFO: hint syntax error at or near "/* value */off)Set(enable_bitmapscan off)SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;"
+DETAIL: Nested block comments are not supported.
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+----
+---- No. A-6-1 original GUC parameter
+----
+-- No. A-6-1-1
+SET ROLE super_user;
+SET pg_hint_plan.debug_print TO off;
+SHOW pg_hint_plan.enable_hint;
+ pg_hint_plan.enable_hint
+--------------------------
+ on
+(1 row)
+
+SHOW pg_hint_plan.debug_print;
+ pg_hint_plan.debug_print
+--------------------------
+ off
+(1 row)
+
+SHOW pg_hint_plan.parse_messages;
+ pg_hint_plan.parse_messages
+-----------------------------
+ info
+(1 row)
+
+SET pg_hint_plan.enable_hint TO off;
+SET pg_hint_plan.debug_print TO on;
+SET pg_hint_plan.parse_messages TO error;
+SHOW pg_hint_plan.enable_hint;
+ pg_hint_plan.enable_hint
+--------------------------
+ off
+(1 row)
+
+SHOW pg_hint_plan.debug_print;
+ pg_hint_plan.debug_print
+--------------------------
+ on
+(1 row)
+
+SHOW pg_hint_plan.parse_messages;
+ pg_hint_plan.parse_messages
+-----------------------------
+ error
+(1 row)
+
+RESET pg_hint_plan.enable_hint;
+RESET pg_hint_plan.debug_print;
+RESET pg_hint_plan.parse_messages;
+SHOW pg_hint_plan.enable_hint;
+ pg_hint_plan.enable_hint
+--------------------------
+ on
+(1 row)
+
+SHOW pg_hint_plan.debug_print;
+ pg_hint_plan.debug_print
+--------------------------
+ off
+(1 row)
+
+SHOW pg_hint_plan.parse_messages;
+ pg_hint_plan.parse_messages
+-----------------------------
+ info
+(1 row)
+
+-- No. A-6-1-2
+SET ROLE normal_user;
+SHOW pg_hint_plan.enable_hint;
+ pg_hint_plan.enable_hint
+--------------------------
+ on
+(1 row)
+
+SHOW pg_hint_plan.debug_print;
+ pg_hint_plan.debug_print
+--------------------------
+ off
+(1 row)
+
+SHOW pg_hint_plan.parse_messages;
+ pg_hint_plan.parse_messages
+-----------------------------
+ info
+(1 row)
+
+SET pg_hint_plan.enable_hint TO off;
+SET pg_hint_plan.debug_print TO on;
+SET pg_hint_plan.parse_messages TO error;
+SHOW pg_hint_plan.enable_hint;
+ pg_hint_plan.enable_hint
+--------------------------
+ off
+(1 row)
+
+SHOW pg_hint_plan.debug_print;
+ pg_hint_plan.debug_print
+--------------------------
+ on
+(1 row)
+
+SHOW pg_hint_plan.parse_messages;
+ pg_hint_plan.parse_messages
+-----------------------------
+ error
+(1 row)
+
+RESET pg_hint_plan.enable_hint;
+RESET pg_hint_plan.debug_print;
+RESET pg_hint_plan.parse_messages;
+SHOW pg_hint_plan.enable_hint;
+ pg_hint_plan.enable_hint
+--------------------------
+ on
+(1 row)
+
+SHOW pg_hint_plan.debug_print;
+ pg_hint_plan.debug_print
+--------------------------
+ off
+(1 row)
+
+SHOW pg_hint_plan.parse_messages;
+ pg_hint_plan.parse_messages
+-----------------------------
+ info
+(1 row)
+
+RESET ROLE;
+----
+---- No. A-6-2 original GUC parameter pg_hint_plan.enable_hint
+----
+-- No. A-6-2-1
+SET pg_hint_plan.enable_hint TO on;
+SHOW pg_hint_plan.enable_hint;
+ pg_hint_plan.enable_hint
+--------------------------
+ on
+(1 row)
+
+/*+Set(enable_indexscan off)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 = 1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 = 1)
+(4 rows)
+
+-- No. A-6-2-2
+SET pg_hint_plan.enable_hint TO off;
+SHOW pg_hint_plan.enable_hint;
+ pg_hint_plan.enable_hint
+--------------------------
+ off
+(1 row)
+
+/*+Set(enable_indexscan off)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. A-6-2-3
+SET pg_hint_plan.enable_hint TO DEFAULT;
+SHOW pg_hint_plan.enable_hint;
+ pg_hint_plan.enable_hint
+--------------------------
+ on
+(1 row)
+
+/*+Set(enable_indexscan off)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 = 1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 = 1)
+(4 rows)
+
+-- No. A-6-2-4
+SET pg_hint_plan.enable_hint TO enable;
+ERROR: parameter "pg_hint_plan.enable_hint" requires a Boolean value
+SHOW pg_hint_plan.enable_hint;
+ pg_hint_plan.enable_hint
+--------------------------
+ on
+(1 row)
+
+----
+---- No. A-6-3 original GUC parameter pg_hint_plan.debug_print
+----
+-- No. A-6-3-1
+SET pg_hint_plan.debug_print TO on;
+SHOW pg_hint_plan.debug_print;
+ pg_hint_plan.debug_print
+--------------------------
+ on
+(1 row)
+
+/*+Set(enable_indexscan off)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 = 1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 = 1)
+(4 rows)
+
+-- No. A-6-3-2
+SET pg_hint_plan.debug_print TO off;
+SHOW pg_hint_plan.debug_print;
+ pg_hint_plan.debug_print
+--------------------------
+ off
+(1 row)
+
+/*+Set(enable_indexscan off)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 = 1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 = 1)
+(4 rows)
+
+-- No. A-6-3-3
+SET pg_hint_plan.debug_print TO DEFAULT;
+SHOW pg_hint_plan.debug_print;
+ pg_hint_plan.debug_print
+--------------------------
+ off
+(1 row)
+
+/*+Set(enable_indexscan off)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 = 1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 = 1)
+(4 rows)
+
+-- No. A-6-3-4
+SET pg_hint_plan.debug_print TO enable;
+ERROR: parameter "pg_hint_plan.debug_print" requires a Boolean value
+SHOW pg_hint_plan.debug_print;
+ pg_hint_plan.debug_print
+--------------------------
+ off
+(1 row)
+
+----
+---- No. A-6-4 original GUC parameter pg_hint_plan.parse_messages
+----
+SET client_min_messages TO debug5;
+DEBUG: CommitTransactionCommand
+DEBUG: CommitTransaction
+DEBUG: name: unnamed; blockState: STARTED; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+-- No. A-6-4-1
+SET pg_hint_plan.parse_messages TO debug5;
+DEBUG: StartTransactionCommand
+DEBUG: StartTransaction
+DEBUG: name: unnamed; blockState: DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+DEBUG: ProcessUtility
+DEBUG: CommitTransactionCommand
+DEBUG: CommitTransaction
+DEBUG: name: unnamed; blockState: STARTED; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+SHOW pg_hint_plan.parse_messages;
+DEBUG: StartTransactionCommand
+DEBUG: StartTransaction
+DEBUG: name: unnamed; blockState: DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+DEBUG: ProcessUtility
+DEBUG: CommitTransactionCommand
+DEBUG: CommitTransaction
+DEBUG: name: unnamed; blockState: STARTED; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+ pg_hint_plan.parse_messages
+-----------------------------
+ debug5
+(1 row)
+
+/*+Set*/SELECT 1;
+DEBUG: StartTransactionCommand
+DEBUG: StartTransaction
+DEBUG: name: unnamed; blockState: DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+DEBUG: hint syntax error at or near ""
+DETAIL: Opening parenthesis is necessary.
+DEBUG: CommitTransactionCommand
+DEBUG: CommitTransaction
+DEBUG: name: unnamed; blockState: STARTED; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+ ?column?
+----------
+ 1
+(1 row)
+
+SET client_min_messages TO debug4;
+DEBUG: StartTransactionCommand
+DEBUG: StartTransaction
+DEBUG: name: unnamed; blockState: DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+DEBUG: ProcessUtility
+DEBUG: CommitTransactionCommand
+DEBUG: CommitTransaction
+DEBUG: name: unnamed; blockState: STARTED; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+/*+Set*/SELECT 1;
+DEBUG: StartTransactionCommand
+DEBUG: StartTransaction
+DEBUG: name: unnamed; blockState: DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+DEBUG: CommitTransactionCommand
+DEBUG: CommitTransaction
+DEBUG: name: unnamed; blockState: STARTED; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+ ?column?
+----------
+ 1
+(1 row)
+
+-- No. A-6-4-2
+SET pg_hint_plan.parse_messages TO debug4;
+DEBUG: StartTransactionCommand
+DEBUG: StartTransaction
+DEBUG: name: unnamed; blockState: DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+DEBUG: ProcessUtility
+DEBUG: CommitTransactionCommand
+DEBUG: CommitTransaction
+DEBUG: name: unnamed; blockState: STARTED; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+SHOW pg_hint_plan.parse_messages;
+DEBUG: StartTransactionCommand
+DEBUG: StartTransaction
+DEBUG: name: unnamed; blockState: DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+DEBUG: ProcessUtility
+DEBUG: CommitTransactionCommand
+DEBUG: CommitTransaction
+DEBUG: name: unnamed; blockState: STARTED; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+ pg_hint_plan.parse_messages
+-----------------------------
+ debug4
+(1 row)
+
+/*+Set*/SELECT 1;
+DEBUG: StartTransactionCommand
+DEBUG: StartTransaction
+DEBUG: name: unnamed; blockState: DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+DEBUG: hint syntax error at or near ""
+DETAIL: Opening parenthesis is necessary.
+DEBUG: CommitTransactionCommand
+DEBUG: CommitTransaction
+DEBUG: name: unnamed; blockState: STARTED; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+ ?column?
+----------
+ 1
+(1 row)
+
+SET client_min_messages TO debug3;
+DEBUG: StartTransactionCommand
+DEBUG: StartTransaction
+DEBUG: name: unnamed; blockState: DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+DEBUG: ProcessUtility
+DEBUG: CommitTransactionCommand
+DEBUG: CommitTransaction
+DEBUG: name: unnamed; blockState: STARTED; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+/*+Set*/SELECT 1;
+DEBUG: StartTransactionCommand
+DEBUG: StartTransaction
+DEBUG: name: unnamed; blockState: DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+DEBUG: CommitTransactionCommand
+DEBUG: CommitTransaction
+DEBUG: name: unnamed; blockState: STARTED; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+ ?column?
+----------
+ 1
+(1 row)
+
+-- No. A-6-4-3
+SET pg_hint_plan.parse_messages TO debug3;
+DEBUG: StartTransactionCommand
+DEBUG: StartTransaction
+DEBUG: name: unnamed; blockState: DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+DEBUG: ProcessUtility
+DEBUG: CommitTransactionCommand
+DEBUG: CommitTransaction
+DEBUG: name: unnamed; blockState: STARTED; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+SHOW pg_hint_plan.parse_messages;
+DEBUG: StartTransactionCommand
+DEBUG: StartTransaction
+DEBUG: name: unnamed; blockState: DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+DEBUG: ProcessUtility
+DEBUG: CommitTransactionCommand
+DEBUG: CommitTransaction
+DEBUG: name: unnamed; blockState: STARTED; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+ pg_hint_plan.parse_messages
+-----------------------------
+ debug3
+(1 row)
+
+/*+Set*/SELECT 1;
+DEBUG: StartTransactionCommand
+DEBUG: StartTransaction
+DEBUG: name: unnamed; blockState: DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+DEBUG: hint syntax error at or near ""
+DETAIL: Opening parenthesis is necessary.
+DEBUG: CommitTransactionCommand
+DEBUG: CommitTransaction
+DEBUG: name: unnamed; blockState: STARTED; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+ ?column?
+----------
+ 1
+(1 row)
+
+SET client_min_messages TO debug2;
+DEBUG: StartTransactionCommand
+DEBUG: StartTransaction
+DEBUG: name: unnamed; blockState: DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+DEBUG: ProcessUtility
+/*+Set*/SELECT 1;
+ ?column?
+----------
+ 1
+(1 row)
+
+-- No. A-6-4-4
+SET pg_hint_plan.parse_messages TO debug2;
+SHOW pg_hint_plan.parse_messages;
+ pg_hint_plan.parse_messages
+-----------------------------
+ debug
+(1 row)
+
+/*+Set*/SELECT 1;
+DEBUG: hint syntax error at or near ""
+DETAIL: Opening parenthesis is necessary.
+ ?column?
+----------
+ 1
+(1 row)
+
+SET client_min_messages TO debug1;
+/*+Set*/SELECT 1;
+ ?column?
+----------
+ 1
+(1 row)
+
+-- No. A-6-4-5
+SET pg_hint_plan.parse_messages TO debug1;
+SHOW pg_hint_plan.parse_messages;
+ pg_hint_plan.parse_messages
+-----------------------------
+ debug1
+(1 row)
+
+/*+Set*/SELECT 1;
+DEBUG: hint syntax error at or near ""
+DETAIL: Opening parenthesis is necessary.
+ ?column?
+----------
+ 1
+(1 row)
+
+SET client_min_messages TO log;
+/*+Set*/SELECT 1;
+ ?column?
+----------
+ 1
+(1 row)
+
+-- No. A-6-4-6
+SET pg_hint_plan.parse_messages TO log;
+SHOW pg_hint_plan.parse_messages;
+ pg_hint_plan.parse_messages
+-----------------------------
+ log
+(1 row)
+
+/*+Set*/SELECT 1;
+LOG: hint syntax error at or near ""
+DETAIL: Opening parenthesis is necessary.
+ ?column?
+----------
+ 1
+(1 row)
+
+SET client_min_messages TO info;
+/*+Set*/SELECT 1;
+ ?column?
+----------
+ 1
+(1 row)
+
+-- No. A-6-4-7
+SET pg_hint_plan.parse_messages TO info;
+SHOW pg_hint_plan.parse_messages;
+ pg_hint_plan.parse_messages
+-----------------------------
+ info
+(1 row)
+
+/*+Set*/SELECT 1;
+INFO: hint syntax error at or near ""
+DETAIL: Opening parenthesis is necessary.
+ ?column?
+----------
+ 1
+(1 row)
+
+SET client_min_messages TO notice;
+/*+Set*/SELECT 1;
+INFO: hint syntax error at or near ""
+DETAIL: Opening parenthesis is necessary.
+ ?column?
+----------
+ 1
+(1 row)
+
+-- No. A-6-4-8
+SET pg_hint_plan.parse_messages TO notice;
+SHOW pg_hint_plan.parse_messages;
+ pg_hint_plan.parse_messages
+-----------------------------
+ notice
+(1 row)
+
+/*+Set*/SELECT 1;
+NOTICE: hint syntax error at or near ""
+DETAIL: Opening parenthesis is necessary.
+ ?column?
+----------
+ 1
+(1 row)
+
+SET client_min_messages TO warning;
+/*+Set*/SELECT 1;
+ ?column?
+----------
+ 1
+(1 row)
+
+-- No. A-6-4-9
+SET pg_hint_plan.parse_messages TO warning;
+SHOW pg_hint_plan.parse_messages;
+ pg_hint_plan.parse_messages
+-----------------------------
+ warning
+(1 row)
+
+/*+Set*/SELECT 1;
+WARNING: hint syntax error at or near ""
+DETAIL: Opening parenthesis is necessary.
+ ?column?
+----------
+ 1
+(1 row)
+
+SET client_min_messages TO error;
+/*+Set*/SELECT 1;
+ ?column?
+----------
+ 1
+(1 row)
+
+-- No. A-6-4-10
+SET pg_hint_plan.parse_messages TO error;
+SHOW pg_hint_plan.parse_messages;
+ pg_hint_plan.parse_messages
+-----------------------------
+ error
+(1 row)
+
+/*+Set*/SELECT 1;
+ERROR: hint syntax error at or near ""
+DETAIL: Opening parenthesis is necessary.
+SET client_min_messages TO fatal;
+/*+Set*/SELECT 1;
+-- No. A-6-4-11
+RESET client_min_messages;
+SET pg_hint_plan.parse_messages TO DEFAULT;
+SHOW pg_hint_plan.parse_messages;
+ pg_hint_plan.parse_messages
+-----------------------------
+ info
+(1 row)
+
+/*+Set*/SELECT 1;
+INFO: hint syntax error at or near ""
+DETAIL: Opening parenthesis is necessary.
+ ?column?
+----------
+ 1
+(1 row)
+
+-- No. A-6-4-12
+SET pg_hint_plan.parse_messages TO fatal;
+ERROR: invalid value for parameter "pg_hint_plan.parse_messages": "fatal"
+HINT: Available values: debug5, debug4, debug3, debug2, debug1, log, info, notice, warning, error.
+SHOW pg_hint_plan.parse_messages;
+ pg_hint_plan.parse_messages
+-----------------------------
+ info
+(1 row)
+
+-- No. A-6-4-13
+SET pg_hint_plan.parse_messages TO panic;
+ERROR: invalid value for parameter "pg_hint_plan.parse_messages": "panic"
+HINT: Available values: debug5, debug4, debug3, debug2, debug1, log, info, notice, warning, error.
+SHOW pg_hint_plan.parse_messages;
+ pg_hint_plan.parse_messages
+-----------------------------
+ info
+(1 row)
+
+-- No. A-6-4-14
+SET pg_hint_plan.parse_messages TO on;
+ERROR: invalid value for parameter "pg_hint_plan.parse_messages": "on"
+HINT: Available values: debug5, debug4, debug3, debug2, debug1, log, info, notice, warning, error.
+SHOW pg_hint_plan.parse_messages;
+ pg_hint_plan.parse_messages
+-----------------------------
+ info
+(1 row)
+
+----
+---- No. A-7-1 parse error message output
+----
+-- No. A-7-1-1
+/*+"Set"(enable_indexscan on)*/SELECT 1;
+INFO: hint syntax error at or near ""Set"(enable_indexscan on)"
+DETAIL: Unrecognized hint keyword ""Set"".
+ ?column?
+----------
+ 1
+(1 row)
+
+/*+Set()(enable_indexscan on)*/SELECT 1;
+INFO: hint syntax error at or near ")(enable_indexscan on)"
+DETAIL: Parameter name is necessary.
+ ?column?
+----------
+ 1
+(1 row)
+
+/*+Set(enable_indexscan on*/SELECT 1;
+INFO: hint syntax error at or near ""
+DETAIL: Closing parenthesis is necessary.
+ ?column?
+----------
+ 1
+(1 row)
+
+----
+---- No. A-7-3 hint state output
+----
+SET pg_hint_plan.debug_print TO on;
+SET client_min_messages TO LOG;
+-- No. A-7-3-1
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-7-3-2
+/*+SeqScan(no_table)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+SeqScan(no_table)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. A-7-3-3
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(3 rows)
+
+/*+TidScan(t1)BitmapScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid = '(1,1)';
+INFO: hint syntax error at or near "TidScan(t1)BitmapScan(t1)"
+DETAIL: Conflict scan method hint.
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+TidScan(t1)
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 = 1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 = 1)
+(5 rows)
+
+/*+TidScan(t1)BitmapScan(t1)IndexScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid = '(1,1)';
+INFO: hint syntax error at or near "TidScan(t1)BitmapScan(t1)IndexScan(t1)"
+DETAIL: Conflict scan method hint.
+INFO: hint syntax error at or near "BitmapScan(t1)IndexScan(t1)"
+DETAIL: Conflict scan method hint.
+LOG: pg_hint_plan:
+used hint:
+IndexScan(t1)
+not used hint:
+duplication hint:
+TidScan(t1)
+BitmapScan(t1)
+error hint:
+
+ QUERY PLAN
+---------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+ Filter: (ctid = '(1,1)'::tid)
+(3 rows)
+
+/*+TidScan(t1)BitmapScan(t1)IndexScan(t1)SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid = '(1,1)';
+INFO: hint syntax error at or near "TidScan(t1)BitmapScan(t1)IndexScan(t1)SeqScan(t1)"
+DETAIL: Conflict scan method hint.
+INFO: hint syntax error at or near "BitmapScan(t1)IndexScan(t1)SeqScan(t1)"
+DETAIL: Conflict scan method hint.
+INFO: hint syntax error at or near "IndexScan(t1)SeqScan(t1)"
+DETAIL: Conflict scan method hint.
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+TidScan(t1)
+BitmapScan(t1)
+IndexScan(t1)
+error hint:
+
+ QUERY PLAN
+------------------------------------------------
+ Seq Scan on t1
+ Filter: ((c1 = 1) AND (ctid = '(1,1)'::tid))
+(2 rows)
+
+-- No. A-7-3-4
+/*+Set(enable_indexscan enable)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+INFO: parameter "enable_indexscan" requires a Boolean value
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+Set(enable_indexscan enable)
+
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+----
+---- No. A-8-1 hint state output
+----
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+EXPLAIN (COSTS false) EXECUTE p1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+DEALLOCATE p1;
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 < $1;
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c1 < $1)
+(2 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c1 < $1)
+(2 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c1 < $1)
+(2 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c1 < $1)
+(2 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c1 < $1)
+(2 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c1 < $1)
+(2 rows)
+
+DEALLOCATE p1;
+-- No. A-8-1-1
+-- No. A-8-1-2
+/*+SeqScan(t1)*/
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) EXECUTE p1;
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) EXECUTE p1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+DEALLOCATE p1;
+/*+BitmapScan(t1)*/
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 < $1;
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < $1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < $1)
+(4 rows)
+
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < $1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < $1)
+(4 rows)
+
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < $1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < $1)
+(4 rows)
+
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < $1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < $1)
+(4 rows)
+
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < $1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < $1)
+(4 rows)
+
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < $1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < $1)
+(4 rows)
+
+UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < $1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < $1)
+(4 rows)
+
+DEALLOCATE p1;
+-- No. A-8-1-3
+-- No. A-8-1-4
+/*+SeqScan(t1)*/
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+EXPLAIN (COSTS false) EXECUTE p1;
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
+EXPLAIN (COSTS false) EXECUTE p1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+DEALLOCATE p1;
+/*+BitmapScan(t1)*/
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 < $1;
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < $1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < $1)
+(4 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < $1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < $1)
+(4 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < $1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < $1)
+(4 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < $1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < $1)
+(4 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < $1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < $1)
+(4 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < $1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < $1)
+(4 rows)
+
+UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < $1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < $1)
+(4 rows)
+
+DEALLOCATE p1;
+-- No. A-8-1-5
+-- No. A-8-1-6
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) EXECUTE p1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) EXECUTE p1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+DEALLOCATE p1;
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 < $1;
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c1 < $1)
+(2 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c1 < $1)
+(2 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c1 < $1)
+(2 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c1 < $1)
+(2 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c1 < $1)
+(2 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c1 < $1)
+(2 rows)
+
+UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c1 < $1)
+(2 rows)
+
+DEALLOCATE p1;
+-- No. A-8-1-9
+-- No. A-8-1-10
+/*+SeqScan(t1)*/
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1;
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+DEALLOCATE p1;
+/*+BitmapScan(t1)*/
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 < $1;
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < $1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < $1)
+(4 rows)
+
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < $1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < $1)
+(4 rows)
+
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < $1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < $1)
+(4 rows)
+
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < $1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < $1)
+(4 rows)
+
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < $1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < $1)
+(4 rows)
+
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < $1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < $1)
+(4 rows)
+
+UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < $1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < $1)
+(4 rows)
+
+DEALLOCATE p1;
+-- No. A-8-1-11
+-- No. A-8-1-12
+/*+SeqScan(t1)*/
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1;
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+DEALLOCATE p1;
+/*+BitmapScan(t1)*/
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 < $1;
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < $1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < $1)
+(4 rows)
+
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < $1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < $1)
+(4 rows)
+
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < $1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < $1)
+(4 rows)
+
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < $1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < $1)
+(4 rows)
+
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < $1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < $1)
+(4 rows)
+
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < $1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < $1)
+(4 rows)
+
+UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < $1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < $1)
+(4 rows)
+
+DEALLOCATE p1;
+-- No. A-8-1-13
+-- No. A-8-1-14
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+DEALLOCATE p1;
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 < $1;
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c1 < $1)
+(2 rows)
+
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c1 < $1)
+(2 rows)
+
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c1 < $1)
+(2 rows)
+
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c1 < $1)
+(2 rows)
+
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c1 < $1)
+(2 rows)
+
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c1 < $1)
+(2 rows)
+
+UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c1 < $1)
+(2 rows)
+
+DEALLOCATE p1;
+----
+---- No. A-8-4 EXECUTE statement name error
+----
+-- No. A-8-4-1
+EXECUTE p1;
+ERROR: prepared statement "p1" does not exist
+SHOW pg_hint_plan.debug_print;
+ pg_hint_plan.debug_print
+--------------------------
+ on
+(1 row)
+
+----
+---- No. A-9-5 EXECUTE statement name error
+----
+-- No. A-9-5-1
+SELECT pg_stat_statements_reset();
+ pg_stat_statements_reset
+--------------------------
+
+(1 row)
+
+SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ c1 | c2 | c3 | c4
+----+----+----+----
+ 1 | 1 | 1 | 1
+(1 row)
+
+/*+Set(enable_seqscan off)*/ SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_seqscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ c1 | c2 | c3 | c4
+----+----+----+----
+ 1 | 1 | 1 | 1
+(1 row)
+
+/*+SeqScan(t1)*/ SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ c1 | c2 | c3 | c4
+----+----+----+----
+ 1 | 1 | 1 | 1
+(1 row)
+
+SELECT s.query, s.calls
+ FROM public.pg_stat_statements s
+ JOIN pg_catalog.pg_database d
+ ON (s.dbid = d.oid)
+ ORDER BY 1;
+ query | calls
+-------------------------------------------------------------------+-------
+ /*+SeqScan(t1)*/ SELECT * FROM s1.t1 WHERE t1.c1 = 1; | 1
+ /*+Set(enable_seqscan off)*/ SELECT * FROM s1.t1 WHERE t1.c1 = 1; | 1
+ SELECT * FROM s1.t1 WHERE t1.c1 = 1; | 1
+ SELECT pg_stat_statements_reset(); | 1
+(4 rows)
+
+----
+---- No. A-10-1 duplicate hint
+----
+-- No. A-10-1-1
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.ctid = '(1,1)' AND t1.c1 = t2.c1 AND t2.ctid = '(1,1)' AND t1.c1 = t3.c1 AND t3.ctid = '(1,1)' AND t1.c1 = t4.c1 AND t4.ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------
+ Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t2.c1)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(14 rows)
+
+/*+
+Set(enable_tidscan aaa)
+Set(enable_tidscan on)
+Set(enable_tidscan off)
+SeqScan(t4)
+IndexScan(t4)
+BitmapScan(t4)
+TidScan(t4)
+NestLoop(t4 t3)
+MergeJoin(t4 t3)
+HashJoin(t4 t3)
+Leading(t2 t1 t4 t3)
+Leading(t1 t4 t3 t2)
+Leading(t4 t3 t2 t1)
+*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.ctid = '(1,1)' AND t1.c1 = t2.c1 AND t2.ctid = '(1,1)' AND t1.c1 = t3.c1 AND t3.ctid = '(1,1)' AND t1.c1 = t4.c1 AND t4.ctid = '(1,1)';
+INFO: hint syntax error at or near "SeqScan(t4)
+IndexScan(t4)
+BitmapScan(t4)
+TidScan(t4)
+NestLoop(t4 t3)
+MergeJoin(t4 t3)
+HashJoin(t4 t3)
+Leading(t2 t1 t4 t3)
+Leading(t1 t4 t3 t2)
+Leading(t4 t3 t2 t1)
+"
+DETAIL: Conflict scan method hint.
+INFO: hint syntax error at or near "IndexScan(t4)
+BitmapScan(t4)
+TidScan(t4)
+NestLoop(t4 t3)
+MergeJoin(t4 t3)
+HashJoin(t4 t3)
+Leading(t2 t1 t4 t3)
+Leading(t1 t4 t3 t2)
+Leading(t4 t3 t2 t1)
+"
+DETAIL: Conflict scan method hint.
+INFO: hint syntax error at or near "BitmapScan(t4)
+TidScan(t4)
+NestLoop(t4 t3)
+MergeJoin(t4 t3)
+HashJoin(t4 t3)
+Leading(t2 t1 t4 t3)
+Leading(t1 t4 t3 t2)
+Leading(t4 t3 t2 t1)
+"
+DETAIL: Conflict scan method hint.
+INFO: hint syntax error at or near "NestLoop(t4 t3)
+MergeJoin(t4 t3)
+HashJoin(t4 t3)
+Leading(t2 t1 t4 t3)
+Leading(t1 t4 t3 t2)
+Leading(t4 t3 t2 t1)
+"
+DETAIL: Conflict join method hint.
+INFO: hint syntax error at or near "MergeJoin(t4 t3)
+HashJoin(t4 t3)
+Leading(t2 t1 t4 t3)
+Leading(t1 t4 t3 t2)
+Leading(t4 t3 t2 t1)
+"
+DETAIL: Conflict join method hint.
+INFO: hint syntax error at or near "Leading(t2 t1 t4 t3)
+Leading(t1 t4 t3 t2)
+Leading(t4 t3 t2 t1)
+"
+DETAIL: Conflict leading hint.
+INFO: hint syntax error at or near "Leading(t1 t4 t3 t2)
+Leading(t4 t3 t2 t1)
+"
+DETAIL: Conflict leading hint.
+INFO: hint syntax error at or near "Set(enable_tidscan aaa)
+Set(enable_tidscan on)
+Set(enable_tidscan off)
+SeqScan(t4)
+IndexScan(t4)
+BitmapScan(t4)
+TidScan(t4)
+NestLoop(t4 t3)
+MergeJoin(t4 t3)
+HashJoin(t4 t3)
+Leading(t2 t1 t4 t3)
+Leading(t1 t4 t3 t2)
+Leading(t4 t3 t2 t1)
+"
+DETAIL: Conflict set hint.
+INFO: hint syntax error at or near "Set(enable_tidscan on)
+Set(enable_tidscan off)
+SeqScan(t4)
+IndexScan(t4)
+BitmapScan(t4)
+TidScan(t4)
+NestLoop(t4 t3)
+MergeJoin(t4 t3)
+HashJoin(t4 t3)
+Leading(t2 t1 t4 t3)
+Leading(t1 t4 t3 t2)
+Leading(t4 t3 t2 t1)
+"
+DETAIL: Conflict set hint.
+LOG: pg_hint_plan:
+used hint:
+TidScan(t4)
+HashJoin(t3 t4)
+Leading(t4 t3 t2 t1)
+Set(enable_tidscan off)
+not used hint:
+duplication hint:
+SeqScan(t4)
+IndexScan(t4)
+BitmapScan(t4)
+NestLoop(t3 t4)
+MergeJoin(t3 t4)
+Leading(t2 t1 t4 t3)
+Leading(t1 t4 t3 t2)
+Set(enable_tidscan aaa)
+Set(enable_tidscan on)
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------
+ Nested Loop
+ -> Nested Loop
+ Join Filter: (t3.c1 = t2.c1)
+ -> Hash Join
+ Hash Cond: (t3.c1 = t4.c1)
+ -> Seq Scan on t3
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = t2.c1)
+ Filter: (ctid = '(1,1)'::tid)
+(15 rows)
+
+-- No. A-10-1-2
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.ctid = '(1,1)' AND t1.c1 = t2.c1 AND t2.ctid = '(1,1)' AND t1.c1 = t3.c1 AND t3.ctid = '(1,1)' AND t1.c1 = t4.c1 AND t4.ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------
+ Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t2.c1)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(14 rows)
+
+/*+
+SeqScan(t4)
+Set(enable_tidscan aaa)
+IndexScan(t4)
+NestLoop(t4 t3)
+Leading(t2 t1 t4 t3)
+Set(enable_tidscan on)
+BitmapScan(t4)
+MergeJoin(t4 t3)
+Leading(t1 t4 t3 t2)
+Set(enable_tidscan off)
+TidScan(t4)
+HashJoin(t4 t3)
+Leading(t4 t3 t2 t1)
+*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.ctid = '(1,1)' AND t1.c1 = t2.c1 AND t2.ctid = '(1,1)' AND t1.c1 = t3.c1 AND t3.ctid = '(1,1)' AND t1.c1 = t4.c1 AND t4.ctid = '(1,1)';
+INFO: hint syntax error at or near "SeqScan(t4)
+Set(enable_tidscan aaa)
+IndexScan(t4)
+NestLoop(t4 t3)
+Leading(t2 t1 t4 t3)
+Set(enable_tidscan on)
+BitmapScan(t4)
+MergeJoin(t4 t3)
+Leading(t1 t4 t3 t2)
+Set(enable_tidscan off)
+TidScan(t4)
+HashJoin(t4 t3)
+Leading(t4 t3 t2 t1)
+"
+DETAIL: Conflict scan method hint.
+INFO: hint syntax error at or near "IndexScan(t4)
+NestLoop(t4 t3)
+Leading(t2 t1 t4 t3)
+Set(enable_tidscan on)
+BitmapScan(t4)
+MergeJoin(t4 t3)
+Leading(t1 t4 t3 t2)
+Set(enable_tidscan off)
+TidScan(t4)
+HashJoin(t4 t3)
+Leading(t4 t3 t2 t1)
+"
+DETAIL: Conflict scan method hint.
+INFO: hint syntax error at or near "BitmapScan(t4)
+MergeJoin(t4 t3)
+Leading(t1 t4 t3 t2)
+Set(enable_tidscan off)
+TidScan(t4)
+HashJoin(t4 t3)
+Leading(t4 t3 t2 t1)
+"
+DETAIL: Conflict scan method hint.
+INFO: hint syntax error at or near "NestLoop(t4 t3)
+Leading(t2 t1 t4 t3)
+Set(enable_tidscan on)
+BitmapScan(t4)
+MergeJoin(t4 t3)
+Leading(t1 t4 t3 t2)
+Set(enable_tidscan off)
+TidScan(t4)
+HashJoin(t4 t3)
+Leading(t4 t3 t2 t1)
+"
+DETAIL: Conflict join method hint.
+INFO: hint syntax error at or near "MergeJoin(t4 t3)
+Leading(t1 t4 t3 t2)
+Set(enable_tidscan off)
+TidScan(t4)
+HashJoin(t4 t3)
+Leading(t4 t3 t2 t1)
+"
+DETAIL: Conflict join method hint.
+INFO: hint syntax error at or near "Leading(t2 t1 t4 t3)
+Set(enable_tidscan on)
+BitmapScan(t4)
+MergeJoin(t4 t3)
+Leading(t1 t4 t3 t2)
+Set(enable_tidscan off)
+TidScan(t4)
+HashJoin(t4 t3)
+Leading(t4 t3 t2 t1)
+"
+DETAIL: Conflict leading hint.
+INFO: hint syntax error at or near "Leading(t1 t4 t3 t2)
+Set(enable_tidscan off)
+TidScan(t4)
+HashJoin(t4 t3)
+Leading(t4 t3 t2 t1)
+"
+DETAIL: Conflict leading hint.
+INFO: hint syntax error at or near "Set(enable_tidscan aaa)
+IndexScan(t4)
+NestLoop(t4 t3)
+Leading(t2 t1 t4 t3)
+Set(enable_tidscan on)
+BitmapScan(t4)
+MergeJoin(t4 t3)
+Leading(t1 t4 t3 t2)
+Set(enable_tidscan off)
+TidScan(t4)
+HashJoin(t4 t3)
+Leading(t4 t3 t2 t1)
+"
+DETAIL: Conflict set hint.
+INFO: hint syntax error at or near "Set(enable_tidscan on)
+BitmapScan(t4)
+MergeJoin(t4 t3)
+Leading(t1 t4 t3 t2)
+Set(enable_tidscan off)
+TidScan(t4)
+HashJoin(t4 t3)
+Leading(t4 t3 t2 t1)
+"
+DETAIL: Conflict set hint.
+LOG: pg_hint_plan:
+used hint:
+TidScan(t4)
+HashJoin(t3 t4)
+Leading(t4 t3 t2 t1)
+Set(enable_tidscan off)
+not used hint:
+duplication hint:
+SeqScan(t4)
+IndexScan(t4)
+BitmapScan(t4)
+NestLoop(t3 t4)
+MergeJoin(t3 t4)
+Leading(t2 t1 t4 t3)
+Leading(t1 t4 t3 t2)
+Set(enable_tidscan aaa)
+Set(enable_tidscan on)
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------
+ Nested Loop
+ -> Nested Loop
+ Join Filter: (t3.c1 = t2.c1)
+ -> Hash Join
+ Hash Cond: (t3.c1 = t4.c1)
+ -> Seq Scan on t3
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = t2.c1)
+ Filter: (ctid = '(1,1)'::tid)
+(15 rows)
+
+----
+---- No. A-10-2 restrict query type
+----
+-- No. A-10-2-1
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 FULL OUTER JOIN s1.t2 ON (t1.c1 = t2.c1);
+ QUERY PLAN
+------------------------------
+ Hash Full Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+/*+NestLoop(t1 t2)*/
+EXPLAIN (COSTS true) SELECT * FROM s1.t1 FULL OUTER JOIN s1.t2 ON (t1.c1 = t2.c1);
+LOG: pg_hint_plan:
+used hint:
+NestLoop(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------------------------------
+ Hash Full Join (cost=10000000003.25..10000000024.00 rows=1000 width=29)
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on t1 (cost=0.00..16.00 rows=1000 width=15)
+ -> Hash (cost=2.00..2.00 rows=100 width=14)
+ -> Seq Scan on t2 (cost=0.00..2.00 rows=100 width=14)
+(5 rows)
+
+-- No. A-10-2-2
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c3 = 1;
+ QUERY PLAN
+---------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c3 = 1)
+ -> Bitmap Index Scan on t1_i
+ Index Cond: (c3 = 1)
+(4 rows)
+
+/*+IndexScan(t1 t1_i1)*/
+EXPLAIN (COSTS true) SELECT * FROM s1.t1 WHERE t1.c3 = 1;
+LOG: pg_hint_plan:
+used hint:
+IndexScan(t1 t1_i1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------------------------
+ Seq Scan on t1 (cost=10000000000.00..10000000018.50 rows=10 width=15)
+ Filter: (c3 = 1)
+(2 rows)
+
+-- No. A-10-2-3
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+/*+TidScan(t1)*/
+EXPLAIN (COSTS true) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+TidScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------
+ Seq Scan on t1 (cost=10000000000.00..10000000018.50 rows=1 width=15)
+ Filter: (c1 = 1)
+(2 rows)
+
+----
+---- No. A-10-3 VIEW, RULE multi specified
+----
+-- No. A-10-3-1
+EXPLAIN (COSTS false) SELECT * FROM s1.v1 v1, s1.v1 v2 WHERE v1.c1 = v2.c1;
+ QUERY PLAN
+----------------------------------
+ Hash Join
+ Hash Cond: (v1t1.c1 = v1t1.c1)
+ -> Seq Scan on t1 v1t1
+ -> Hash
+ -> Seq Scan on t1 v1t1
+(5 rows)
+
+/*+Leading(v1t1 v1t1)HashJoin(v1t1 v1t1)BitmapScan(v1t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.v1 v1, s1.v1 v2 WHERE v1.c1 = v2.c1;
+INFO: hint syntax error at or near "HashJoin(v1t1 v1t1)BitmapScan(v1t1)"
+DETAIL: Relation name "v1t1" is ambiguous.
+INFO: hint syntax error at or near "Leading(v1t1 v1t1)HashJoin(v1t1 v1t1)BitmapScan(v1t1)"
+DETAIL: Relation name "v1t1" is ambiguous.
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(v1t1)
+not used hint:
+Leading(v1t1 v1t1)
+duplication hint:
+error hint:
+HashJoin(v1t1 v1t1)
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Index Scan using t1_i1 on t1 v1t1
+ -> Bitmap Heap Scan on t1 v1t1
+ Recheck Cond: (c1 = v1t1.c1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 = v1t1.c1)
+(6 rows)
+
+-- No. A-10-3-2
+EXPLAIN (COSTS false) SELECT * FROM s1.v1 v1, s1.v1_ v2 WHERE v1.c1 = v2.c1;
+ QUERY PLAN
+-----------------------------------
+ Hash Join
+ Hash Cond: (v1t1.c1 = v1t1_.c1)
+ -> Seq Scan on t1 v1t1
+ -> Hash
+ -> Seq Scan on t1 v1t1_
+(5 rows)
+
+/*+Leading(v1t1 v1t1_)NestLoop(v1t1 v1t1_)SeqScan(v1t1)BitmapScan(v1t1_)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.v1 v1, s1.v1_ v2 WHERE v1.c1 = v2.c1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(v1t1)
+BitmapScan(v1t1_)
+NestLoop(v1t1 v1t1_)
+Leading(v1t1 v1t1_)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Seq Scan on t1 v1t1
+ -> Bitmap Heap Scan on t1 v1t1_
+ Recheck Cond: (c1 = v1t1.c1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 = v1t1.c1)
+(6 rows)
+
+-- No. A-10-3-3
+EXPLAIN (COSTS false) SELECT * FROM s1.r4 t1, s1.r4 t2 WHERE t1.c1 = t2.c1;
+ QUERY PLAN
+----------------------------------
+ Hash Join
+ Hash Cond: (r4t1.c1 = r4t1.c1)
+ -> Seq Scan on t1 r4t1
+ -> Hash
+ -> Seq Scan on t1 r4t1
+(5 rows)
+
+/*+Leading(r4t1 r4t1)HashJoin(r4t1 r4t1)BitmapScan(r4t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.r4 t1, s1.r4 t2 WHERE t1.c1 = t2.c1;
+INFO: hint syntax error at or near "HashJoin(r4t1 r4t1)BitmapScan(r4t1)"
+DETAIL: Relation name "r4t1" is ambiguous.
+INFO: hint syntax error at or near "Leading(r4t1 r4t1)HashJoin(r4t1 r4t1)BitmapScan(r4t1)"
+DETAIL: Relation name "r4t1" is ambiguous.
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(r4t1)
+not used hint:
+Leading(r4t1 r4t1)
+duplication hint:
+error hint:
+HashJoin(r4t1 r4t1)
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Index Scan using t1_i1 on t1 r4t1
+ -> Bitmap Heap Scan on t1 r4t1
+ Recheck Cond: (c1 = r4t1.c1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 = r4t1.c1)
+(6 rows)
+
+-- No. A-10-3-4
+EXPLAIN (COSTS false) SELECT * FROM s1.r4 t1, s1.r5 t2 WHERE t1.c1 = t2.c1;
+ QUERY PLAN
+----------------------------------
+ Hash Join
+ Hash Cond: (r4t1.c1 = r5t1.c1)
+ -> Seq Scan on t1 r4t1
+ -> Hash
+ -> Seq Scan on t1 r5t1
+(5 rows)
+
+/*+Leading(r4t1 r5t1)NestLoop(r4t1 r5t1)SeqScan(r4t1)BitmapScan(r5t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.r4 t1, s1.r5 t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(r4t1)
+BitmapScan(r5t1)
+NestLoop(r4t1 r5t1)
+Leading(r4t1 r5t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Seq Scan on t1 r4t1
+ -> Bitmap Heap Scan on t1 r5t1
+ Recheck Cond: (c1 = r4t1.c1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 = r4t1.c1)
+(6 rows)
+
+----
+---- No. A-11-1 psql command
+----
+SELECT count(*) FROM s1.t1 WHERE t1.c1 = 1;
+ count
+-------
+ 1
+(1 row)
+
+/*+SeqScan(t1)*/
+SELECT count(*) FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ count
+-------
+ 1
+(1 row)
+
+-- No. A-11-1-4
+\set FETCH_COUNT 0
+/*+SeqScan(t1)*/
+SELECT count(*) FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ count
+-------
+ 1
+(1 row)
+
+-- No. A-11-1-5
+\set FETCH_COUNT 1
+/*+SeqScan(t1)*/
+SELECT count(*) FROM s1.t1 WHERE t1.c1 = 1;
+ count
+-------
+ 1
+(1 row)
+
+\unset FETCH_COUNT
+----
+---- No. A-11-4 PL/pgSQL function
+----
+-- No. A-11-4-1
+CREATE OR REPLACE FUNCTION f1() RETURNS SETOF text LANGUAGE plpgsql AS $$
+DECLARE
+ r text;
+BEGIN
+ FOR r IN EXPLAIN SELECT c4 FROM s1.t1 WHERE t1.c1 = 1
+ LOOP
+ RETURN NEXT r; -- return current row of SELECT
+ END LOOP;
+ RETURN;
+END
+$$;
+SELECT f1();
+ f1
+----------------------------------------------------------------
+ Index Scan using t1_i1 on t1 (cost=0.00..8.27 rows=1 width=3)
+ Index Cond: (c1 = 1)
+(2 rows)
+
+/*+SeqScan(t1)*/
+SELECT f1();
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+SeqScan(t1)
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+CONTEXT: PL/pgSQL function "f1" line 5 at FOR over SELECT rows
+ f1
+---------------------------------------------------
+ Seq Scan on t1 (cost=0.00..18.50 rows=1 width=3)
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-11-4-2
+/*+SeqScan(t1)*/CREATE OR REPLACE FUNCTION f1() RETURNS SETOF text LANGUAGE plpgsql AS $$
+DECLARE
+ r text;
+BEGIN
+ /*+SeqScan(t1)*/FOR r IN EXPLAIN /*+SeqScan(t1)*/SELECT c4 FROM s1.t1 WHERE t1.c1 = 1
+ LOOP
+ /*+SeqScan(t1)*/RETURN NEXT r; -- return current row of SELECT
+ END LOOP;
+ /*+SeqScan(t1)*/RETURN;
+END
+$$;
+SELECT f1();
+ f1
+----------------------------------------------------------------
+ Index Scan using t1_i1 on t1 (cost=0.00..8.27 rows=1 width=3)
+ Index Cond: (c1 = 1)
+(2 rows)
+
+----
+---- No. A-12-1 reset of global variable of core at the error
+---- No. A-12-2 reset of global variable of original at the error
+----
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(6 rows)
+
+/*+Set(enable_seqscan off)Set(geqo_threshold 100)SeqScan(t1)MergeJoin(t1 t2)NestLoop(t1 t1)*/
+PREPARE p1 AS SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+INFO: hint syntax error at or near "NestLoop(t1 t1)"
+DETAIL: Relation name "t1" is duplicated.
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+MergeJoin(t1 t2)
+Set(enable_seqscan off)
+Set(geqo_threshold 100)
+not used hint:
+duplication hint:
+error hint:
+NestLoop(t1 t1)
+
+EXPLAIN (COSTS false) EXECUTE p1;
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Sort
+ Sort Key: t1.c1
+ -> Seq Scan on t1
+ -> Index Scan using t2_i1 on t2
+(6 rows)
+
+-- No. A-12-1-1
+-- No. A-12-2-1
+SELECT name, setting FROM settings;
+ name | setting
+---------------------------+-----------
+ geqo | on
+ geqo_effort | 5
+ geqo_generations | 0
+ geqo_pool_size | 0
+ geqo_seed | 0
+ geqo_selection_bias | 2
+ geqo_threshold | 12
+ constraint_exclusion | partition
+ cursor_tuple_fraction | 0.1
+ default_statistics_target | 100
+ from_collapse_limit | 8
+ join_collapse_limit | 8
+ cpu_index_tuple_cost | 0.005
+ cpu_operator_cost | 0.0025
+ cpu_tuple_cost | 0.01
+ effective_cache_size | 16384
+ random_page_cost | 4
+ seq_page_cost | 1
+ enable_bitmapscan | on
+ enable_hashagg | on
+ enable_hashjoin | on
+ enable_indexscan | on
+ enable_material | on
+ enable_mergejoin | on
+ enable_nestloop | on
+ enable_seqscan | on
+ enable_sort | on
+ enable_tidscan | on
+ client_min_messages | log
+(29 rows)
+
+SET pg_hint_plan.parse_messages TO error;
+/*+Set(enable_seqscan off)Set(geqo_threshold 100)SeqScan(t1)MergeJoin(t1 t2)NestLoop(t1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+ERROR: hint syntax error at or near "NestLoop(t1 t1)"
+DETAIL: Relation name "t1" is duplicated.
+SELECT name, setting FROM settings;
+ name | setting
+---------------------------+-----------
+ geqo | on
+ geqo_effort | 5
+ geqo_generations | 0
+ geqo_pool_size | 0
+ geqo_seed | 0
+ geqo_selection_bias | 2
+ geqo_threshold | 12
+ constraint_exclusion | partition
+ cursor_tuple_fraction | 0.1
+ default_statistics_target | 100
+ from_collapse_limit | 8
+ join_collapse_limit | 8
+ cpu_index_tuple_cost | 0.005
+ cpu_operator_cost | 0.0025
+ cpu_tuple_cost | 0.01
+ effective_cache_size | 16384
+ random_page_cost | 4
+ seq_page_cost | 1
+ enable_bitmapscan | on
+ enable_hashagg | on
+ enable_hashjoin | on
+ enable_indexscan | on
+ enable_material | on
+ enable_mergejoin | on
+ enable_nestloop | on
+ enable_seqscan | on
+ enable_sort | on
+ enable_tidscan | on
+ client_min_messages | log
+(29 rows)
+
+/*+Set(enable_seqscan off)Set(geqo_threshold 100)SeqScan(t1)MergeJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+MergeJoin(t1 t2)
+Set(enable_seqscan off)
+Set(geqo_threshold 100)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Sort
+ Sort Key: t1.c1
+ -> Seq Scan on t1
+ -> Index Scan using t2_i1 on t2
+(6 rows)
+
+-- No. A-12-1-2
+-- No. A-12-2-2
+SELECT name, setting FROM settings;
+ name | setting
+---------------------------+-----------
+ geqo | on
+ geqo_effort | 5
+ geqo_generations | 0
+ geqo_pool_size | 0
+ geqo_seed | 0
+ geqo_selection_bias | 2
+ geqo_threshold | 12
+ constraint_exclusion | partition
+ cursor_tuple_fraction | 0.1
+ default_statistics_target | 100
+ from_collapse_limit | 8
+ join_collapse_limit | 8
+ cpu_index_tuple_cost | 0.005
+ cpu_operator_cost | 0.0025
+ cpu_tuple_cost | 0.01
+ effective_cache_size | 16384
+ random_page_cost | 4
+ seq_page_cost | 1
+ enable_bitmapscan | on
+ enable_hashagg | on
+ enable_hashjoin | on
+ enable_indexscan | on
+ enable_material | on
+ enable_mergejoin | on
+ enable_nestloop | on
+ enable_seqscan | on
+ enable_sort | on
+ enable_tidscan | on
+ client_min_messages | log
+(29 rows)
+
+SET pg_hint_plan.parse_messages TO error;
+/*+Set(enable_seqscan off)Set(geqo_threshold 100)SeqScan(t1)MergeJoin(t1 t2)NestLoop(t1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+ERROR: hint syntax error at or near "NestLoop(t1 t1)"
+DETAIL: Relation name "t1" is duplicated.
+SELECT name, setting FROM settings;
+ name | setting
+---------------------------+-----------
+ geqo | on
+ geqo_effort | 5
+ geqo_generations | 0
+ geqo_pool_size | 0
+ geqo_seed | 0
+ geqo_selection_bias | 2
+ geqo_threshold | 12
+ constraint_exclusion | partition
+ cursor_tuple_fraction | 0.1
+ default_statistics_target | 100
+ from_collapse_limit | 8
+ join_collapse_limit | 8
+ cpu_index_tuple_cost | 0.005
+ cpu_operator_cost | 0.0025
+ cpu_tuple_cost | 0.01
+ effective_cache_size | 16384
+ random_page_cost | 4
+ seq_page_cost | 1
+ enable_bitmapscan | on
+ enable_hashagg | on
+ enable_hashjoin | on
+ enable_indexscan | on
+ enable_material | on
+ enable_mergejoin | on
+ enable_nestloop | on
+ enable_seqscan | on
+ enable_sort | on
+ enable_tidscan | on
+ client_min_messages | log
+(29 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1;
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Sort
+ Sort Key: t1.c1
+ -> Seq Scan on t1
+ -> Index Scan using t2_i1 on t2
+(6 rows)
+
+-- No. A-12-1-3
+-- No. A-12-2-3
+SELECT name, setting FROM settings;
+ name | setting
+---------------------------+-----------
+ geqo | on
+ geqo_effort | 5
+ geqo_generations | 0
+ geqo_pool_size | 0
+ geqo_seed | 0
+ geqo_selection_bias | 2
+ geqo_threshold | 12
+ constraint_exclusion | partition
+ cursor_tuple_fraction | 0.1
+ default_statistics_target | 100
+ from_collapse_limit | 8
+ join_collapse_limit | 8
+ cpu_index_tuple_cost | 0.005
+ cpu_operator_cost | 0.0025
+ cpu_tuple_cost | 0.01
+ effective_cache_size | 16384
+ random_page_cost | 4
+ seq_page_cost | 1
+ enable_bitmapscan | on
+ enable_hashagg | on
+ enable_hashjoin | on
+ enable_indexscan | on
+ enable_material | on
+ enable_mergejoin | on
+ enable_nestloop | on
+ enable_seqscan | on
+ enable_sort | on
+ enable_tidscan | on
+ client_min_messages | log
+(29 rows)
+
+SET pg_hint_plan.parse_messages TO error;
+EXPLAIN (COSTS false) EXECUTE p2;
+ERROR: prepared statement "p2" does not exist
+/*+Set(enable_seqscan off)Set(geqo_threshold 100)SeqScan(t1)MergeJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+MergeJoin(t1 t2)
+Set(enable_seqscan off)
+Set(geqo_threshold 100)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Sort
+ Sort Key: t1.c1
+ -> Seq Scan on t1
+ -> Index Scan using t2_i1 on t2
+(6 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1;
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Sort
+ Sort Key: t1.c1
+ -> Seq Scan on t1
+ -> Index Scan using t2_i1 on t2
+(6 rows)
+
+SELECT name, setting FROM settings;
+ name | setting
+---------------------------+-----------
+ geqo | on
+ geqo_effort | 5
+ geqo_generations | 0
+ geqo_pool_size | 0
+ geqo_seed | 0
+ geqo_selection_bias | 2
+ geqo_threshold | 12
+ constraint_exclusion | partition
+ cursor_tuple_fraction | 0.1
+ default_statistics_target | 100
+ from_collapse_limit | 8
+ join_collapse_limit | 8
+ cpu_index_tuple_cost | 0.005
+ cpu_operator_cost | 0.0025
+ cpu_tuple_cost | 0.01
+ effective_cache_size | 16384
+ random_page_cost | 4
+ seq_page_cost | 1
+ enable_bitmapscan | on
+ enable_hashagg | on
+ enable_hashjoin | on
+ enable_indexscan | on
+ enable_material | on
+ enable_mergejoin | on
+ enable_nestloop | on
+ enable_seqscan | on
+ enable_sort | on
+ enable_tidscan | on
+ client_min_messages | log
+(29 rows)
+
+-- No. A-12-1-4
+-- No. A-12-2-4
+SELECT name, setting FROM settings;
+ name | setting
+---------------------------+-----------
+ geqo | on
+ geqo_effort | 5
+ geqo_generations | 0
+ geqo_pool_size | 0
+ geqo_seed | 0
+ geqo_selection_bias | 2
+ geqo_threshold | 12
+ constraint_exclusion | partition
+ cursor_tuple_fraction | 0.1
+ default_statistics_target | 100
+ from_collapse_limit | 8
+ join_collapse_limit | 8
+ cpu_index_tuple_cost | 0.005
+ cpu_operator_cost | 0.0025
+ cpu_tuple_cost | 0.01
+ effective_cache_size | 16384
+ random_page_cost | 4
+ seq_page_cost | 1
+ enable_bitmapscan | on
+ enable_hashagg | on
+ enable_hashjoin | on
+ enable_indexscan | on
+ enable_material | on
+ enable_mergejoin | on
+ enable_nestloop | on
+ enable_seqscan | on
+ enable_sort | on
+ enable_tidscan | on
+ client_min_messages | log
+(29 rows)
+
+SET pg_hint_plan.parse_messages TO error;
+EXPLAIN (COSTS false) EXECUTE p2;
+ERROR: prepared statement "p2" does not exist
+EXPLAIN (COSTS false) EXECUTE p1;
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Sort
+ Sort Key: t1.c1
+ -> Seq Scan on t1
+ -> Index Scan using t2_i1 on t2
+(6 rows)
+
+SELECT name, setting FROM settings;
+ name | setting
+---------------------------+-----------
+ geqo | on
+ geqo_effort | 5
+ geqo_generations | 0
+ geqo_pool_size | 0
+ geqo_seed | 0
+ geqo_selection_bias | 2
+ geqo_threshold | 12
+ constraint_exclusion | partition
+ cursor_tuple_fraction | 0.1
+ default_statistics_target | 100
+ from_collapse_limit | 8
+ join_collapse_limit | 8
+ cpu_index_tuple_cost | 0.005
+ cpu_operator_cost | 0.0025
+ cpu_tuple_cost | 0.01
+ effective_cache_size | 16384
+ random_page_cost | 4
+ seq_page_cost | 1
+ enable_bitmapscan | on
+ enable_hashagg | on
+ enable_hashjoin | on
+ enable_indexscan | on
+ enable_material | on
+ enable_mergejoin | on
+ enable_nestloop | on
+ enable_seqscan | on
+ enable_sort | on
+ enable_tidscan | on
+ client_min_messages | log
+(29 rows)
+
+DEALLOCATE p1;
+SET pg_hint_plan.parse_messages TO LOG;
+----
+---- No. A-12-3 effective range of the hint
+----
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(6 rows)
+
+-- No. A-12-3-1
+SET enable_indexscan TO off;
+SET enable_mergejoin TO off;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+SELECT name, setting FROM settings;
+ name | setting
+---------------------------+-----------
+ geqo | on
+ geqo_effort | 5
+ geqo_generations | 0
+ geqo_pool_size | 0
+ geqo_seed | 0
+ geqo_selection_bias | 2
+ geqo_threshold | 12
+ constraint_exclusion | partition
+ cursor_tuple_fraction | 0.1
+ default_statistics_target | 100
+ from_collapse_limit | 8
+ join_collapse_limit | 8
+ cpu_index_tuple_cost | 0.005
+ cpu_operator_cost | 0.0025
+ cpu_tuple_cost | 0.01
+ effective_cache_size | 16384
+ random_page_cost | 4
+ seq_page_cost | 1
+ enable_bitmapscan | on
+ enable_hashagg | on
+ enable_hashjoin | on
+ enable_indexscan | off
+ enable_material | on
+ enable_mergejoin | off
+ enable_nestloop | on
+ enable_seqscan | on
+ enable_sort | on
+ enable_tidscan | on
+ client_min_messages | log
+(29 rows)
+
+/*+Set(enable_indexscan on)Set(geqo_threshold 100)IndexScan(t2)MergeJoin(t1 t2)Leading(t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+IndexScan(t2)
+MergeJoin(t1 t2)
+Leading(t2 t1)
+Set(enable_indexscan on)
+Set(geqo_threshold 100)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t2_i1 on t2
+(4 rows)
+
+SELECT name, setting FROM settings;
+ name | setting
+---------------------------+-----------
+ geqo | on
+ geqo_effort | 5
+ geqo_generations | 0
+ geqo_pool_size | 0
+ geqo_seed | 0
+ geqo_selection_bias | 2
+ geqo_threshold | 12
+ constraint_exclusion | partition
+ cursor_tuple_fraction | 0.1
+ default_statistics_target | 100
+ from_collapse_limit | 8
+ join_collapse_limit | 8
+ cpu_index_tuple_cost | 0.005
+ cpu_operator_cost | 0.0025
+ cpu_tuple_cost | 0.01
+ effective_cache_size | 16384
+ random_page_cost | 4
+ seq_page_cost | 1
+ enable_bitmapscan | on
+ enable_hashagg | on
+ enable_hashjoin | on
+ enable_indexscan | off
+ enable_material | on
+ enable_mergejoin | off
+ enable_nestloop | on
+ enable_seqscan | on
+ enable_sort | on
+ enable_tidscan | on
+ client_min_messages | log
+(29 rows)
+
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+-- No. A-12-3-2
+SET enable_indexscan TO off;
+SET enable_mergejoin TO off;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+SELECT name, setting FROM settings;
+ name | setting
+---------------------------+-----------
+ geqo | on
+ geqo_effort | 5
+ geqo_generations | 0
+ geqo_pool_size | 0
+ geqo_seed | 0
+ geqo_selection_bias | 2
+ geqo_threshold | 12
+ constraint_exclusion | partition
+ cursor_tuple_fraction | 0.1
+ default_statistics_target | 100
+ from_collapse_limit | 8
+ join_collapse_limit | 8
+ cpu_index_tuple_cost | 0.005
+ cpu_operator_cost | 0.0025
+ cpu_tuple_cost | 0.01
+ effective_cache_size | 16384
+ random_page_cost | 4
+ seq_page_cost | 1
+ enable_bitmapscan | on
+ enable_hashagg | on
+ enable_hashjoin | on
+ enable_indexscan | off
+ enable_material | on
+ enable_mergejoin | off
+ enable_nestloop | on
+ enable_seqscan | on
+ enable_sort | on
+ enable_tidscan | on
+ client_min_messages | log
+(29 rows)
+
+BEGIN;
+/*+Set(enable_indexscan on)Set(geqo_threshold 100)IndexScan(t2)MergeJoin(t1 t2)Leading(t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+IndexScan(t2)
+MergeJoin(t1 t2)
+Leading(t2 t1)
+Set(enable_indexscan on)
+Set(geqo_threshold 100)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t2_i1 on t2
+(4 rows)
+
+COMMIT;
+BEGIN;
+SELECT name, setting FROM settings;
+ name | setting
+---------------------------+-----------
+ geqo | on
+ geqo_effort | 5
+ geqo_generations | 0
+ geqo_pool_size | 0
+ geqo_seed | 0
+ geqo_selection_bias | 2
+ geqo_threshold | 12
+ constraint_exclusion | partition
+ cursor_tuple_fraction | 0.1
+ default_statistics_target | 100
+ from_collapse_limit | 8
+ join_collapse_limit | 8
+ cpu_index_tuple_cost | 0.005
+ cpu_operator_cost | 0.0025
+ cpu_tuple_cost | 0.01
+ effective_cache_size | 16384
+ random_page_cost | 4
+ seq_page_cost | 1
+ enable_bitmapscan | on
+ enable_hashagg | on
+ enable_hashjoin | on
+ enable_indexscan | off
+ enable_material | on
+ enable_mergejoin | off
+ enable_nestloop | on
+ enable_seqscan | on
+ enable_sort | on
+ enable_tidscan | on
+ client_min_messages | log
+(29 rows)
+
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+COMMIT;
+-- No. A-12-3-3
+SET enable_indexscan TO off;
+SET enable_mergejoin TO off;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+SELECT name, setting FROM settings;
+ name | setting
+---------------------------+-----------
+ geqo | on
+ geqo_effort | 5
+ geqo_generations | 0
+ geqo_pool_size | 0
+ geqo_seed | 0
+ geqo_selection_bias | 2
+ geqo_threshold | 12
+ constraint_exclusion | partition
+ cursor_tuple_fraction | 0.1
+ default_statistics_target | 100
+ from_collapse_limit | 8
+ join_collapse_limit | 8
+ cpu_index_tuple_cost | 0.005
+ cpu_operator_cost | 0.0025
+ cpu_tuple_cost | 0.01
+ effective_cache_size | 16384
+ random_page_cost | 4
+ seq_page_cost | 1
+ enable_bitmapscan | on
+ enable_hashagg | on
+ enable_hashjoin | on
+ enable_indexscan | off
+ enable_material | on
+ enable_mergejoin | off
+ enable_nestloop | on
+ enable_seqscan | on
+ enable_sort | on
+ enable_tidscan | on
+ client_min_messages | log
+(29 rows)
+
+/*+Set(enable_indexscan on)Set(geqo_threshold 100)IndexScan(t2)MergeJoin(t1 t2)Leading(t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+IndexScan(t2)
+MergeJoin(t1 t2)
+Leading(t2 t1)
+Set(enable_indexscan on)
+Set(geqo_threshold 100)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t2_i1 on t2
+(4 rows)
+
+\connect
+SET enable_indexscan TO off;
+SET enable_mergejoin TO off;
+LOAD 'pg_hint_plan';
+SELECT name, setting FROM settings;
+ name | setting
+---------------------------+-----------
+ geqo | on
+ geqo_effort | 5
+ geqo_generations | 0
+ geqo_pool_size | 0
+ geqo_seed | 0
+ geqo_selection_bias | 2
+ geqo_threshold | 12
+ constraint_exclusion | partition
+ cursor_tuple_fraction | 0.1
+ default_statistics_target | 100
+ from_collapse_limit | 8
+ join_collapse_limit | 8
+ cpu_index_tuple_cost | 0.005
+ cpu_operator_cost | 0.0025
+ cpu_tuple_cost | 0.01
+ effective_cache_size | 16384
+ random_page_cost | 4
+ seq_page_cost | 1
+ enable_bitmapscan | on
+ enable_hashagg | on
+ enable_hashjoin | on
+ enable_indexscan | off
+ enable_material | on
+ enable_mergejoin | off
+ enable_nestloop | on
+ enable_seqscan | on
+ enable_sort | on
+ enable_tidscan | on
+ client_min_messages | notice
+(29 rows)
+
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+SET pg_hint_plan.enable_hint TO on;
+SET pg_hint_plan.debug_print TO on;
+SET client_min_messages TO LOG;
+SET search_path TO public;
+RESET enable_indexscan;
+RESET enable_mergejoin;
+----
+---- No. A-13 call planner recursively
+----
+CREATE OR REPLACE FUNCTION nested_planner(cnt int) RETURNS int AS $$
+DECLARE
+ new_cnt int;
+BEGIN
+ RAISE NOTICE 'nested_planner(%)', cnt;
+
+ /* 再帰終了の判断 */
+ IF cnt <= 1 THEN
+ RETURN 0;
+ END IF;
+
+ EXECUTE '/*+ IndexScan(t_1) */'
+ ' SELECT nested_planner($1) FROM s1.t1 t_1'
+ ' JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)'
+ ' ORDER BY t_1.c1 LIMIT 1'
+ INTO new_cnt USING cnt - 1;
+
+ RETURN new_cnt;
+END;
+$$ LANGUAGE plpgsql IMMUTABLE;
+----
+---- No. A-13-2 use hint of main query
+----
+--No.13-2-1
+EXPLAIN (COSTS false) SELECT nested_planner(1) FROM s1.t1 t_1 ORDER BY t_1.c1;
+NOTICE: nested_planner(1)
+ QUERY PLAN
+----------------------------------
+ Index Scan using t1_i1 on t1 t_1
+(1 row)
+
+/*+SeqScan(t_1)*/
+EXPLAIN (COSTS false) SELECT nested_planner(1) FROM s1.t1 t_1 ORDER BY t_1.c1;
+NOTICE: nested_planner(1)
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t_1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------
+ Sort
+ Sort Key: c1
+ -> Seq Scan on t1 t_1
+(3 rows)
+
+----
+---- No. A-13-3 output number of times of debugging log
+----
+--No.13-3-1
+EXPLAIN (COSTS false) SELECT nested_planner(1) FROM s1.t1 t_1 ORDER BY t_1.c1;
+NOTICE: nested_planner(1)
+ QUERY PLAN
+----------------------------------
+ Index Scan using t1_i1 on t1 t_1
+(1 row)
+
+/*+SeqScan(t_2)*/
+EXPLAIN (COSTS false) SELECT nested_planner(1) FROM s1.t1 t_1 ORDER BY t_1.c1;
+NOTICE: nested_planner(1)
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+SeqScan(t_2)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Index Scan using t1_i1 on t1 t_1
+(1 row)
+
+--No.13-3-2
+EXPLAIN (COSTS false) SELECT nested_planner(2) FROM s1.t1 t_1 ORDER BY t_1.c1;
+NOTICE: nested_planner(2)
+NOTICE: nested_planner(1)
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+ QUERY PLAN
+----------------------------------
+ Index Scan using t1_i1 on t1 t_1
+(1 row)
+
+/*+SeqScan(t_2)*/
+EXPLAIN (COSTS false) SELECT nested_planner(2) FROM s1.t1 t_1 ORDER BY t_1.c1;
+NOTICE: nested_planner(2)
+NOTICE: nested_planner(1)
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t_2)
+not used hint:
+duplication hint:
+error hint:
+
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+SeqScan(t_2)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Index Scan using t1_i1 on t1 t_1
+(1 row)
+
+--No.13-3-3
+EXPLAIN (COSTS false) SELECT nested_planner(5) FROM s1.t1 t_1 ORDER BY t_1.c1;
+NOTICE: nested_planner(5)
+NOTICE: nested_planner(4)
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+NOTICE: nested_planner(3)
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+NOTICE: nested_planner(2)
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+NOTICE: nested_planner(1)
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+ QUERY PLAN
+----------------------------------
+ Index Scan using t1_i1 on t1 t_1
+(1 row)
+
+/*+SeqScan(t_2)*/
+EXPLAIN (COSTS false) SELECT nested_planner(5) FROM s1.t1 t_1 ORDER BY t_1.c1;
+NOTICE: nested_planner(5)
+NOTICE: nested_planner(4)
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+NOTICE: nested_planner(3)
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+NOTICE: nested_planner(2)
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+NOTICE: nested_planner(1)
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t_2)
+not used hint:
+duplication hint:
+error hint:
+
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t_2)
+not used hint:
+duplication hint:
+error hint:
+
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t_2)
+not used hint:
+duplication hint:
+error hint:
+
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t_2)
+not used hint:
+duplication hint:
+error hint:
+
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+SeqScan(t_2)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Index Scan using t1_i1 on t1 t_1
+(1 row)
+
+----
+---- No. A-13-4 output of debugging log on hint status
+----
+--No.13-4-1
+/*+HashJoin(t_1 t_2)*/
+EXPLAIN (COSTS false)
+ SELECT nested_planner(2) FROM s1.t1 t_1
+ JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+ ORDER BY t_1.c1;
+NOTICE: nested_planner(2)
+NOTICE: nested_planner(1)
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t_1 t_2)
+not used hint:
+duplication hint:
+error hint:
+
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t_1 t_2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------
+ Sort
+ Sort Key: t_1.c1
+ -> Hash Join
+ Hash Cond: (t_1.c1 = t_2.c1)
+ -> Seq Scan on t1 t_1
+ -> Hash
+ -> Seq Scan on t2 t_2
+(7 rows)
+
+--No.13-4-2
+/*+HashJoin(st_1 st_2)*/
+EXPLAIN (COSTS false)
+ SELECT nested_planner(2) FROM s1.t1 st_1
+ JOIN s1.t2 st_2 ON (st_1.c1 = st_2.c1)
+ ORDER BY st_1.c1;
+NOTICE: nested_planner(2)
+NOTICE: nested_planner(1)
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+HashJoin(st_1 st_2)
+duplication hint:
+error hint:
+
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+HashJoin(st_1 st_2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------
+ Sort
+ Sort Key: st_1.c1
+ -> Hash Join
+ Hash Cond: (st_1.c1 = st_2.c1)
+ -> Seq Scan on t1 st_1
+ -> Hash
+ -> Seq Scan on t2 st_2
+(7 rows)
+
+--No.13-4-3
+/*+HashJoin(t_1 t_2)*/
+EXPLAIN (COSTS false)
+ SELECT nested_planner(2) FROM s1.t1 st_1
+ JOIN s1.t2 st_2 ON (st_1.c1 = st_2.c1)
+ ORDER BY st_1.c1;
+NOTICE: nested_planner(2)
+NOTICE: nested_planner(1)
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t_1 t_2)
+not used hint:
+duplication hint:
+error hint:
+
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+HashJoin(t_1 t_2)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Merge Join
+ Merge Cond: (st_1.c1 = st_2.c1)
+ -> Index Scan using t1_i1 on t1 st_1
+ -> Sort
+ Sort Key: st_2.c1
+ -> Seq Scan on t2 st_2
+(6 rows)
+
+--No.13-4-4
+/*+HashJoin(st_1 st_2)*/
+EXPLAIN (COSTS false)
+ SELECT nested_planner(2) FROM s1.t1 t_1
+ JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+ ORDER BY t_1.c1;
+NOTICE: nested_planner(2)
+NOTICE: nested_planner(1)
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+HashJoin(st_1 st_2)
+duplication hint:
+error hint:
+
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+HashJoin(st_1 st_2)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------
+ Merge Join
+ Merge Cond: (t_1.c1 = t_2.c1)
+ -> Index Scan using t1_i1 on t1 t_1
+ -> Sort
+ Sort Key: t_2.c1
+ -> Seq Scan on t2 t_2
+(6 rows)
+
+--No.13-4-5
+/*+HashJoin(t_1 t_1)*/
+EXPLAIN (COSTS false)
+ SELECT nested_planner(2) FROM s1.t1 t_1
+ ORDER BY t_1.c1;
+NOTICE: nested_planner(2)
+NOTICE: nested_planner(1)
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+INFO: hint syntax error at or near "HashJoin(t_1 t_1)"
+DETAIL: Relation name "t_1" is duplicated.
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+HashJoin(t_1 t_1)
+
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+HashJoin(t_1 t_1)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Index Scan using t1_i1 on t1 t_1
+(1 row)
+
+--No.13-4-6
+CREATE OR REPLACE FUNCTION nested_planner_one_t(cnt int) RETURNS int AS $$
+DECLARE
+ new_cnt int;
+BEGIN
+ RAISE NOTICE 'nested_planner_one_t(%)', cnt;
+
+ IF cnt <= 1 THEN
+ RETURN 0;
+ END IF;
+
+ EXECUTE '/*+ IndexScan(t_1) */'
+ ' SELECT nested_planner_one_t($1) FROM s1.t1 t_1'
+ ' ORDER BY t_1.c1 LIMIT 1'
+ INTO new_cnt USING cnt - 1;
+
+ RETURN new_cnt;
+END;
+$$ LANGUAGE plpgsql IMMUTABLE;
+EXPLAIN (COSTS false)
+ SELECT nested_planner_one_t(2) FROM s1.t1 t_1
+ JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+ ORDER BY t_1.c1;
+NOTICE: nested_planner_one_t(2)
+NOTICE: nested_planner_one_t(1)
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner_one_t($1) FROM s1.t1 t_1 ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner_one_t" line 11 at EXECUTE statement
+ QUERY PLAN
+----------------------------------------
+ Merge Join
+ Merge Cond: (t_1.c1 = t_2.c1)
+ -> Index Scan using t1_i1 on t1 t_1
+ -> Sort
+ Sort Key: t_2.c1
+ -> Seq Scan on t2 t_2
+(6 rows)
+
+/*+HashJoin(t_1 t_1)*/
+EXPLAIN (COSTS false)
+ SELECT nested_planner_one_t(2) FROM s1.t1 t_1
+ JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+ ORDER BY t_1.c1;
+NOTICE: nested_planner_one_t(2)
+NOTICE: nested_planner_one_t(1)
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner_one_t($1) FROM s1.t1 t_1 ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner_one_t" line 11 at EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+HashJoin(t_1 t_1)
+duplication hint:
+error hint:
+
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner_one_t($1) FROM s1.t1 t_1 ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner_one_t" line 11 at EXECUTE statement
+INFO: hint syntax error at or near "HashJoin(t_1 t_1)"
+DETAIL: Relation name "t_1" is duplicated.
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+HashJoin(t_1 t_1)
+
+ QUERY PLAN
+----------------------------------------
+ Merge Join
+ Merge Cond: (t_1.c1 = t_2.c1)
+ -> Index Scan using t1_i1 on t1 t_1
+ -> Sort
+ Sort Key: t_2.c1
+ -> Seq Scan on t2 t_2
+(6 rows)
+
+DROP FUNCTION nested_planner_one_t(int);
+--No.13-4-7
+/*+HashJoin(t_1 t_1)*/
+EXPLAIN (COSTS false)
+ SELECT nested_planner(2) FROM s1.t1 t_1
+ JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+ ORDER BY t_1.c1;
+NOTICE: nested_planner(2)
+NOTICE: nested_planner(1)
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+INFO: hint syntax error at or near "HashJoin(t_1 t_1)"
+DETAIL: Relation name "t_1" is duplicated.
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+HashJoin(t_1 t_1)
+
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+INFO: hint syntax error at or near "HashJoin(t_1 t_1)"
+DETAIL: Relation name "t_1" is duplicated.
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+HashJoin(t_1 t_1)
+
+ QUERY PLAN
+----------------------------------------
+ Merge Join
+ Merge Cond: (t_1.c1 = t_2.c1)
+ -> Index Scan using t1_i1 on t1 t_1
+ -> Sort
+ Sort Key: t_2.c1
+ -> Seq Scan on t2 t_2
+(6 rows)
+
+--No.13-4-8
+/*+MergeJoin(t_1 t_2)HashJoin(t_1 t_2)*/
+EXPLAIN (COSTS false)
+ SELECT nested_planner(2) FROM s1.t1 t_1
+ JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+ ORDER BY t_1.c1;
+INFO: hint syntax error at or near "MergeJoin(t_1 t_2)HashJoin(t_1 t_2)"
+DETAIL: Conflict join method hint.
+NOTICE: nested_planner(2)
+INFO: hint syntax error at or near "MergeJoin(t_1 t_2)HashJoin(t_1 t_2)"
+DETAIL: Conflict join method hint.
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+NOTICE: nested_planner(1)
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t_1 t_2)
+not used hint:
+duplication hint:
+MergeJoin(t_1 t_2)
+error hint:
+
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner" line 12 at EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t_1 t_2)
+not used hint:
+duplication hint:
+MergeJoin(t_1 t_2)
+error hint:
+
+ QUERY PLAN
+--------------------------------------
+ Sort
+ Sort Key: t_1.c1
+ -> Hash Join
+ Hash Cond: (t_1.c1 = t_2.c1)
+ -> Seq Scan on t1 t_1
+ -> Hash
+ -> Seq Scan on t2 t_2
+(7 rows)
+
--- /dev/null
+LOAD 'pg_hint_plan';
+SET pg_hint_plan.enable_hint TO on;
+SET pg_hint_plan.debug_print TO on;
+SET client_min_messages TO LOG;
+SET search_path TO public;
+----
+---- No. A-5-1 hint format
+----
+-- No. A-5-1-1
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-1-2
+/* +SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. A-5-1-3
+--+SeqScan(t1)
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. A-5-1-4
+--+SeqScan(t1)
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. A-5-1-5
+-- +SeqScan(t1)
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. A-5-1-6
+--SeqScan(t1)
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. A-5-1-7
+/*+SeqScan(t1) /* nest comment */ */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+INFO: hint syntax error at or near "/* nest comment */ */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;"
+DETAIL: Nested block comments are not supported.
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. A-5-1-8
+/* +SeqScan(t1) /* nest comment */ */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. A-5-1-9
+/*SeqScan(t1) /* nest comment */ */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+----
+---- No. A-5-2 hint position
+----
+-- No. A-5-2-1
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-2-2
+/* normal comment */
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. A-5-2-3
+EXPLAIN (COSTS false) SELECT /*+SeqScan(t1)*/ * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+----
+---- No. A-5-4 hint delimiter
+----
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-1
+-- No. A-5-4-2
+-- No. A-5-4-3
+-- No. A-5-4-4
+-- No. A-5-4-5
+-- No. A-5-4-6
+-- No. A-5-4-7
+/*+Set(enable_indexscan"off")Set(enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-8
+/*+ Set(enable_indexscan"off")Set(enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-9
+/*+Set(enable_indexscan"off")Set(enable_bitmapscan"off") */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-10
+/*+ Set (enable_indexscan"off") Set (enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-11
+/*+Set ( enable_indexscan"off")Set ( enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-12
+/*+Set(enable_indexscan"off" ) Set(enable_bitmapscan"off" ) */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-13
+/*+Set( enable_indexscan "off" )Set( enable_bitmapscan "off" )*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-14
+/*+ Set ( enable_indexscan "off" ) Set ( enable_bitmapscan "off" ) */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-15
+/*+ Set(enable_indexscan"off")Set(enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-16
+/*+Set(enable_indexscan"off")Set(enable_bitmapscan"off") */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-17
+/*+ Set (enable_indexscan"off") Set (enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-18
+/*+Set ( enable_indexscan"off")Set ( enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-19
+/*+Set(enable_indexscan"off" ) Set(enable_bitmapscan"off" ) */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-20
+/*+Set( enable_indexscan "off" )Set( enable_bitmapscan "off" )*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-21
+/*+ Set ( enable_indexscan "off" ) Set ( enable_bitmapscan "off" ) */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-22
+/*+
+Set(enable_indexscan"off")Set(enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-23
+/*+Set(enable_indexscan"off")Set(enable_bitmapscan"off")
+*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-24
+/*+
+Set
+(enable_indexscan"off")
+Set
+(enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-25
+/*+Set
+(
+enable_indexscan"off")Set
+(
+enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-26
+/*+Set(enable_indexscan"off"
+)
+Set(enable_bitmapscan"off"
+)
+*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-27
+/*+Set(
+enable_indexscan
+"off"
+)Set(
+enable_bitmapscan
+"off"
+)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-28
+/*+
+Set
+(
+enable_indexscan
+"off"
+)
+Set
+(
+enable_bitmapscan
+"off"
+)
+*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-29
+/*+
+ Set(enable_indexscan"off")Set(enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-30
+/*+Set(enable_indexscan"off")Set(enable_bitmapscan"off")
+ */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-31
+/*+
+ Set
+ (enable_indexscan"off")
+ Set
+ (enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-32
+/*+Set
+ (
+ enable_indexscan"off")Set
+ (
+ enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-33
+/*+Set(enable_indexscan"off"
+ )
+ Set(enable_bitmapscan"off"
+ )
+ */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-34
+/*+Set(
+ enable_indexscan
+ "off"
+ )Set(
+ enable_bitmapscan
+ "off"
+ )*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-4-35
+/*+
+ Set
+ (
+ enable_indexscan
+ "off"
+ )
+ Set
+ (
+ enable_bitmapscan
+ "off"
+ )
+ */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+----
+---- No. A-5-5 hint object pattern
+---- No. A-7-2 message object pattern
+----
+-- No. A-5-5-1
+-- No. A-7-2-1
+/*+SeqScan(t)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 t WHERE t.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1 t
+ Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan(ttt)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 ttt WHERE ttt.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(ttt)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1 ttt
+ Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan("t")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 t WHERE t.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1 t
+ Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan("ttt")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 ttt WHERE ttt.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(ttt)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1 ttt
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-5-2
+-- No. A-7-2-2
+/*+SeqScan(T)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "T" WHERE "T".c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(T)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1 "T"
+ Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan(TTT)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "TTT" WHERE "TTT".c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(TTT)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------
+ Seq Scan on t1 "TTT"
+ Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan("T")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "T" WHERE "T".c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(T)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1 "T"
+ Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan("TTT")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "TTT" WHERE "TTT".c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(TTT)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------
+ Seq Scan on t1 "TTT"
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-5-3
+-- No. A-7-2-3
+/*+SeqScan(()*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "(" WHERE "(".c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(()
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1 "("
+ Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan(((()*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "(((" WHERE "(((".c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(((()
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------
+ Seq Scan on t1 "((("
+ Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan("(")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "(" WHERE "(".c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(()
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1 "("
+ Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan("(((")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "(((" WHERE "(((".c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(((()
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------
+ Seq Scan on t1 "((("
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-5-4
+-- No. A-7-2-4
+/*+SeqScan())*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 ")" WHERE ")".c1 = 1;
+INFO: hint syntax error at or near "))"
+DETAIL: Relation name is necessary.
+ QUERY PLAN
+----------------------------------
+ Index Scan using t1_i1 on t1 ")"
+ Index Cond: (c1 = 1)
+(2 rows)
+
+/*+SeqScan(")")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 ")" WHERE ")".c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(")")
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1 ")"
+ Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan(")))")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 ")))" WHERE ")))".c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(")))")
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------
+ Seq Scan on t1 ")))"
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-5-5
+-- No. A-7-2-5
+/*+SeqScan(")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 """" WHERE """".c1 = 1;
+INFO: hint syntax error at or near ""
+DETAIL: Unterminated quoted relation name.
+ QUERY PLAN
+-----------------------------------
+ Index Scan using t1_i1 on t1 """"
+ Index Cond: (c1 = 1)
+(2 rows)
+
+/*+SeqScan("""")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 """" WHERE """".c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan("""")
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------
+ Seq Scan on t1 """"
+ Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan("""""""")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 """""""" WHERE """""""".c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan("""""""")
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------
+ Seq Scan on t1 """"""""
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-5-6
+-- No. A-7-2-6
+/*+SeqScan( )*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 " " WHERE " ".c1 = 1;
+INFO: hint syntax error at or near ")"
+DETAIL: Relation name is necessary.
+ QUERY PLAN
+----------------------------------
+ Index Scan using t1_i1 on t1 " "
+ Index Cond: (c1 = 1)
+(2 rows)
+
+/*+SeqScan(" ")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 " " WHERE " ".c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(" ")
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1 " "
+ Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan(" ")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 " " WHERE " ".c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(" ")
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------
+ Seq Scan on t1 " "
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-5-7
+-- No. A-7-2-7
+/*+SeqScan( )*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 " " WHERE " ".c1 = 1;
+INFO: hint syntax error at or near ")"
+DETAIL: Relation name is necessary.
+ QUERY PLAN
+-----------------------------------
+ Index Scan using t1_i1 on t1 " "
+ Index Cond: (c1 = 1)
+(2 rows)
+
+/*+SeqScan(" ")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 " " WHERE " ".c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(" ")
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------
+ Seq Scan on t1 " "
+ Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan(" ")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 " " WHERE " ".c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(" ")
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------
+ Seq Scan on t1 " "
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-5-8
+-- No. A-7-2-8
+/*+SeqScan(
+)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "
+" WHERE "
+".c1 = 1;
+INFO: hint syntax error at or near ")"
+DETAIL: Relation name is necessary.
+ QUERY PLAN
+--------------------------------
+ Index Scan using t1_i1 on t1 "
+ "
+ Index Cond: (c1 = 1)
+(3 rows)
+
+/*+SeqScan("
+")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "
+" WHERE "
+".c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan("
+")
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1 "
+ "
+ Filter: (c1 = 1)
+(3 rows)
+
+/*+SeqScan("
+
+
+")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "
+
+
+" WHERE "
+
+
+".c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan("
+
+
+")
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1 "
+
+
+ "
+ Filter: (c1 = 1)
+(5 rows)
+
+-- No. A-5-5-9
+-- No. A-7-2-9
+/*+SeqScan(Set)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "Set" WHERE "Set".c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(Set)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------
+ Seq Scan on t1 "Set"
+ Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan("Set")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "Set" WHERE "Set".c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(Set)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------
+ Seq Scan on t1 "Set"
+ Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan("Set SeqScan Leading")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "Set SeqScan Leading" WHERE "Set SeqScan Leading".c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan("Set SeqScan Leading")
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------
+ Seq Scan on t1 "Set SeqScan Leading"
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-5-10
+-- No. A-7-2-10
+/*+SeqScan(あ)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 あ WHERE あ.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(あ)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------
+ Seq Scan on t1 "あ"
+ Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan(あいう)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 あいう WHERE あいう.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(あいう)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------
+ Seq Scan on t1 "あいう"
+ Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan("あ")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 あ WHERE あ.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(あ)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------
+ Seq Scan on t1 "あ"
+ Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan("あいう")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 あいう WHERE あいう.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(あいう)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------
+ Seq Scan on t1 "あいう"
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-5-11
+-- No. A-7-2-11
+/*+SeqScan(/**/)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "/**/" WHERE "/**/".c1 = 1;
+INFO: hint syntax error at or near "/**/)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "/**/" WHERE "/**/".c1 = 1;"
+DETAIL: Nested block comments are not supported.
+ QUERY PLAN
+-------------------------------------
+ Index Scan using t1_i1 on t1 "/**/"
+ Index Cond: (c1 = 1)
+(2 rows)
+
+/*+SeqScan(/**//**//**/)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "/**//**//**/" WHERE "/**//**//**/".c1 = 1;
+INFO: hint syntax error at or near "/**//**//**/)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "/**//**//**/" WHERE "/**//**//**/".c1 = 1;"
+DETAIL: Nested block comments are not supported.
+ QUERY PLAN
+---------------------------------------------
+ Index Scan using t1_i1 on t1 "/**//**//**/"
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. A-5-5-12
+-- No. A-7-2-12
+/*+SeqScan("tT()""
+Set/**/あ")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "tT()""
+Set/**/あ" WHERE "tT()""
+Set/**/あ".c1 = 1;
+INFO: hint syntax error at or near "/**/あ")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "tT()""
+Set/**/あ" WHERE "tT()""
+Set/**/あ".c1 = 1;"
+DETAIL: Nested block comments are not supported.
+ QUERY PLAN
+------------------------------------------
+ Index Scan using t1_i1 on t1 "tT()""
+ Set/**/あ"
+ Index Cond: (c1 = 1)
+(3 rows)
+
+--"
+/*+SeqScan("tT()""
+Setあ")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "tT()""
+Setあ" WHERE "tT()""
+Setあ".c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan("tT()""
+Setあ")
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------
+ Seq Scan on t1 "tT()""
+ Setあ"
+ Filter: (c1 = 1)
+(3 rows)
+
+----
+---- No. A-5-6 hint parse error
+----
+-- No. A-5-6-1
+/*+Set(enable_indexscan off)Set enable_tidscan off)Set(enable_bitmapscan off)SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+INFO: hint syntax error at or near "enable_tidscan off)Set(enable_bitmapscan off)SeqScan(t1)"
+DETAIL: Opening parenthesis is necessary.
+LOG: pg_hint_plan:
+used hint:
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 = 1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 = 1)
+(4 rows)
+
+-- No. A-5-6-2
+/*+Set(enable_indexscan off)Set(enable_tidscan off Set(enable_bitmapscan off)SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+INFO: hint syntax error at or near "Set(enable_bitmapscan off)SeqScan(t1)"
+DETAIL: Closing parenthesis is necessary.
+LOG: pg_hint_plan:
+used hint:
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 = 1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 = 1)
+(4 rows)
+
+-- No. A-5-6-3
+/*+Set(enable_indexscan off)Set(enable_tidscan "off)Set(enable_bitmapscan off)SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+INFO: hint syntax error at or near ""
+DETAIL: Unterminated quoted parameter value.
+LOG: pg_hint_plan:
+used hint:
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 = 1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 = 1)
+(4 rows)
+
+-- No. A-5-6-4
+/*+Set(enable_indexscan off)SeqScan("")Set(enable_bitmapscan off)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+INFO: hint syntax error at or near ")Set(enable_bitmapscan off)"
+DETAIL: Relation name is necessary.
+LOG: pg_hint_plan:
+used hint:
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 = 1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 = 1)
+(4 rows)
+
+-- No. A-5-6-5
+/*+Set(enable_indexscan off)NoSet(enable_tidscan off)Set(enable_bitmapscan off)SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+INFO: hint syntax error at or near "NoSet(enable_tidscan off)Set(enable_bitmapscan off)SeqScan(t1)"
+DETAIL: Unrecognized hint keyword "NoSet".
+LOG: pg_hint_plan:
+used hint:
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 = 1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 = 1)
+(4 rows)
+
+-- No. A-5-6-6
+/*+Set(enable_indexscan off)"Set"(enable_tidscan off)Set(enable_bitmapscan off)SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+INFO: hint syntax error at or near ""Set"(enable_tidscan off)Set(enable_bitmapscan off)SeqScan(t1)"
+DETAIL: Unrecognized hint keyword ""Set"".
+LOG: pg_hint_plan:
+used hint:
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 = 1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 = 1)
+(4 rows)
+
+-- No. A-5-6-7
+/*+Set(enable_indexscan off)Set(enable_tidscan /* value */off)Set(enable_bitmapscan off)SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+INFO: hint syntax error at or near "/* value */off)Set(enable_bitmapscan off)SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;"
+DETAIL: Nested block comments are not supported.
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+----
+---- No. A-6-1 original GUC parameter
+----
+-- No. A-6-1-1
+SET ROLE super_user;
+SET pg_hint_plan.debug_print TO off;
+SHOW pg_hint_plan.enable_hint;
+ pg_hint_plan.enable_hint
+--------------------------
+ on
+(1 row)
+
+SHOW pg_hint_plan.debug_print;
+ pg_hint_plan.debug_print
+--------------------------
+ off
+(1 row)
+
+SHOW pg_hint_plan.parse_messages;
+ pg_hint_plan.parse_messages
+-----------------------------
+ info
+(1 row)
+
+SET pg_hint_plan.enable_hint TO off;
+SET pg_hint_plan.debug_print TO on;
+SET pg_hint_plan.parse_messages TO error;
+SHOW pg_hint_plan.enable_hint;
+ pg_hint_plan.enable_hint
+--------------------------
+ off
+(1 row)
+
+SHOW pg_hint_plan.debug_print;
+ pg_hint_plan.debug_print
+--------------------------
+ on
+(1 row)
+
+SHOW pg_hint_plan.parse_messages;
+ pg_hint_plan.parse_messages
+-----------------------------
+ error
+(1 row)
+
+RESET pg_hint_plan.enable_hint;
+RESET pg_hint_plan.debug_print;
+RESET pg_hint_plan.parse_messages;
+SHOW pg_hint_plan.enable_hint;
+ pg_hint_plan.enable_hint
+--------------------------
+ on
+(1 row)
+
+SHOW pg_hint_plan.debug_print;
+ pg_hint_plan.debug_print
+--------------------------
+ off
+(1 row)
+
+SHOW pg_hint_plan.parse_messages;
+ pg_hint_plan.parse_messages
+-----------------------------
+ info
+(1 row)
+
+-- No. A-6-1-2
+SET ROLE normal_user;
+SHOW pg_hint_plan.enable_hint;
+ pg_hint_plan.enable_hint
+--------------------------
+ on
+(1 row)
+
+SHOW pg_hint_plan.debug_print;
+ pg_hint_plan.debug_print
+--------------------------
+ off
+(1 row)
+
+SHOW pg_hint_plan.parse_messages;
+ pg_hint_plan.parse_messages
+-----------------------------
+ info
+(1 row)
+
+SET pg_hint_plan.enable_hint TO off;
+SET pg_hint_plan.debug_print TO on;
+SET pg_hint_plan.parse_messages TO error;
+SHOW pg_hint_plan.enable_hint;
+ pg_hint_plan.enable_hint
+--------------------------
+ off
+(1 row)
+
+SHOW pg_hint_plan.debug_print;
+ pg_hint_plan.debug_print
+--------------------------
+ on
+(1 row)
+
+SHOW pg_hint_plan.parse_messages;
+ pg_hint_plan.parse_messages
+-----------------------------
+ error
+(1 row)
+
+RESET pg_hint_plan.enable_hint;
+RESET pg_hint_plan.debug_print;
+RESET pg_hint_plan.parse_messages;
+SHOW pg_hint_plan.enable_hint;
+ pg_hint_plan.enable_hint
+--------------------------
+ on
+(1 row)
+
+SHOW pg_hint_plan.debug_print;
+ pg_hint_plan.debug_print
+--------------------------
+ off
+(1 row)
+
+SHOW pg_hint_plan.parse_messages;
+ pg_hint_plan.parse_messages
+-----------------------------
+ info
+(1 row)
+
+RESET ROLE;
+----
+---- No. A-6-2 original GUC parameter pg_hint_plan.enable_hint
+----
+-- No. A-6-2-1
+SET pg_hint_plan.enable_hint TO on;
+SHOW pg_hint_plan.enable_hint;
+ pg_hint_plan.enable_hint
+--------------------------
+ on
+(1 row)
+
+/*+Set(enable_indexscan off)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 = 1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 = 1)
+(4 rows)
+
+-- No. A-6-2-2
+SET pg_hint_plan.enable_hint TO off;
+SHOW pg_hint_plan.enable_hint;
+ pg_hint_plan.enable_hint
+--------------------------
+ off
+(1 row)
+
+/*+Set(enable_indexscan off)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. A-6-2-3
+SET pg_hint_plan.enable_hint TO DEFAULT;
+SHOW pg_hint_plan.enable_hint;
+ pg_hint_plan.enable_hint
+--------------------------
+ on
+(1 row)
+
+/*+Set(enable_indexscan off)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 = 1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 = 1)
+(4 rows)
+
+-- No. A-6-2-4
+SET pg_hint_plan.enable_hint TO enable;
+ERROR: parameter "pg_hint_plan.enable_hint" requires a Boolean value
+SHOW pg_hint_plan.enable_hint;
+ pg_hint_plan.enable_hint
+--------------------------
+ on
+(1 row)
+
+----
+---- No. A-6-3 original GUC parameter pg_hint_plan.debug_print
+----
+-- No. A-6-3-1
+SET pg_hint_plan.debug_print TO on;
+SHOW pg_hint_plan.debug_print;
+ pg_hint_plan.debug_print
+--------------------------
+ on
+(1 row)
+
+/*+Set(enable_indexscan off)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 = 1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 = 1)
+(4 rows)
+
+-- No. A-6-3-2
+SET pg_hint_plan.debug_print TO off;
+SHOW pg_hint_plan.debug_print;
+ pg_hint_plan.debug_print
+--------------------------
+ off
+(1 row)
+
+/*+Set(enable_indexscan off)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 = 1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 = 1)
+(4 rows)
+
+-- No. A-6-3-3
+SET pg_hint_plan.debug_print TO DEFAULT;
+SHOW pg_hint_plan.debug_print;
+ pg_hint_plan.debug_print
+--------------------------
+ off
+(1 row)
+
+/*+Set(enable_indexscan off)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 = 1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 = 1)
+(4 rows)
+
+-- No. A-6-3-4
+SET pg_hint_plan.debug_print TO enable;
+ERROR: parameter "pg_hint_plan.debug_print" requires a Boolean value
+SHOW pg_hint_plan.debug_print;
+ pg_hint_plan.debug_print
+--------------------------
+ off
+(1 row)
+
+----
+---- No. A-6-4 original GUC parameter pg_hint_plan.parse_messages
+----
+SET client_min_messages TO debug5;
+DEBUG: CommitTransactionCommand
+DEBUG: CommitTransaction
+DEBUG: name: unnamed; blockState: STARTED; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+-- No. A-6-4-1
+SET pg_hint_plan.parse_messages TO debug5;
+DEBUG: StartTransactionCommand
+DEBUG: StartTransaction
+DEBUG: name: unnamed; blockState: DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+DEBUG: ProcessUtility
+DEBUG: CommitTransactionCommand
+DEBUG: CommitTransaction
+DEBUG: name: unnamed; blockState: STARTED; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+SHOW pg_hint_plan.parse_messages;
+DEBUG: StartTransactionCommand
+DEBUG: StartTransaction
+DEBUG: name: unnamed; blockState: DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+DEBUG: ProcessUtility
+DEBUG: CommitTransactionCommand
+DEBUG: CommitTransaction
+DEBUG: name: unnamed; blockState: STARTED; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+ pg_hint_plan.parse_messages
+-----------------------------
+ debug5
+(1 row)
+
+/*+Set*/SELECT 1;
+DEBUG: StartTransactionCommand
+DEBUG: StartTransaction
+DEBUG: name: unnamed; blockState: DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+DEBUG: hint syntax error at or near ""
+DETAIL: Opening parenthesis is necessary.
+DEBUG: CommitTransactionCommand
+DEBUG: CommitTransaction
+DEBUG: name: unnamed; blockState: STARTED; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+ ?column?
+----------
+ 1
+(1 row)
+
+SET client_min_messages TO debug4;
+DEBUG: StartTransactionCommand
+DEBUG: StartTransaction
+DEBUG: name: unnamed; blockState: DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+DEBUG: ProcessUtility
+DEBUG: CommitTransactionCommand
+DEBUG: CommitTransaction
+DEBUG: name: unnamed; blockState: STARTED; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+/*+Set*/SELECT 1;
+DEBUG: StartTransactionCommand
+DEBUG: StartTransaction
+DEBUG: name: unnamed; blockState: DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+DEBUG: CommitTransactionCommand
+DEBUG: CommitTransaction
+DEBUG: name: unnamed; blockState: STARTED; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+ ?column?
+----------
+ 1
+(1 row)
+
+-- No. A-6-4-2
+SET pg_hint_plan.parse_messages TO debug4;
+DEBUG: StartTransactionCommand
+DEBUG: StartTransaction
+DEBUG: name: unnamed; blockState: DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+DEBUG: ProcessUtility
+DEBUG: CommitTransactionCommand
+DEBUG: CommitTransaction
+DEBUG: name: unnamed; blockState: STARTED; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+SHOW pg_hint_plan.parse_messages;
+DEBUG: StartTransactionCommand
+DEBUG: StartTransaction
+DEBUG: name: unnamed; blockState: DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+DEBUG: ProcessUtility
+DEBUG: CommitTransactionCommand
+DEBUG: CommitTransaction
+DEBUG: name: unnamed; blockState: STARTED; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+ pg_hint_plan.parse_messages
+-----------------------------
+ debug4
+(1 row)
+
+/*+Set*/SELECT 1;
+DEBUG: StartTransactionCommand
+DEBUG: StartTransaction
+DEBUG: name: unnamed; blockState: DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+DEBUG: hint syntax error at or near ""
+DETAIL: Opening parenthesis is necessary.
+DEBUG: CommitTransactionCommand
+DEBUG: CommitTransaction
+DEBUG: name: unnamed; blockState: STARTED; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+ ?column?
+----------
+ 1
+(1 row)
+
+SET client_min_messages TO debug3;
+DEBUG: StartTransactionCommand
+DEBUG: StartTransaction
+DEBUG: name: unnamed; blockState: DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+DEBUG: ProcessUtility
+DEBUG: CommitTransactionCommand
+DEBUG: CommitTransaction
+DEBUG: name: unnamed; blockState: STARTED; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+/*+Set*/SELECT 1;
+DEBUG: StartTransactionCommand
+DEBUG: StartTransaction
+DEBUG: name: unnamed; blockState: DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+DEBUG: CommitTransactionCommand
+DEBUG: CommitTransaction
+DEBUG: name: unnamed; blockState: STARTED; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+ ?column?
+----------
+ 1
+(1 row)
+
+-- No. A-6-4-3
+SET pg_hint_plan.parse_messages TO debug3;
+DEBUG: StartTransactionCommand
+DEBUG: StartTransaction
+DEBUG: name: unnamed; blockState: DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+DEBUG: ProcessUtility
+DEBUG: CommitTransactionCommand
+DEBUG: CommitTransaction
+DEBUG: name: unnamed; blockState: STARTED; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+SHOW pg_hint_plan.parse_messages;
+DEBUG: StartTransactionCommand
+DEBUG: StartTransaction
+DEBUG: name: unnamed; blockState: DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+DEBUG: ProcessUtility
+DEBUG: CommitTransactionCommand
+DEBUG: CommitTransaction
+DEBUG: name: unnamed; blockState: STARTED; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+ pg_hint_plan.parse_messages
+-----------------------------
+ debug3
+(1 row)
+
+/*+Set*/SELECT 1;
+DEBUG: StartTransactionCommand
+DEBUG: StartTransaction
+DEBUG: name: unnamed; blockState: DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+DEBUG: hint syntax error at or near ""
+DETAIL: Opening parenthesis is necessary.
+DEBUG: CommitTransactionCommand
+DEBUG: CommitTransaction
+DEBUG: name: unnamed; blockState: STARTED; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+ ?column?
+----------
+ 1
+(1 row)
+
+SET client_min_messages TO debug2;
+DEBUG: StartTransactionCommand
+DEBUG: StartTransaction
+DEBUG: name: unnamed; blockState: DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
+DEBUG: ProcessUtility
+/*+Set*/SELECT 1;
+ ?column?
+----------
+ 1
+(1 row)
+
+-- No. A-6-4-4
+SET pg_hint_plan.parse_messages TO debug2;
+SHOW pg_hint_plan.parse_messages;
+ pg_hint_plan.parse_messages
+-----------------------------
+ debug
+(1 row)
+
+/*+Set*/SELECT 1;
+DEBUG: hint syntax error at or near ""
+DETAIL: Opening parenthesis is necessary.
+ ?column?
+----------
+ 1
+(1 row)
+
+SET client_min_messages TO debug1;
+/*+Set*/SELECT 1;
+ ?column?
+----------
+ 1
+(1 row)
+
+-- No. A-6-4-5
+SET pg_hint_plan.parse_messages TO debug1;
+SHOW pg_hint_plan.parse_messages;
+ pg_hint_plan.parse_messages
+-----------------------------
+ debug1
+(1 row)
+
+/*+Set*/SELECT 1;
+DEBUG: hint syntax error at or near ""
+DETAIL: Opening parenthesis is necessary.
+ ?column?
+----------
+ 1
+(1 row)
+
+SET client_min_messages TO log;
+/*+Set*/SELECT 1;
+ ?column?
+----------
+ 1
+(1 row)
+
+-- No. A-6-4-6
+SET pg_hint_plan.parse_messages TO log;
+SHOW pg_hint_plan.parse_messages;
+ pg_hint_plan.parse_messages
+-----------------------------
+ log
+(1 row)
+
+/*+Set*/SELECT 1;
+LOG: hint syntax error at or near ""
+DETAIL: Opening parenthesis is necessary.
+ ?column?
+----------
+ 1
+(1 row)
+
+SET client_min_messages TO info;
+/*+Set*/SELECT 1;
+ ?column?
+----------
+ 1
+(1 row)
+
+-- No. A-6-4-7
+SET pg_hint_plan.parse_messages TO info;
+SHOW pg_hint_plan.parse_messages;
+ pg_hint_plan.parse_messages
+-----------------------------
+ info
+(1 row)
+
+/*+Set*/SELECT 1;
+INFO: hint syntax error at or near ""
+DETAIL: Opening parenthesis is necessary.
+ ?column?
+----------
+ 1
+(1 row)
+
+SET client_min_messages TO notice;
+/*+Set*/SELECT 1;
+INFO: hint syntax error at or near ""
+DETAIL: Opening parenthesis is necessary.
+ ?column?
+----------
+ 1
+(1 row)
+
+-- No. A-6-4-8
+SET pg_hint_plan.parse_messages TO notice;
+SHOW pg_hint_plan.parse_messages;
+ pg_hint_plan.parse_messages
+-----------------------------
+ notice
+(1 row)
+
+/*+Set*/SELECT 1;
+NOTICE: hint syntax error at or near ""
+DETAIL: Opening parenthesis is necessary.
+ ?column?
+----------
+ 1
+(1 row)
+
+SET client_min_messages TO warning;
+/*+Set*/SELECT 1;
+ ?column?
+----------
+ 1
+(1 row)
+
+-- No. A-6-4-9
+SET pg_hint_plan.parse_messages TO warning;
+SHOW pg_hint_plan.parse_messages;
+ pg_hint_plan.parse_messages
+-----------------------------
+ warning
+(1 row)
+
+/*+Set*/SELECT 1;
+WARNING: hint syntax error at or near ""
+DETAIL: Opening parenthesis is necessary.
+ ?column?
+----------
+ 1
+(1 row)
+
+SET client_min_messages TO error;
+/*+Set*/SELECT 1;
+ ?column?
+----------
+ 1
+(1 row)
+
+-- No. A-6-4-10
+SET pg_hint_plan.parse_messages TO error;
+SHOW pg_hint_plan.parse_messages;
+ pg_hint_plan.parse_messages
+-----------------------------
+ error
+(1 row)
+
+/*+Set*/SELECT 1;
+ERROR: hint syntax error at or near ""
+DETAIL: Opening parenthesis is necessary.
+SET client_min_messages TO fatal;
+/*+Set*/SELECT 1;
+-- No. A-6-4-11
+RESET client_min_messages;
+SET pg_hint_plan.parse_messages TO DEFAULT;
+SHOW pg_hint_plan.parse_messages;
+ pg_hint_plan.parse_messages
+-----------------------------
+ info
+(1 row)
+
+/*+Set*/SELECT 1;
+INFO: hint syntax error at or near ""
+DETAIL: Opening parenthesis is necessary.
+ ?column?
+----------
+ 1
+(1 row)
+
+-- No. A-6-4-12
+SET pg_hint_plan.parse_messages TO fatal;
+ERROR: invalid value for parameter "pg_hint_plan.parse_messages": "fatal"
+HINT: Available values: debug5, debug4, debug3, debug2, debug1, log, info, notice, warning, error.
+SHOW pg_hint_plan.parse_messages;
+ pg_hint_plan.parse_messages
+-----------------------------
+ info
+(1 row)
+
+-- No. A-6-4-13
+SET pg_hint_plan.parse_messages TO panic;
+ERROR: invalid value for parameter "pg_hint_plan.parse_messages": "panic"
+HINT: Available values: debug5, debug4, debug3, debug2, debug1, log, info, notice, warning, error.
+SHOW pg_hint_plan.parse_messages;
+ pg_hint_plan.parse_messages
+-----------------------------
+ info
+(1 row)
+
+-- No. A-6-4-14
+SET pg_hint_plan.parse_messages TO on;
+ERROR: invalid value for parameter "pg_hint_plan.parse_messages": "on"
+HINT: Available values: debug5, debug4, debug3, debug2, debug1, log, info, notice, warning, error.
+SHOW pg_hint_plan.parse_messages;
+ pg_hint_plan.parse_messages
+-----------------------------
+ info
+(1 row)
+
+----
+---- No. A-7-1 parse error message output
+----
+-- No. A-7-1-1
+/*+"Set"(enable_indexscan on)*/SELECT 1;
+INFO: hint syntax error at or near ""Set"(enable_indexscan on)"
+DETAIL: Unrecognized hint keyword ""Set"".
+ ?column?
+----------
+ 1
+(1 row)
+
+/*+Set()(enable_indexscan on)*/SELECT 1;
+INFO: hint syntax error at or near ")(enable_indexscan on)"
+DETAIL: Parameter name is necessary.
+ ?column?
+----------
+ 1
+(1 row)
+
+/*+Set(enable_indexscan on*/SELECT 1;
+INFO: hint syntax error at or near ""
+DETAIL: Closing parenthesis is necessary.
+ ?column?
+----------
+ 1
+(1 row)
+
+----
+---- No. A-7-3 hint state output
+----
+SET pg_hint_plan.debug_print TO on;
+SET client_min_messages TO LOG;
+-- No. A-7-3-1
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-7-3-2
+/*+SeqScan(no_table)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+SeqScan(no_table)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. A-7-3-3
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(3 rows)
+
+/*+TidScan(t1)BitmapScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid = '(1,1)';
+INFO: hint syntax error at or near "TidScan(t1)BitmapScan(t1)"
+DETAIL: Conflict scan method hint.
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+TidScan(t1)
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 = 1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 = 1)
+(5 rows)
+
+/*+TidScan(t1)BitmapScan(t1)IndexScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid = '(1,1)';
+INFO: hint syntax error at or near "TidScan(t1)BitmapScan(t1)IndexScan(t1)"
+DETAIL: Conflict scan method hint.
+INFO: hint syntax error at or near "BitmapScan(t1)IndexScan(t1)"
+DETAIL: Conflict scan method hint.
+LOG: pg_hint_plan:
+used hint:
+IndexScan(t1)
+not used hint:
+duplication hint:
+TidScan(t1)
+BitmapScan(t1)
+error hint:
+
+ QUERY PLAN
+---------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+ Filter: (ctid = '(1,1)'::tid)
+(3 rows)
+
+/*+TidScan(t1)BitmapScan(t1)IndexScan(t1)SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid = '(1,1)';
+INFO: hint syntax error at or near "TidScan(t1)BitmapScan(t1)IndexScan(t1)SeqScan(t1)"
+DETAIL: Conflict scan method hint.
+INFO: hint syntax error at or near "BitmapScan(t1)IndexScan(t1)SeqScan(t1)"
+DETAIL: Conflict scan method hint.
+INFO: hint syntax error at or near "IndexScan(t1)SeqScan(t1)"
+DETAIL: Conflict scan method hint.
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+TidScan(t1)
+BitmapScan(t1)
+IndexScan(t1)
+error hint:
+
+ QUERY PLAN
+------------------------------------------------
+ Seq Scan on t1
+ Filter: ((c1 = 1) AND (ctid = '(1,1)'::tid))
+(2 rows)
+
+-- No. A-7-3-4
+/*+Set(enable_indexscan enable)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+INFO: parameter "enable_indexscan" requires a Boolean value
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+Set(enable_indexscan enable)
+
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+----
+---- No. A-8-1 hint state output
+----
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+EXPLAIN (COSTS false) EXECUTE p1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+DEALLOCATE p1;
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 < $1;
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+ QUERY PLAN
+-----------------------
+ Seq Scan on t1
+ Filter: (c1 < 1000)
+(2 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+ QUERY PLAN
+-----------------------
+ Seq Scan on t1
+ Filter: (c1 < 1000)
+(2 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+ QUERY PLAN
+-----------------------
+ Seq Scan on t1
+ Filter: (c1 < 1000)
+(2 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+ QUERY PLAN
+-----------------------
+ Seq Scan on t1
+ Filter: (c1 < 1000)
+(2 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+ QUERY PLAN
+-----------------------
+ Seq Scan on t1
+ Filter: (c1 < 1000)
+(2 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c1 < $1)
+(2 rows)
+
+DEALLOCATE p1;
+-- No. A-8-1-1
+-- No. A-8-1-2
+/*+SeqScan(t1)*/
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) EXECUTE p1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) EXECUTE p1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+DEALLOCATE p1;
+/*+BitmapScan(t1)*/
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 < $1;
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < 1000)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < 1000)
+(4 rows)
+
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < 1000)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < 1000)
+(4 rows)
+
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < 1000)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < 1000)
+(4 rows)
+
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < 1000)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < 1000)
+(4 rows)
+
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < 1000)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < 1000)
+(4 rows)
+
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < $1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < $1)
+(4 rows)
+
+UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < $1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < $1)
+(4 rows)
+
+DEALLOCATE p1;
+-- No. A-8-1-3
+-- No. A-8-1-4
+/*+SeqScan(t1)*/
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+EXPLAIN (COSTS false) EXECUTE p1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
+EXPLAIN (COSTS false) EXECUTE p1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+DEALLOCATE p1;
+/*+BitmapScan(t1)*/
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 < $1;
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < 1000)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < 1000)
+(4 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < 1000)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < 1000)
+(4 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < 1000)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < 1000)
+(4 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < 1000)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < 1000)
+(4 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < 1000)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < 1000)
+(4 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < $1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < $1)
+(4 rows)
+
+UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < $1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < $1)
+(4 rows)
+
+DEALLOCATE p1;
+-- No. A-8-1-5
+-- No. A-8-1-6
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) EXECUTE p1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) EXECUTE p1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+DEALLOCATE p1;
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 < $1;
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+ QUERY PLAN
+-----------------------
+ Seq Scan on t1
+ Filter: (c1 < 1000)
+(2 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+ QUERY PLAN
+-----------------------
+ Seq Scan on t1
+ Filter: (c1 < 1000)
+(2 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+ QUERY PLAN
+-----------------------
+ Seq Scan on t1
+ Filter: (c1 < 1000)
+(2 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+ QUERY PLAN
+-----------------------
+ Seq Scan on t1
+ Filter: (c1 < 1000)
+(2 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+ QUERY PLAN
+-----------------------
+ Seq Scan on t1
+ Filter: (c1 < 1000)
+(2 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c1 < $1)
+(2 rows)
+
+UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c1 < $1)
+(2 rows)
+
+DEALLOCATE p1;
+-- No. A-8-1-9
+-- No. A-8-1-10
+/*+SeqScan(t1)*/
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+DEALLOCATE p1;
+/*+BitmapScan(t1)*/
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 < $1;
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < 1000)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < 1000)
+(4 rows)
+
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < 1000)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < 1000)
+(4 rows)
+
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < 1000)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < 1000)
+(4 rows)
+
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < 1000)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < 1000)
+(4 rows)
+
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < 1000)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < 1000)
+(4 rows)
+
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < $1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < $1)
+(4 rows)
+
+UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < $1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < $1)
+(4 rows)
+
+DEALLOCATE p1;
+-- No. A-8-1-11
+-- No. A-8-1-12
+/*+SeqScan(t1)*/
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+DEALLOCATE p1;
+/*+BitmapScan(t1)*/
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 < $1;
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < 1000)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < 1000)
+(4 rows)
+
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < 1000)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < 1000)
+(4 rows)
+
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < 1000)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < 1000)
+(4 rows)
+
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < 1000)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < 1000)
+(4 rows)
+
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < 1000)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < 1000)
+(4 rows)
+
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < $1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < $1)
+(4 rows)
+
+UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 < $1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 < $1)
+(4 rows)
+
+DEALLOCATE p1;
+-- No. A-8-1-13
+-- No. A-8-1-14
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+DEALLOCATE p1;
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 < $1;
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+ QUERY PLAN
+-----------------------
+ Seq Scan on t1
+ Filter: (c1 < 1000)
+(2 rows)
+
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+ QUERY PLAN
+-----------------------
+ Seq Scan on t1
+ Filter: (c1 < 1000)
+(2 rows)
+
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+ QUERY PLAN
+-----------------------
+ Seq Scan on t1
+ Filter: (c1 < 1000)
+(2 rows)
+
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+ QUERY PLAN
+-----------------------
+ Seq Scan on t1
+ Filter: (c1 < 1000)
+(2 rows)
+
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+ QUERY PLAN
+-----------------------
+ Seq Scan on t1
+ Filter: (c1 < 1000)
+(2 rows)
+
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c1 < $1)
+(2 rows)
+
+UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c1 < $1)
+(2 rows)
+
+DEALLOCATE p1;
+----
+---- No. A-8-4 EXECUTE statement name error
+----
+-- No. A-8-4-1
+EXECUTE p1;
+ERROR: prepared statement "p1" does not exist
+SHOW pg_hint_plan.debug_print;
+ pg_hint_plan.debug_print
+--------------------------
+ on
+(1 row)
+
+----
+---- No. A-9-5 EXECUTE statement name error
+----
+-- No. A-9-5-1
+SELECT pg_stat_statements_reset();
+ pg_stat_statements_reset
+--------------------------
+
+(1 row)
+
+SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ c1 | c2 | c3 | c4
+----+----+----+----
+ 1 | 1 | 1 | 1
+(1 row)
+
+/*+Set(enable_seqscan off)*/ SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+Set(enable_seqscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ c1 | c2 | c3 | c4
+----+----+----+----
+ 1 | 1 | 1 | 1
+(1 row)
+
+/*+SeqScan(t1)*/ SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ c1 | c2 | c3 | c4
+----+----+----+----
+ 1 | 1 | 1 | 1
+(1 row)
+
+SELECT s.query, s.calls
+ FROM public.pg_stat_statements s
+ JOIN pg_catalog.pg_database d
+ ON (s.dbid = d.oid)
+ ORDER BY 1;
+ query | calls
+--------------------------------------+-------
+ SELECT * FROM s1.t1 WHERE t1.c1 = ?; | 3
+ SELECT pg_stat_statements_reset(); | 1
+(2 rows)
+
+----
+---- No. A-10-1 duplicate hint
+----
+-- No. A-10-1-1
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.ctid = '(1,1)' AND t1.c1 = t2.c1 AND t2.ctid = '(1,1)' AND t1.c1 = t3.c1 AND t3.ctid = '(1,1)' AND t1.c1 = t4.c1 AND t4.ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------
+ Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t2.c1)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(14 rows)
+
+/*+
+Set(enable_tidscan aaa)
+Set(enable_tidscan on)
+Set(enable_tidscan off)
+SeqScan(t4)
+IndexScan(t4)
+BitmapScan(t4)
+TidScan(t4)
+NestLoop(t4 t3)
+MergeJoin(t4 t3)
+HashJoin(t4 t3)
+Leading(t2 t1 t4 t3)
+Leading(t1 t4 t3 t2)
+Leading(t4 t3 t2 t1)
+*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.ctid = '(1,1)' AND t1.c1 = t2.c1 AND t2.ctid = '(1,1)' AND t1.c1 = t3.c1 AND t3.ctid = '(1,1)' AND t1.c1 = t4.c1 AND t4.ctid = '(1,1)';
+INFO: hint syntax error at or near "SeqScan(t4)
+IndexScan(t4)
+BitmapScan(t4)
+TidScan(t4)
+NestLoop(t4 t3)
+MergeJoin(t4 t3)
+HashJoin(t4 t3)
+Leading(t2 t1 t4 t3)
+Leading(t1 t4 t3 t2)
+Leading(t4 t3 t2 t1)
+"
+DETAIL: Conflict scan method hint.
+INFO: hint syntax error at or near "IndexScan(t4)
+BitmapScan(t4)
+TidScan(t4)
+NestLoop(t4 t3)
+MergeJoin(t4 t3)
+HashJoin(t4 t3)
+Leading(t2 t1 t4 t3)
+Leading(t1 t4 t3 t2)
+Leading(t4 t3 t2 t1)
+"
+DETAIL: Conflict scan method hint.
+INFO: hint syntax error at or near "BitmapScan(t4)
+TidScan(t4)
+NestLoop(t4 t3)
+MergeJoin(t4 t3)
+HashJoin(t4 t3)
+Leading(t2 t1 t4 t3)
+Leading(t1 t4 t3 t2)
+Leading(t4 t3 t2 t1)
+"
+DETAIL: Conflict scan method hint.
+INFO: hint syntax error at or near "NestLoop(t4 t3)
+MergeJoin(t4 t3)
+HashJoin(t4 t3)
+Leading(t2 t1 t4 t3)
+Leading(t1 t4 t3 t2)
+Leading(t4 t3 t2 t1)
+"
+DETAIL: Conflict join method hint.
+INFO: hint syntax error at or near "MergeJoin(t4 t3)
+HashJoin(t4 t3)
+Leading(t2 t1 t4 t3)
+Leading(t1 t4 t3 t2)
+Leading(t4 t3 t2 t1)
+"
+DETAIL: Conflict join method hint.
+INFO: hint syntax error at or near "Leading(t2 t1 t4 t3)
+Leading(t1 t4 t3 t2)
+Leading(t4 t3 t2 t1)
+"
+DETAIL: Conflict leading hint.
+INFO: hint syntax error at or near "Leading(t1 t4 t3 t2)
+Leading(t4 t3 t2 t1)
+"
+DETAIL: Conflict leading hint.
+INFO: hint syntax error at or near "Set(enable_tidscan aaa)
+Set(enable_tidscan on)
+Set(enable_tidscan off)
+SeqScan(t4)
+IndexScan(t4)
+BitmapScan(t4)
+TidScan(t4)
+NestLoop(t4 t3)
+MergeJoin(t4 t3)
+HashJoin(t4 t3)
+Leading(t2 t1 t4 t3)
+Leading(t1 t4 t3 t2)
+Leading(t4 t3 t2 t1)
+"
+DETAIL: Conflict set hint.
+INFO: hint syntax error at or near "Set(enable_tidscan on)
+Set(enable_tidscan off)
+SeqScan(t4)
+IndexScan(t4)
+BitmapScan(t4)
+TidScan(t4)
+NestLoop(t4 t3)
+MergeJoin(t4 t3)
+HashJoin(t4 t3)
+Leading(t2 t1 t4 t3)
+Leading(t1 t4 t3 t2)
+Leading(t4 t3 t2 t1)
+"
+DETAIL: Conflict set hint.
+LOG: pg_hint_plan:
+used hint:
+TidScan(t4)
+HashJoin(t3 t4)
+Leading(t4 t3 t2 t1)
+Set(enable_tidscan off)
+not used hint:
+duplication hint:
+SeqScan(t4)
+IndexScan(t4)
+BitmapScan(t4)
+NestLoop(t3 t4)
+MergeJoin(t3 t4)
+Leading(t2 t1 t4 t3)
+Leading(t1 t4 t3 t2)
+Set(enable_tidscan aaa)
+Set(enable_tidscan on)
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------
+ Nested Loop
+ -> Nested Loop
+ Join Filter: (t3.c1 = t2.c1)
+ -> Hash Join
+ Hash Cond: (t3.c1 = t4.c1)
+ -> Seq Scan on t3
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = t2.c1)
+ Filter: (ctid = '(1,1)'::tid)
+(15 rows)
+
+-- No. A-10-1-2
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.ctid = '(1,1)' AND t1.c1 = t2.c1 AND t2.ctid = '(1,1)' AND t1.c1 = t3.c1 AND t3.ctid = '(1,1)' AND t1.c1 = t4.c1 AND t4.ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------
+ Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t2.c1)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(14 rows)
+
+/*+
+SeqScan(t4)
+Set(enable_tidscan aaa)
+IndexScan(t4)
+NestLoop(t4 t3)
+Leading(t2 t1 t4 t3)
+Set(enable_tidscan on)
+BitmapScan(t4)
+MergeJoin(t4 t3)
+Leading(t1 t4 t3 t2)
+Set(enable_tidscan off)
+TidScan(t4)
+HashJoin(t4 t3)
+Leading(t4 t3 t2 t1)
+*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.ctid = '(1,1)' AND t1.c1 = t2.c1 AND t2.ctid = '(1,1)' AND t1.c1 = t3.c1 AND t3.ctid = '(1,1)' AND t1.c1 = t4.c1 AND t4.ctid = '(1,1)';
+INFO: hint syntax error at or near "SeqScan(t4)
+Set(enable_tidscan aaa)
+IndexScan(t4)
+NestLoop(t4 t3)
+Leading(t2 t1 t4 t3)
+Set(enable_tidscan on)
+BitmapScan(t4)
+MergeJoin(t4 t3)
+Leading(t1 t4 t3 t2)
+Set(enable_tidscan off)
+TidScan(t4)
+HashJoin(t4 t3)
+Leading(t4 t3 t2 t1)
+"
+DETAIL: Conflict scan method hint.
+INFO: hint syntax error at or near "IndexScan(t4)
+NestLoop(t4 t3)
+Leading(t2 t1 t4 t3)
+Set(enable_tidscan on)
+BitmapScan(t4)
+MergeJoin(t4 t3)
+Leading(t1 t4 t3 t2)
+Set(enable_tidscan off)
+TidScan(t4)
+HashJoin(t4 t3)
+Leading(t4 t3 t2 t1)
+"
+DETAIL: Conflict scan method hint.
+INFO: hint syntax error at or near "BitmapScan(t4)
+MergeJoin(t4 t3)
+Leading(t1 t4 t3 t2)
+Set(enable_tidscan off)
+TidScan(t4)
+HashJoin(t4 t3)
+Leading(t4 t3 t2 t1)
+"
+DETAIL: Conflict scan method hint.
+INFO: hint syntax error at or near "NestLoop(t4 t3)
+Leading(t2 t1 t4 t3)
+Set(enable_tidscan on)
+BitmapScan(t4)
+MergeJoin(t4 t3)
+Leading(t1 t4 t3 t2)
+Set(enable_tidscan off)
+TidScan(t4)
+HashJoin(t4 t3)
+Leading(t4 t3 t2 t1)
+"
+DETAIL: Conflict join method hint.
+INFO: hint syntax error at or near "MergeJoin(t4 t3)
+Leading(t1 t4 t3 t2)
+Set(enable_tidscan off)
+TidScan(t4)
+HashJoin(t4 t3)
+Leading(t4 t3 t2 t1)
+"
+DETAIL: Conflict join method hint.
+INFO: hint syntax error at or near "Leading(t2 t1 t4 t3)
+Set(enable_tidscan on)
+BitmapScan(t4)
+MergeJoin(t4 t3)
+Leading(t1 t4 t3 t2)
+Set(enable_tidscan off)
+TidScan(t4)
+HashJoin(t4 t3)
+Leading(t4 t3 t2 t1)
+"
+DETAIL: Conflict leading hint.
+INFO: hint syntax error at or near "Leading(t1 t4 t3 t2)
+Set(enable_tidscan off)
+TidScan(t4)
+HashJoin(t4 t3)
+Leading(t4 t3 t2 t1)
+"
+DETAIL: Conflict leading hint.
+INFO: hint syntax error at or near "Set(enable_tidscan aaa)
+IndexScan(t4)
+NestLoop(t4 t3)
+Leading(t2 t1 t4 t3)
+Set(enable_tidscan on)
+BitmapScan(t4)
+MergeJoin(t4 t3)
+Leading(t1 t4 t3 t2)
+Set(enable_tidscan off)
+TidScan(t4)
+HashJoin(t4 t3)
+Leading(t4 t3 t2 t1)
+"
+DETAIL: Conflict set hint.
+INFO: hint syntax error at or near "Set(enable_tidscan on)
+BitmapScan(t4)
+MergeJoin(t4 t3)
+Leading(t1 t4 t3 t2)
+Set(enable_tidscan off)
+TidScan(t4)
+HashJoin(t4 t3)
+Leading(t4 t3 t2 t1)
+"
+DETAIL: Conflict set hint.
+LOG: pg_hint_plan:
+used hint:
+TidScan(t4)
+HashJoin(t3 t4)
+Leading(t4 t3 t2 t1)
+Set(enable_tidscan off)
+not used hint:
+duplication hint:
+SeqScan(t4)
+IndexScan(t4)
+BitmapScan(t4)
+NestLoop(t3 t4)
+MergeJoin(t3 t4)
+Leading(t2 t1 t4 t3)
+Leading(t1 t4 t3 t2)
+Set(enable_tidscan aaa)
+Set(enable_tidscan on)
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------
+ Nested Loop
+ -> Nested Loop
+ Join Filter: (t3.c1 = t2.c1)
+ -> Hash Join
+ Hash Cond: (t3.c1 = t4.c1)
+ -> Seq Scan on t3
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = t2.c1)
+ Filter: (ctid = '(1,1)'::tid)
+(15 rows)
+
+----
+---- No. A-10-2 restrict query type
+----
+-- No. A-10-2-1
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 FULL OUTER JOIN s1.t2 ON (t1.c1 = t2.c1);
+ QUERY PLAN
+------------------------------
+ Hash Full Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+/*+NestLoop(t1 t2)*/
+EXPLAIN (COSTS true) SELECT * FROM s1.t1 FULL OUTER JOIN s1.t2 ON (t1.c1 = t2.c1);
+LOG: pg_hint_plan:
+used hint:
+NestLoop(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------------------------------
+ Hash Full Join (cost=10000000003.25..10000000024.00 rows=1000 width=29)
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on t1 (cost=0.00..16.00 rows=1000 width=15)
+ -> Hash (cost=2.00..2.00 rows=100 width=14)
+ -> Seq Scan on t2 (cost=0.00..2.00 rows=100 width=14)
+(5 rows)
+
+-- No. A-10-2-2
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c3 = 1;
+ QUERY PLAN
+---------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c3 = 1)
+ -> Bitmap Index Scan on t1_i
+ Index Cond: (c3 = 1)
+(4 rows)
+
+/*+IndexScan(t1 t1_i1)*/
+EXPLAIN (COSTS true) SELECT * FROM s1.t1 WHERE t1.c3 = 1;
+LOG: pg_hint_plan:
+used hint:
+IndexScan(t1 t1_i1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------------------------
+ Seq Scan on t1 (cost=10000000000.00..10000000018.50 rows=10 width=15)
+ Filter: (c3 = 1)
+(2 rows)
+
+-- No. A-10-2-3
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+/*+TidScan(t1)*/
+EXPLAIN (COSTS true) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+TidScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------
+ Seq Scan on t1 (cost=10000000000.00..10000000018.50 rows=1 width=15)
+ Filter: (c1 = 1)
+(2 rows)
+
+----
+---- No. A-10-3 VIEW, RULE multi specified
+----
+-- No. A-10-3-1
+EXPLAIN (COSTS false) SELECT * FROM s1.v1 v1, s1.v1 v2 WHERE v1.c1 = v2.c1;
+ QUERY PLAN
+----------------------------------
+ Hash Join
+ Hash Cond: (v1t1.c1 = v1t1.c1)
+ -> Seq Scan on t1 v1t1
+ -> Hash
+ -> Seq Scan on t1 v1t1
+(5 rows)
+
+/*+Leading(v1t1 v1t1)HashJoin(v1t1 v1t1)BitmapScan(v1t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.v1 v1, s1.v1 v2 WHERE v1.c1 = v2.c1;
+INFO: hint syntax error at or near "HashJoin(v1t1 v1t1)BitmapScan(v1t1)"
+DETAIL: Relation name "v1t1" is ambiguous.
+INFO: hint syntax error at or near "Leading(v1t1 v1t1)HashJoin(v1t1 v1t1)BitmapScan(v1t1)"
+DETAIL: Relation name "v1t1" is ambiguous.
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(v1t1)
+not used hint:
+Leading(v1t1 v1t1)
+duplication hint:
+error hint:
+HashJoin(v1t1 v1t1)
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Index Scan using t1_i1 on t1 v1t1
+ -> Bitmap Heap Scan on t1 v1t1
+ Recheck Cond: (c1 = v1t1.c1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 = v1t1.c1)
+(6 rows)
+
+-- No. A-10-3-2
+EXPLAIN (COSTS false) SELECT * FROM s1.v1 v1, s1.v1_ v2 WHERE v1.c1 = v2.c1;
+ QUERY PLAN
+-----------------------------------
+ Hash Join
+ Hash Cond: (v1t1.c1 = v1t1_.c1)
+ -> Seq Scan on t1 v1t1
+ -> Hash
+ -> Seq Scan on t1 v1t1_
+(5 rows)
+
+/*+Leading(v1t1 v1t1_)NestLoop(v1t1 v1t1_)SeqScan(v1t1)BitmapScan(v1t1_)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.v1 v1, s1.v1_ v2 WHERE v1.c1 = v2.c1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(v1t1)
+BitmapScan(v1t1_)
+NestLoop(v1t1 v1t1_)
+Leading(v1t1 v1t1_)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Seq Scan on t1 v1t1
+ -> Bitmap Heap Scan on t1 v1t1_
+ Recheck Cond: (c1 = v1t1.c1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 = v1t1.c1)
+(6 rows)
+
+-- No. A-10-3-3
+EXPLAIN (COSTS false) SELECT * FROM s1.r4 t1, s1.r4 t2 WHERE t1.c1 = t2.c1;
+ QUERY PLAN
+----------------------------------
+ Hash Join
+ Hash Cond: (r4t1.c1 = r4t1.c1)
+ -> Seq Scan on t1 r4t1
+ -> Hash
+ -> Seq Scan on t1 r4t1
+(5 rows)
+
+/*+Leading(r4t1 r4t1)HashJoin(r4t1 r4t1)BitmapScan(r4t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.r4 t1, s1.r4 t2 WHERE t1.c1 = t2.c1;
+INFO: hint syntax error at or near "HashJoin(r4t1 r4t1)BitmapScan(r4t1)"
+DETAIL: Relation name "r4t1" is ambiguous.
+INFO: hint syntax error at or near "Leading(r4t1 r4t1)HashJoin(r4t1 r4t1)BitmapScan(r4t1)"
+DETAIL: Relation name "r4t1" is ambiguous.
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(r4t1)
+not used hint:
+Leading(r4t1 r4t1)
+duplication hint:
+error hint:
+HashJoin(r4t1 r4t1)
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Index Scan using t1_i1 on t1 r4t1
+ -> Bitmap Heap Scan on t1 r4t1
+ Recheck Cond: (c1 = r4t1.c1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 = r4t1.c1)
+(6 rows)
+
+-- No. A-10-3-4
+EXPLAIN (COSTS false) SELECT * FROM s1.r4 t1, s1.r5 t2 WHERE t1.c1 = t2.c1;
+ QUERY PLAN
+----------------------------------
+ Hash Join
+ Hash Cond: (r4t1.c1 = r5t1.c1)
+ -> Seq Scan on t1 r4t1
+ -> Hash
+ -> Seq Scan on t1 r5t1
+(5 rows)
+
+/*+Leading(r4t1 r5t1)NestLoop(r4t1 r5t1)SeqScan(r4t1)BitmapScan(r5t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.r4 t1, s1.r5 t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(r4t1)
+BitmapScan(r5t1)
+NestLoop(r4t1 r5t1)
+Leading(r4t1 r5t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Seq Scan on t1 r4t1
+ -> Bitmap Heap Scan on t1 r5t1
+ Recheck Cond: (c1 = r4t1.c1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 = r4t1.c1)
+(6 rows)
+
+----
+---- No. A-11-1 psql command
+----
+SELECT count(*) FROM s1.t1 WHERE t1.c1 = 1;
+ count
+-------
+ 1
+(1 row)
+
+/*+SeqScan(t1)*/
+SELECT count(*) FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ count
+-------
+ 1
+(1 row)
+
+-- No. A-11-1-4
+\set FETCH_COUNT 0
+/*+SeqScan(t1)*/
+SELECT count(*) FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ count
+-------
+ 1
+(1 row)
+
+-- No. A-11-1-5
+\set FETCH_COUNT 1
+/*+SeqScan(t1)*/
+SELECT count(*) FROM s1.t1 WHERE t1.c1 = 1;
+ count
+-------
+ 1
+(1 row)
+
+\unset FETCH_COUNT
+----
+---- No. A-11-4 PL/pgSQL function
+----
+-- No. A-11-4-1
+CREATE OR REPLACE FUNCTION f1() RETURNS SETOF text LANGUAGE plpgsql AS $$
+DECLARE
+ r text;
+BEGIN
+ FOR r IN EXPLAIN SELECT c4 FROM s1.t1 WHERE t1.c1 = 1
+ LOOP
+ RETURN NEXT r; -- return current row of SELECT
+ END LOOP;
+ RETURN;
+END
+$$;
+SELECT f1();
+ f1
+----------------------------------------------------------------
+ Index Scan using t1_i1 on t1 (cost=0.00..8.27 rows=1 width=3)
+ Index Cond: (c1 = 1)
+(2 rows)
+
+/*+SeqScan(t1)*/
+SELECT f1();
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+SeqScan(t1)
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+CONTEXT: PL/pgSQL function f1() line 5 at FOR over SELECT rows
+ f1
+---------------------------------------------------
+ Seq Scan on t1 (cost=0.00..18.50 rows=1 width=3)
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-11-4-2
+/*+SeqScan(t1)*/CREATE OR REPLACE FUNCTION f1() RETURNS SETOF text LANGUAGE plpgsql AS $$
+DECLARE
+ r text;
+BEGIN
+ /*+SeqScan(t1)*/FOR r IN EXPLAIN /*+SeqScan(t1)*/SELECT c4 FROM s1.t1 WHERE t1.c1 = 1
+ LOOP
+ /*+SeqScan(t1)*/RETURN NEXT r; -- return current row of SELECT
+ END LOOP;
+ /*+SeqScan(t1)*/RETURN;
+END
+$$;
+SELECT f1();
+ f1
+----------------------------------------------------------------
+ Index Scan using t1_i1 on t1 (cost=0.00..8.27 rows=1 width=3)
+ Index Cond: (c1 = 1)
+(2 rows)
+
+----
+---- No. A-12-1 reset of global variable of core at the error
+---- No. A-12-2 reset of global variable of original at the error
+----
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(6 rows)
+
+/*+Set(enable_seqscan off)Set(geqo_threshold 100)SeqScan(t1)MergeJoin(t1 t2)NestLoop(t1 t1)*/
+PREPARE p1 AS SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+EXPLAIN (COSTS false) EXECUTE p1;
+INFO: hint syntax error at or near "NestLoop(t1 t1)"
+DETAIL: Relation name "t1" is duplicated.
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+MergeJoin(t1 t2)
+Set(enable_seqscan off)
+Set(geqo_threshold 100)
+not used hint:
+duplication hint:
+error hint:
+NestLoop(t1 t1)
+
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Sort
+ Sort Key: t1.c1
+ -> Seq Scan on t1
+ -> Index Scan using t2_i1 on t2
+(6 rows)
+
+-- No. A-12-1-1
+-- No. A-12-2-1
+SELECT name, setting FROM settings;
+ name | setting
+---------------------------+-----------
+ geqo | on
+ geqo_effort | 5
+ geqo_generations | 0
+ geqo_pool_size | 0
+ geqo_seed | 0
+ geqo_selection_bias | 2
+ geqo_threshold | 12
+ constraint_exclusion | partition
+ cursor_tuple_fraction | 0.1
+ default_statistics_target | 100
+ from_collapse_limit | 8
+ join_collapse_limit | 8
+ cpu_index_tuple_cost | 0.005
+ cpu_operator_cost | 0.0025
+ cpu_tuple_cost | 0.01
+ effective_cache_size | 16384
+ random_page_cost | 4
+ seq_page_cost | 1
+ enable_bitmapscan | on
+ enable_hashagg | on
+ enable_hashjoin | on
+ enable_indexonlyscan | on
+ enable_indexscan | on
+ enable_material | on
+ enable_mergejoin | on
+ enable_nestloop | on
+ enable_seqscan | on
+ enable_sort | on
+ enable_tidscan | on
+ client_min_messages | log
+(30 rows)
+
+SET pg_hint_plan.parse_messages TO error;
+/*+Set(enable_seqscan off)Set(geqo_threshold 100)SeqScan(t1)MergeJoin(t1 t2)NestLoop(t1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+ERROR: hint syntax error at or near "NestLoop(t1 t1)"
+DETAIL: Relation name "t1" is duplicated.
+SELECT name, setting FROM settings;
+ name | setting
+---------------------------+-----------
+ geqo | on
+ geqo_effort | 5
+ geqo_generations | 0
+ geqo_pool_size | 0
+ geqo_seed | 0
+ geqo_selection_bias | 2
+ geqo_threshold | 12
+ constraint_exclusion | partition
+ cursor_tuple_fraction | 0.1
+ default_statistics_target | 100
+ from_collapse_limit | 8
+ join_collapse_limit | 8
+ cpu_index_tuple_cost | 0.005
+ cpu_operator_cost | 0.0025
+ cpu_tuple_cost | 0.01
+ effective_cache_size | 16384
+ random_page_cost | 4
+ seq_page_cost | 1
+ enable_bitmapscan | on
+ enable_hashagg | on
+ enable_hashjoin | on
+ enable_indexonlyscan | on
+ enable_indexscan | on
+ enable_material | on
+ enable_mergejoin | on
+ enable_nestloop | on
+ enable_seqscan | on
+ enable_sort | on
+ enable_tidscan | on
+ client_min_messages | log
+(30 rows)
+
+/*+Set(enable_seqscan off)Set(geqo_threshold 100)SeqScan(t1)MergeJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+MergeJoin(t1 t2)
+Set(enable_seqscan off)
+Set(geqo_threshold 100)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Sort
+ Sort Key: t1.c1
+ -> Seq Scan on t1
+ -> Index Scan using t2_i1 on t2
+(6 rows)
+
+-- No. A-12-1-2
+-- No. A-12-2-2
+SELECT name, setting FROM settings;
+ name | setting
+---------------------------+-----------
+ geqo | on
+ geqo_effort | 5
+ geqo_generations | 0
+ geqo_pool_size | 0
+ geqo_seed | 0
+ geqo_selection_bias | 2
+ geqo_threshold | 12
+ constraint_exclusion | partition
+ cursor_tuple_fraction | 0.1
+ default_statistics_target | 100
+ from_collapse_limit | 8
+ join_collapse_limit | 8
+ cpu_index_tuple_cost | 0.005
+ cpu_operator_cost | 0.0025
+ cpu_tuple_cost | 0.01
+ effective_cache_size | 16384
+ random_page_cost | 4
+ seq_page_cost | 1
+ enable_bitmapscan | on
+ enable_hashagg | on
+ enable_hashjoin | on
+ enable_indexonlyscan | on
+ enable_indexscan | on
+ enable_material | on
+ enable_mergejoin | on
+ enable_nestloop | on
+ enable_seqscan | on
+ enable_sort | on
+ enable_tidscan | on
+ client_min_messages | log
+(30 rows)
+
+SET pg_hint_plan.parse_messages TO error;
+/*+Set(enable_seqscan off)Set(geqo_threshold 100)SeqScan(t1)MergeJoin(t1 t2)NestLoop(t1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+ERROR: hint syntax error at or near "NestLoop(t1 t1)"
+DETAIL: Relation name "t1" is duplicated.
+SELECT name, setting FROM settings;
+ name | setting
+---------------------------+-----------
+ geqo | on
+ geqo_effort | 5
+ geqo_generations | 0
+ geqo_pool_size | 0
+ geqo_seed | 0
+ geqo_selection_bias | 2
+ geqo_threshold | 12
+ constraint_exclusion | partition
+ cursor_tuple_fraction | 0.1
+ default_statistics_target | 100
+ from_collapse_limit | 8
+ join_collapse_limit | 8
+ cpu_index_tuple_cost | 0.005
+ cpu_operator_cost | 0.0025
+ cpu_tuple_cost | 0.01
+ effective_cache_size | 16384
+ random_page_cost | 4
+ seq_page_cost | 1
+ enable_bitmapscan | on
+ enable_hashagg | on
+ enable_hashjoin | on
+ enable_indexonlyscan | on
+ enable_indexscan | on
+ enable_material | on
+ enable_mergejoin | on
+ enable_nestloop | on
+ enable_seqscan | on
+ enable_sort | on
+ enable_tidscan | on
+ client_min_messages | log
+(30 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1;
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Sort
+ Sort Key: t1.c1
+ -> Seq Scan on t1
+ -> Index Scan using t2_i1 on t2
+(6 rows)
+
+-- No. A-12-1-3
+-- No. A-12-2-3
+SELECT name, setting FROM settings;
+ name | setting
+---------------------------+-----------
+ geqo | on
+ geqo_effort | 5
+ geqo_generations | 0
+ geqo_pool_size | 0
+ geqo_seed | 0
+ geqo_selection_bias | 2
+ geqo_threshold | 12
+ constraint_exclusion | partition
+ cursor_tuple_fraction | 0.1
+ default_statistics_target | 100
+ from_collapse_limit | 8
+ join_collapse_limit | 8
+ cpu_index_tuple_cost | 0.005
+ cpu_operator_cost | 0.0025
+ cpu_tuple_cost | 0.01
+ effective_cache_size | 16384
+ random_page_cost | 4
+ seq_page_cost | 1
+ enable_bitmapscan | on
+ enable_hashagg | on
+ enable_hashjoin | on
+ enable_indexonlyscan | on
+ enable_indexscan | on
+ enable_material | on
+ enable_mergejoin | on
+ enable_nestloop | on
+ enable_seqscan | on
+ enable_sort | on
+ enable_tidscan | on
+ client_min_messages | log
+(30 rows)
+
+SET pg_hint_plan.parse_messages TO error;
+EXPLAIN (COSTS false) EXECUTE p2;
+ERROR: prepared statement "p2" does not exist
+/*+Set(enable_seqscan off)Set(geqo_threshold 100)SeqScan(t1)MergeJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+MergeJoin(t1 t2)
+Set(enable_seqscan off)
+Set(geqo_threshold 100)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Sort
+ Sort Key: t1.c1
+ -> Seq Scan on t1
+ -> Index Scan using t2_i1 on t2
+(6 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1;
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Sort
+ Sort Key: t1.c1
+ -> Seq Scan on t1
+ -> Index Scan using t2_i1 on t2
+(6 rows)
+
+SELECT name, setting FROM settings;
+ name | setting
+---------------------------+-----------
+ geqo | on
+ geqo_effort | 5
+ geqo_generations | 0
+ geqo_pool_size | 0
+ geqo_seed | 0
+ geqo_selection_bias | 2
+ geqo_threshold | 12
+ constraint_exclusion | partition
+ cursor_tuple_fraction | 0.1
+ default_statistics_target | 100
+ from_collapse_limit | 8
+ join_collapse_limit | 8
+ cpu_index_tuple_cost | 0.005
+ cpu_operator_cost | 0.0025
+ cpu_tuple_cost | 0.01
+ effective_cache_size | 16384
+ random_page_cost | 4
+ seq_page_cost | 1
+ enable_bitmapscan | on
+ enable_hashagg | on
+ enable_hashjoin | on
+ enable_indexonlyscan | on
+ enable_indexscan | on
+ enable_material | on
+ enable_mergejoin | on
+ enable_nestloop | on
+ enable_seqscan | on
+ enable_sort | on
+ enable_tidscan | on
+ client_min_messages | log
+(30 rows)
+
+-- No. A-12-1-4
+-- No. A-12-2-4
+SELECT name, setting FROM settings;
+ name | setting
+---------------------------+-----------
+ geqo | on
+ geqo_effort | 5
+ geqo_generations | 0
+ geqo_pool_size | 0
+ geqo_seed | 0
+ geqo_selection_bias | 2
+ geqo_threshold | 12
+ constraint_exclusion | partition
+ cursor_tuple_fraction | 0.1
+ default_statistics_target | 100
+ from_collapse_limit | 8
+ join_collapse_limit | 8
+ cpu_index_tuple_cost | 0.005
+ cpu_operator_cost | 0.0025
+ cpu_tuple_cost | 0.01
+ effective_cache_size | 16384
+ random_page_cost | 4
+ seq_page_cost | 1
+ enable_bitmapscan | on
+ enable_hashagg | on
+ enable_hashjoin | on
+ enable_indexonlyscan | on
+ enable_indexscan | on
+ enable_material | on
+ enable_mergejoin | on
+ enable_nestloop | on
+ enable_seqscan | on
+ enable_sort | on
+ enable_tidscan | on
+ client_min_messages | log
+(30 rows)
+
+SET pg_hint_plan.parse_messages TO error;
+EXPLAIN (COSTS false) EXECUTE p2;
+ERROR: prepared statement "p2" does not exist
+EXPLAIN (COSTS false) EXECUTE p1;
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Sort
+ Sort Key: t1.c1
+ -> Seq Scan on t1
+ -> Index Scan using t2_i1 on t2
+(6 rows)
+
+SELECT name, setting FROM settings;
+ name | setting
+---------------------------+-----------
+ geqo | on
+ geqo_effort | 5
+ geqo_generations | 0
+ geqo_pool_size | 0
+ geqo_seed | 0
+ geqo_selection_bias | 2
+ geqo_threshold | 12
+ constraint_exclusion | partition
+ cursor_tuple_fraction | 0.1
+ default_statistics_target | 100
+ from_collapse_limit | 8
+ join_collapse_limit | 8
+ cpu_index_tuple_cost | 0.005
+ cpu_operator_cost | 0.0025
+ cpu_tuple_cost | 0.01
+ effective_cache_size | 16384
+ random_page_cost | 4
+ seq_page_cost | 1
+ enable_bitmapscan | on
+ enable_hashagg | on
+ enable_hashjoin | on
+ enable_indexonlyscan | on
+ enable_indexscan | on
+ enable_material | on
+ enable_mergejoin | on
+ enable_nestloop | on
+ enable_seqscan | on
+ enable_sort | on
+ enable_tidscan | on
+ client_min_messages | log
+(30 rows)
+
+DEALLOCATE p1;
+SET pg_hint_plan.parse_messages TO LOG;
+----
+---- No. A-12-3 effective range of the hint
+----
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(6 rows)
+
+-- No. A-12-3-1
+SET enable_indexscan TO off;
+SET enable_mergejoin TO off;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+SELECT name, setting FROM settings;
+ name | setting
+---------------------------+-----------
+ geqo | on
+ geqo_effort | 5
+ geqo_generations | 0
+ geqo_pool_size | 0
+ geqo_seed | 0
+ geqo_selection_bias | 2
+ geqo_threshold | 12
+ constraint_exclusion | partition
+ cursor_tuple_fraction | 0.1
+ default_statistics_target | 100
+ from_collapse_limit | 8
+ join_collapse_limit | 8
+ cpu_index_tuple_cost | 0.005
+ cpu_operator_cost | 0.0025
+ cpu_tuple_cost | 0.01
+ effective_cache_size | 16384
+ random_page_cost | 4
+ seq_page_cost | 1
+ enable_bitmapscan | on
+ enable_hashagg | on
+ enable_hashjoin | on
+ enable_indexonlyscan | on
+ enable_indexscan | off
+ enable_material | on
+ enable_mergejoin | off
+ enable_nestloop | on
+ enable_seqscan | on
+ enable_sort | on
+ enable_tidscan | on
+ client_min_messages | log
+(30 rows)
+
+/*+Set(enable_indexscan on)Set(geqo_threshold 100)IndexScan(t2)MergeJoin(t1 t2)Leading(t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+IndexScan(t2)
+MergeJoin(t1 t2)
+Leading(t2 t1)
+Set(enable_indexscan on)
+Set(geqo_threshold 100)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t2_i1 on t2
+(4 rows)
+
+SELECT name, setting FROM settings;
+ name | setting
+---------------------------+-----------
+ geqo | on
+ geqo_effort | 5
+ geqo_generations | 0
+ geqo_pool_size | 0
+ geqo_seed | 0
+ geqo_selection_bias | 2
+ geqo_threshold | 12
+ constraint_exclusion | partition
+ cursor_tuple_fraction | 0.1
+ default_statistics_target | 100
+ from_collapse_limit | 8
+ join_collapse_limit | 8
+ cpu_index_tuple_cost | 0.005
+ cpu_operator_cost | 0.0025
+ cpu_tuple_cost | 0.01
+ effective_cache_size | 16384
+ random_page_cost | 4
+ seq_page_cost | 1
+ enable_bitmapscan | on
+ enable_hashagg | on
+ enable_hashjoin | on
+ enable_indexonlyscan | on
+ enable_indexscan | off
+ enable_material | on
+ enable_mergejoin | off
+ enable_nestloop | on
+ enable_seqscan | on
+ enable_sort | on
+ enable_tidscan | on
+ client_min_messages | log
+(30 rows)
+
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+-- No. A-12-3-2
+SET enable_indexscan TO off;
+SET enable_mergejoin TO off;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+SELECT name, setting FROM settings;
+ name | setting
+---------------------------+-----------
+ geqo | on
+ geqo_effort | 5
+ geqo_generations | 0
+ geqo_pool_size | 0
+ geqo_seed | 0
+ geqo_selection_bias | 2
+ geqo_threshold | 12
+ constraint_exclusion | partition
+ cursor_tuple_fraction | 0.1
+ default_statistics_target | 100
+ from_collapse_limit | 8
+ join_collapse_limit | 8
+ cpu_index_tuple_cost | 0.005
+ cpu_operator_cost | 0.0025
+ cpu_tuple_cost | 0.01
+ effective_cache_size | 16384
+ random_page_cost | 4
+ seq_page_cost | 1
+ enable_bitmapscan | on
+ enable_hashagg | on
+ enable_hashjoin | on
+ enable_indexonlyscan | on
+ enable_indexscan | off
+ enable_material | on
+ enable_mergejoin | off
+ enable_nestloop | on
+ enable_seqscan | on
+ enable_sort | on
+ enable_tidscan | on
+ client_min_messages | log
+(30 rows)
+
+BEGIN;
+/*+Set(enable_indexscan on)Set(geqo_threshold 100)IndexScan(t2)MergeJoin(t1 t2)Leading(t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+IndexScan(t2)
+MergeJoin(t1 t2)
+Leading(t2 t1)
+Set(enable_indexscan on)
+Set(geqo_threshold 100)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t2_i1 on t2
+(4 rows)
+
+COMMIT;
+BEGIN;
+SELECT name, setting FROM settings;
+ name | setting
+---------------------------+-----------
+ geqo | on
+ geqo_effort | 5
+ geqo_generations | 0
+ geqo_pool_size | 0
+ geqo_seed | 0
+ geqo_selection_bias | 2
+ geqo_threshold | 12
+ constraint_exclusion | partition
+ cursor_tuple_fraction | 0.1
+ default_statistics_target | 100
+ from_collapse_limit | 8
+ join_collapse_limit | 8
+ cpu_index_tuple_cost | 0.005
+ cpu_operator_cost | 0.0025
+ cpu_tuple_cost | 0.01
+ effective_cache_size | 16384
+ random_page_cost | 4
+ seq_page_cost | 1
+ enable_bitmapscan | on
+ enable_hashagg | on
+ enable_hashjoin | on
+ enable_indexonlyscan | on
+ enable_indexscan | off
+ enable_material | on
+ enable_mergejoin | off
+ enable_nestloop | on
+ enable_seqscan | on
+ enable_sort | on
+ enable_tidscan | on
+ client_min_messages | log
+(30 rows)
+
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+COMMIT;
+-- No. A-12-3-3
+SET enable_indexscan TO off;
+SET enable_mergejoin TO off;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+SELECT name, setting FROM settings;
+ name | setting
+---------------------------+-----------
+ geqo | on
+ geqo_effort | 5
+ geqo_generations | 0
+ geqo_pool_size | 0
+ geqo_seed | 0
+ geqo_selection_bias | 2
+ geqo_threshold | 12
+ constraint_exclusion | partition
+ cursor_tuple_fraction | 0.1
+ default_statistics_target | 100
+ from_collapse_limit | 8
+ join_collapse_limit | 8
+ cpu_index_tuple_cost | 0.005
+ cpu_operator_cost | 0.0025
+ cpu_tuple_cost | 0.01
+ effective_cache_size | 16384
+ random_page_cost | 4
+ seq_page_cost | 1
+ enable_bitmapscan | on
+ enable_hashagg | on
+ enable_hashjoin | on
+ enable_indexonlyscan | on
+ enable_indexscan | off
+ enable_material | on
+ enable_mergejoin | off
+ enable_nestloop | on
+ enable_seqscan | on
+ enable_sort | on
+ enable_tidscan | on
+ client_min_messages | log
+(30 rows)
+
+/*+Set(enable_indexscan on)Set(geqo_threshold 100)IndexScan(t2)MergeJoin(t1 t2)Leading(t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+IndexScan(t2)
+MergeJoin(t1 t2)
+Leading(t2 t1)
+Set(enable_indexscan on)
+Set(geqo_threshold 100)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t2_i1 on t2
+(4 rows)
+
+\connect
+SET enable_indexscan TO off;
+SET enable_mergejoin TO off;
+LOAD 'pg_hint_plan';
+SELECT name, setting FROM settings;
+ name | setting
+---------------------------+-----------
+ geqo | on
+ geqo_effort | 5
+ geqo_generations | 0
+ geqo_pool_size | 0
+ geqo_seed | 0
+ geqo_selection_bias | 2
+ geqo_threshold | 12
+ constraint_exclusion | partition
+ cursor_tuple_fraction | 0.1
+ default_statistics_target | 100
+ from_collapse_limit | 8
+ join_collapse_limit | 8
+ cpu_index_tuple_cost | 0.005
+ cpu_operator_cost | 0.0025
+ cpu_tuple_cost | 0.01
+ effective_cache_size | 16384
+ random_page_cost | 4
+ seq_page_cost | 1
+ enable_bitmapscan | on
+ enable_hashagg | on
+ enable_hashjoin | on
+ enable_indexonlyscan | on
+ enable_indexscan | off
+ enable_material | on
+ enable_mergejoin | off
+ enable_nestloop | on
+ enable_seqscan | on
+ enable_sort | on
+ enable_tidscan | on
+ client_min_messages | notice
+(30 rows)
+
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+SET pg_hint_plan.enable_hint TO on;
+SET pg_hint_plan.debug_print TO on;
+SET client_min_messages TO LOG;
+SET search_path TO public;
+RESET enable_indexscan;
+RESET enable_mergejoin;
+----
+---- No. A-13 call planner recursively
+----
+CREATE OR REPLACE FUNCTION nested_planner(cnt int) RETURNS int AS $$
+DECLARE
+ new_cnt int;
+BEGIN
+ RAISE NOTICE 'nested_planner(%)', cnt;
+
+ /* 再帰終了の判断 */
+ IF cnt <= 1 THEN
+ RETURN 0;
+ END IF;
+
+ EXECUTE '/*+ IndexScan(t_1) */'
+ ' SELECT nested_planner($1) FROM s1.t1 t_1'
+ ' JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)'
+ ' ORDER BY t_1.c1 LIMIT 1'
+ INTO new_cnt USING cnt - 1;
+
+ RETURN new_cnt;
+END;
+$$ LANGUAGE plpgsql IMMUTABLE;
+----
+---- No. A-13-2 use hint of main query
+----
+--No.13-2-1
+EXPLAIN (COSTS false) SELECT nested_planner(1) FROM s1.t1 t_1 ORDER BY t_1.c1;
+NOTICE: nested_planner(1)
+ QUERY PLAN
+---------------------------------------
+ Index Only Scan using t1_i1 on t1 t_1
+(1 row)
+
+/*+SeqScan(t_1)*/
+EXPLAIN (COSTS false) SELECT nested_planner(1) FROM s1.t1 t_1 ORDER BY t_1.c1;
+NOTICE: nested_planner(1)
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t_1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------
+ Sort
+ Sort Key: c1
+ -> Seq Scan on t1 t_1
+(3 rows)
+
+----
+---- No. A-13-3 output number of times of debugging log
+----
+--No.13-3-1
+EXPLAIN (COSTS false) SELECT nested_planner(1) FROM s1.t1 t_1 ORDER BY t_1.c1;
+NOTICE: nested_planner(1)
+ QUERY PLAN
+---------------------------------------
+ Index Only Scan using t1_i1 on t1 t_1
+(1 row)
+
+/*+SeqScan(t_2)*/
+EXPLAIN (COSTS false) SELECT nested_planner(1) FROM s1.t1 t_1 ORDER BY t_1.c1;
+NOTICE: nested_planner(1)
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+SeqScan(t_2)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------
+ Index Only Scan using t1_i1 on t1 t_1
+(1 row)
+
+--No.13-3-2
+EXPLAIN (COSTS false) SELECT nested_planner(2) FROM s1.t1 t_1 ORDER BY t_1.c1;
+NOTICE: nested_planner(2)
+NOTICE: nested_planner(1)
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+ QUERY PLAN
+---------------------------------------
+ Index Only Scan using t1_i1 on t1 t_1
+(1 row)
+
+/*+SeqScan(t_2)*/
+EXPLAIN (COSTS false) SELECT nested_planner(2) FROM s1.t1 t_1 ORDER BY t_1.c1;
+NOTICE: nested_planner(2)
+NOTICE: nested_planner(1)
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t_2)
+not used hint:
+duplication hint:
+error hint:
+
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+SeqScan(t_2)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------
+ Index Only Scan using t1_i1 on t1 t_1
+(1 row)
+
+--No.13-3-3
+EXPLAIN (COSTS false) SELECT nested_planner(5) FROM s1.t1 t_1 ORDER BY t_1.c1;
+NOTICE: nested_planner(5)
+NOTICE: nested_planner(4)
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+NOTICE: nested_planner(3)
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+NOTICE: nested_planner(2)
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+NOTICE: nested_planner(1)
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+ QUERY PLAN
+---------------------------------------
+ Index Only Scan using t1_i1 on t1 t_1
+(1 row)
+
+/*+SeqScan(t_2)*/
+EXPLAIN (COSTS false) SELECT nested_planner(5) FROM s1.t1 t_1 ORDER BY t_1.c1;
+NOTICE: nested_planner(5)
+NOTICE: nested_planner(4)
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+NOTICE: nested_planner(3)
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+NOTICE: nested_planner(2)
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+NOTICE: nested_planner(1)
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t_2)
+not used hint:
+duplication hint:
+error hint:
+
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t_2)
+not used hint:
+duplication hint:
+error hint:
+
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t_2)
+not used hint:
+duplication hint:
+error hint:
+
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t_2)
+not used hint:
+duplication hint:
+error hint:
+
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+SeqScan(t_2)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------
+ Index Only Scan using t1_i1 on t1 t_1
+(1 row)
+
+----
+---- No. A-13-4 output of debugging log on hint status
+----
+--No.13-4-1
+/*+HashJoin(t_1 t_2)*/
+EXPLAIN (COSTS false)
+ SELECT nested_planner(2) FROM s1.t1 t_1
+ JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+ ORDER BY t_1.c1;
+NOTICE: nested_planner(2)
+NOTICE: nested_planner(1)
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t_1 t_2)
+not used hint:
+duplication hint:
+error hint:
+
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t_1 t_2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------
+ Sort
+ Sort Key: t_1.c1
+ -> Hash Join
+ Hash Cond: (t_1.c1 = t_2.c1)
+ -> Seq Scan on t1 t_1
+ -> Hash
+ -> Seq Scan on t2 t_2
+(7 rows)
+
+--No.13-4-2
+/*+HashJoin(st_1 st_2)*/
+EXPLAIN (COSTS false)
+ SELECT nested_planner(2) FROM s1.t1 st_1
+ JOIN s1.t2 st_2 ON (st_1.c1 = st_2.c1)
+ ORDER BY st_1.c1;
+NOTICE: nested_planner(2)
+NOTICE: nested_planner(1)
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+HashJoin(st_1 st_2)
+duplication hint:
+error hint:
+
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+HashJoin(st_1 st_2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------
+ Sort
+ Sort Key: st_1.c1
+ -> Hash Join
+ Hash Cond: (st_1.c1 = st_2.c1)
+ -> Seq Scan on t1 st_1
+ -> Hash
+ -> Seq Scan on t2 st_2
+(7 rows)
+
+--No.13-4-3
+/*+HashJoin(t_1 t_2)*/
+EXPLAIN (COSTS false)
+ SELECT nested_planner(2) FROM s1.t1 st_1
+ JOIN s1.t2 st_2 ON (st_1.c1 = st_2.c1)
+ ORDER BY st_1.c1;
+NOTICE: nested_planner(2)
+NOTICE: nested_planner(1)
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t_1 t_2)
+not used hint:
+duplication hint:
+error hint:
+
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+HashJoin(t_1 t_2)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------
+ Merge Join
+ Merge Cond: (st_1.c1 = st_2.c1)
+ -> Index Only Scan using t1_i1 on t1 st_1
+ -> Sort
+ Sort Key: st_2.c1
+ -> Seq Scan on t2 st_2
+(6 rows)
+
+--No.13-4-4
+/*+HashJoin(st_1 st_2)*/
+EXPLAIN (COSTS false)
+ SELECT nested_planner(2) FROM s1.t1 t_1
+ JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+ ORDER BY t_1.c1;
+NOTICE: nested_planner(2)
+NOTICE: nested_planner(1)
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+HashJoin(st_1 st_2)
+duplication hint:
+error hint:
+
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+HashJoin(st_1 st_2)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------
+ Merge Join
+ Merge Cond: (t_1.c1 = t_2.c1)
+ -> Index Only Scan using t1_i1 on t1 t_1
+ -> Sort
+ Sort Key: t_2.c1
+ -> Seq Scan on t2 t_2
+(6 rows)
+
+--No.13-4-5
+/*+HashJoin(t_1 t_1)*/
+EXPLAIN (COSTS false)
+ SELECT nested_planner(2) FROM s1.t1 t_1
+ ORDER BY t_1.c1;
+NOTICE: nested_planner(2)
+NOTICE: nested_planner(1)
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+INFO: hint syntax error at or near "HashJoin(t_1 t_1)"
+DETAIL: Relation name "t_1" is duplicated.
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+HashJoin(t_1 t_1)
+
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+HashJoin(t_1 t_1)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------
+ Index Only Scan using t1_i1 on t1 t_1
+(1 row)
+
+--No.13-4-6
+CREATE OR REPLACE FUNCTION nested_planner_one_t(cnt int) RETURNS int AS $$
+DECLARE
+ new_cnt int;
+BEGIN
+ RAISE NOTICE 'nested_planner_one_t(%)', cnt;
+
+ IF cnt <= 1 THEN
+ RETURN 0;
+ END IF;
+
+ EXECUTE '/*+ IndexScan(t_1) */'
+ ' SELECT nested_planner_one_t($1) FROM s1.t1 t_1'
+ ' ORDER BY t_1.c1 LIMIT 1'
+ INTO new_cnt USING cnt - 1;
+
+ RETURN new_cnt;
+END;
+$$ LANGUAGE plpgsql IMMUTABLE;
+EXPLAIN (COSTS false)
+ SELECT nested_planner_one_t(2) FROM s1.t1 t_1
+ JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+ ORDER BY t_1.c1;
+NOTICE: nested_planner_one_t(2)
+NOTICE: nested_planner_one_t(1)
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner_one_t($1) FROM s1.t1 t_1 ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner_one_t(integer) line 11 at EXECUTE statement
+ QUERY PLAN
+---------------------------------------------
+ Merge Join
+ Merge Cond: (t_1.c1 = t_2.c1)
+ -> Index Only Scan using t1_i1 on t1 t_1
+ -> Sort
+ Sort Key: t_2.c1
+ -> Seq Scan on t2 t_2
+(6 rows)
+
+/*+HashJoin(t_1 t_1)*/
+EXPLAIN (COSTS false)
+ SELECT nested_planner_one_t(2) FROM s1.t1 t_1
+ JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+ ORDER BY t_1.c1;
+NOTICE: nested_planner_one_t(2)
+NOTICE: nested_planner_one_t(1)
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner_one_t($1) FROM s1.t1 t_1 ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner_one_t(integer) line 11 at EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+HashJoin(t_1 t_1)
+duplication hint:
+error hint:
+
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner_one_t($1) FROM s1.t1 t_1 ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner_one_t(integer) line 11 at EXECUTE statement
+INFO: hint syntax error at or near "HashJoin(t_1 t_1)"
+DETAIL: Relation name "t_1" is duplicated.
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+HashJoin(t_1 t_1)
+
+ QUERY PLAN
+---------------------------------------------
+ Merge Join
+ Merge Cond: (t_1.c1 = t_2.c1)
+ -> Index Only Scan using t1_i1 on t1 t_1
+ -> Sort
+ Sort Key: t_2.c1
+ -> Seq Scan on t2 t_2
+(6 rows)
+
+DROP FUNCTION nested_planner_one_t(int);
+--No.13-4-7
+/*+HashJoin(t_1 t_1)*/
+EXPLAIN (COSTS false)
+ SELECT nested_planner(2) FROM s1.t1 t_1
+ JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+ ORDER BY t_1.c1;
+NOTICE: nested_planner(2)
+NOTICE: nested_planner(1)
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+INFO: hint syntax error at or near "HashJoin(t_1 t_1)"
+DETAIL: Relation name "t_1" is duplicated.
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+HashJoin(t_1 t_1)
+
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+INFO: hint syntax error at or near "HashJoin(t_1 t_1)"
+DETAIL: Relation name "t_1" is duplicated.
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+HashJoin(t_1 t_1)
+
+ QUERY PLAN
+---------------------------------------------
+ Merge Join
+ Merge Cond: (t_1.c1 = t_2.c1)
+ -> Index Only Scan using t1_i1 on t1 t_1
+ -> Sort
+ Sort Key: t_2.c1
+ -> Seq Scan on t2 t_2
+(6 rows)
+
+--No.13-4-8
+/*+MergeJoin(t_1 t_2)HashJoin(t_1 t_2)*/
+EXPLAIN (COSTS false)
+ SELECT nested_planner(2) FROM s1.t1 t_1
+ JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+ ORDER BY t_1.c1;
+INFO: hint syntax error at or near "MergeJoin(t_1 t_2)HashJoin(t_1 t_2)"
+DETAIL: Conflict join method hint.
+NOTICE: nested_planner(2)
+INFO: hint syntax error at or near "MergeJoin(t_1 t_2)HashJoin(t_1 t_2)"
+DETAIL: Conflict join method hint.
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+NOTICE: nested_planner(1)
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t_1 t_2)
+not used hint:
+duplication hint:
+MergeJoin(t_1 t_2)
+error hint:
+
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($1) FROM s1.t1 t_1 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1) ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t_1 t_2)
+not used hint:
+duplication hint:
+MergeJoin(t_1 t_2)
+error hint:
+
+ QUERY PLAN
+--------------------------------------
+ Sort
+ Sort Key: t_1.c1
+ -> Hash Join
+ Hash Cond: (t_1.c1 = t_2.c1)
+ -> Seq Scan on t1 t_1
+ -> Hash
+ -> Seq Scan on t2 t_2
+(7 rows)
+
--- /dev/null
+LOAD 'pg_hint_plan';
+SET pg_hint_plan.enable_hint TO on;
+SET pg_hint_plan.debug_print TO on;
+SET client_min_messages TO LOG;
+SET search_path TO public;
+----
+---- No. G-1-1 RULE definition table
+----
+-- No. G-1-1-1
+EXPLAIN (COSTS false) UPDATE s1.r1 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t2.c1 = t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(19 rows)
+
+/*+
+Set(enable_tidscan off)Set(enable_nestloop off)
+*/
+EXPLAIN (COSTS false) UPDATE s1.r1 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+Set(enable_nestloop off)
+Set(enable_tidscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (t1.c1 = t4.c1)
+ -> Hash Join
+ Hash Cond: (t2.c1 = t1.c1)
+ -> Hash Join
+ Hash Cond: (t3.c1 = t2.c1)
+ -> Seq Scan on t3
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t4
+ Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on r1
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+(21 rows)
+
+EXPLAIN (COSTS false) UPDATE s1.r1_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r1_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(19 rows)
+
+/*+
+Set(enable_tidscan off)Set(enable_nestloop off)
+*/
+EXPLAIN (COSTS false) UPDATE s1.r1_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+Set(enable_nestloop off)
+Set(enable_tidscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (b1t1.c1 = b1t4.c1)
+ -> Hash Join
+ Hash Cond: (b1t2.c1 = b1t1.c1)
+ -> Hash Join
+ Hash Cond: (b1t3.c1 = b1t2.c1)
+ -> Seq Scan on t3 b1t3
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t1 b1t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t4 b1t4
+ Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on r1_
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+(21 rows)
+
+-- No. G-1-1-2
+EXPLAIN (COSTS false) UPDATE s1.r2 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t2.c1 = t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r2
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t2.c1 = t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r2
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(39 rows)
+
+/*+
+Set(enable_tidscan off)Set(enable_nestloop off)
+*/
+EXPLAIN (COSTS false) UPDATE s1.r2 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+Set(enable_nestloop off)
+Set(enable_tidscan off)
+not used hint:
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+Set(enable_nestloop off)
+Set(enable_tidscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (t1.c1 = t4.c1)
+ -> Hash Join
+ Hash Cond: (t2.c1 = t1.c1)
+ -> Hash Join
+ Hash Cond: (t3.c1 = t2.c1)
+ -> Seq Scan on t3
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t4
+ Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on r2
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+
+ Aggregate
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (t1.c1 = t4.c1)
+ -> Hash Join
+ Hash Cond: (t2.c1 = t1.c1)
+ -> Hash Join
+ Hash Cond: (t3.c1 = t2.c1)
+ -> Seq Scan on t3
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t4
+ Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on r2
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+(43 rows)
+
+EXPLAIN (COSTS false) UPDATE s1.r2_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r2_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t2.c1 = b2t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r2_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(39 rows)
+
+/*+
+Set(enable_tidscan off)Set(enable_nestloop off)
+*/
+EXPLAIN (COSTS false) UPDATE s1.r2_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+Set(enable_nestloop off)
+Set(enable_tidscan off)
+not used hint:
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+Set(enable_nestloop off)
+Set(enable_tidscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (b1t1.c1 = b1t4.c1)
+ -> Hash Join
+ Hash Cond: (b1t2.c1 = b1t1.c1)
+ -> Hash Join
+ Hash Cond: (b1t3.c1 = b1t2.c1)
+ -> Seq Scan on t3 b1t3
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t1 b1t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t4 b1t4
+ Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on r2_
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+
+ Aggregate
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (b2t1.c1 = b2t4.c1)
+ -> Hash Join
+ Hash Cond: (b2t2.c1 = b2t1.c1)
+ -> Hash Join
+ Hash Cond: (b2t3.c1 = b2t2.c1)
+ -> Seq Scan on t3 b2t3
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t1 b2t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t4 b2t4
+ Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on r2_
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+(43 rows)
+
+-- No. G-1-1-3
+EXPLAIN (COSTS false) UPDATE s1.r3 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t2.c1 = t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r3
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t2.c1 = t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r3
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t2.c1 = t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r3
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(59 rows)
+
+/*+
+Set(enable_tidscan off)Set(enable_nestloop off)
+*/
+EXPLAIN (COSTS false) UPDATE s1.r3 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+Set(enable_nestloop off)
+Set(enable_tidscan off)
+not used hint:
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+Set(enable_nestloop off)
+Set(enable_tidscan off)
+not used hint:
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+Set(enable_nestloop off)
+Set(enable_tidscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (t1.c1 = t4.c1)
+ -> Hash Join
+ Hash Cond: (t2.c1 = t1.c1)
+ -> Hash Join
+ Hash Cond: (t3.c1 = t2.c1)
+ -> Seq Scan on t3
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t4
+ Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on r3
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+
+ Aggregate
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (t1.c1 = t4.c1)
+ -> Hash Join
+ Hash Cond: (t2.c1 = t1.c1)
+ -> Hash Join
+ Hash Cond: (t3.c1 = t2.c1)
+ -> Seq Scan on t3
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t4
+ Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on r3
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+
+ Aggregate
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (t1.c1 = t4.c1)
+ -> Hash Join
+ Hash Cond: (t2.c1 = t1.c1)
+ -> Hash Join
+ Hash Cond: (t3.c1 = t2.c1)
+ -> Seq Scan on t3
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t4
+ Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on r3
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+(65 rows)
+
+EXPLAIN (COSTS false) UPDATE s1.r3_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r3_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t2.c1 = b2t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r3_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t4.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t3.c1)
+ -> Nested Loop
+ Join Filter: (b3t2.c1 = b3t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r3_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(59 rows)
+
+/*+
+Set(enable_tidscan off)Set(enable_nestloop off)
+*/
+EXPLAIN (COSTS false) UPDATE s1.r3_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+Set(enable_nestloop off)
+Set(enable_tidscan off)
+not used hint:
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+Set(enable_nestloop off)
+Set(enable_tidscan off)
+not used hint:
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+Set(enable_nestloop off)
+Set(enable_tidscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (b1t1.c1 = b1t4.c1)
+ -> Hash Join
+ Hash Cond: (b1t2.c1 = b1t1.c1)
+ -> Hash Join
+ Hash Cond: (b1t3.c1 = b1t2.c1)
+ -> Seq Scan on t3 b1t3
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t1 b1t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t4 b1t4
+ Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on r3_
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+
+ Aggregate
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (b2t1.c1 = b2t4.c1)
+ -> Hash Join
+ Hash Cond: (b2t2.c1 = b2t1.c1)
+ -> Hash Join
+ Hash Cond: (b2t3.c1 = b2t2.c1)
+ -> Seq Scan on t3 b2t3
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t1 b2t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t4 b2t4
+ Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on r3_
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+
+ Aggregate
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (b3t1.c1 = b3t4.c1)
+ -> Hash Join
+ Hash Cond: (b3t2.c1 = b3t1.c1)
+ -> Hash Join
+ Hash Cond: (b3t3.c1 = b3t2.c1)
+ -> Seq Scan on t3 b3t3
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t1 b3t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t4 b3t4
+ Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on r3_
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+(65 rows)
+
+RESET client_min_messages;
+----
+---- No. G-2-2 category of GUC parameter and role
+----
+-- No. G-2-2-1
+SET ROLE super_user;
+/*+Set(block_size 16384)*/
+SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+INFO: parameter "block_size" cannot be changed
+ c1 | c2 | c3 | c4
+----+----+----+----
+ 1 | 1 | 1 | 1
+(1 row)
+
+-- No. G-2-2-2
+/*+Set(archive_mode off)*/
+SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+INFO: parameter "archive_mode" cannot be changed without restarting the server
+ c1 | c2 | c3 | c4
+----+----+----+----
+ 1 | 1 | 1 | 1
+(1 row)
+
+-- No. G-2-2-3
+/*+Set(archive_timeout 0)*/
+SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+INFO: parameter "archive_timeout" cannot be changed now
+ c1 | c2 | c3 | c4
+----+----+----+----
+ 1 | 1 | 1 | 1
+(1 row)
+
+-- No. G-2-2-4
+/*+Set(log_connections off)*/
+SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+INFO: parameter "log_connections" cannot be set after connection start
+ c1 | c2 | c3 | c4
+----+----+----+----
+ 1 | 1 | 1 | 1
+(1 row)
+
+-- No. G-2-2-5
+/*+Set(log_min_messages WARNING)*/
+SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ c1 | c2 | c3 | c4
+----+----+----+----
+ 1 | 1 | 1 | 1
+(1 row)
+
+RESET ROLE;
+-- No. G-2-2-6
+GRANT ALL ON SCHEMA s1 TO PUBLIC;
+GRANT SELECT ON ALL TABLES IN SCHEMA s1 TO normal_user;
+SET ROLE normal_user;
+/*+Set(log_min_messages WARNING)*/
+SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+INFO: permission denied to set parameter "log_min_messages"
+ c1 | c2 | c3 | c4
+----+----+----+----
+ 1 | 1 | 1 | 1
+(1 row)
+
+-- No. G-2-2-7
+/*+Set(enable_seqscan on)*/
+SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ c1 | c2 | c3 | c4
+----+----+----+----
+ 1 | 1 | 1 | 1
+(1 row)
+
+RESET ROLE;
+REVOKE SELECT ON ALL TABLES IN SCHEMA s1 FROM normal_user;
+REVOKE ALL ON SCHEMA s1 FROM PUBLIC;
+----
+---- No. G-2-3 conflict set hint
+----
+SET client_min_messages TO LOG;
+-- No. G-2-3-1
+/*+Set(enable_indexscan on)Set(enable_indexscan off)*/
+SELECT * FROM s1.t1 WHERE false;
+INFO: hint syntax error at or near "Set(enable_indexscan on)Set(enable_indexscan off)"
+DETAIL: Conflict set hint.
+LOG: pg_hint_plan:
+used hint:
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+Set(enable_indexscan on)
+error hint:
+
+ c1 | c2 | c3 | c4
+----+----+----+----
+(0 rows)
+
+-- No. G-2-3-2
+/*+Set(client_min_messages DEBUG5)Set(client_min_messages WARNING)Set(client_min_messages DEBUG2)*/
+SELECT * FROM s1.t1 WHERE false;
+INFO: hint syntax error at or near "Set(client_min_messages DEBUG5)Set(client_min_messages WARNING)Set(client_min_messages DEBUG2)"
+DETAIL: Conflict set hint.
+INFO: hint syntax error at or near "Set(client_min_messages WARNING)Set(client_min_messages DEBUG2)"
+DETAIL: Conflict set hint.
+LOG: pg_hint_plan:
+used hint:
+Set(client_min_messages DEBUG2)
+not used hint:
+duplication hint:
+Set(client_min_messages DEBUG5)
+Set(client_min_messages WARNING)
+error hint:
+
+ c1 | c2 | c3 | c4
+----+----+----+----
+(0 rows)
+
+-- No. G-2-3-3
+/*+Set(enable_indexscan on)Set(enable_indexscan o)*/
+SELECT * FROM s1.t1 WHERE false;
+INFO: hint syntax error at or near "Set(enable_indexscan on)Set(enable_indexscan o)"
+DETAIL: Conflict set hint.
+INFO: parameter "enable_indexscan" requires a Boolean value
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+Set(enable_indexscan on)
+error hint:
+Set(enable_indexscan o)
+
+ c1 | c2 | c3 | c4
+----+----+----+----
+(0 rows)
+
+-- No. G-2-3-4
+/*+Set(client_min_messages DEBUG5)Set(client_min_messages WARNING)Set(client_min_messages DEBU)*/
+SELECT * FROM s1.t1 WHERE false;
+INFO: hint syntax error at or near "Set(client_min_messages DEBUG5)Set(client_min_messages WARNING)Set(client_min_messages DEBU)"
+DETAIL: Conflict set hint.
+INFO: hint syntax error at or near "Set(client_min_messages WARNING)Set(client_min_messages DEBU)"
+DETAIL: Conflict set hint.
+INFO: invalid value for parameter "client_min_messages": "DEBU"
+HINT: Available values: debug5, debug4, debug3, debug2, debug1, log, notice, warning, error.
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+Set(client_min_messages DEBUG5)
+Set(client_min_messages WARNING)
+error hint:
+Set(client_min_messages DEBU)
+
+ c1 | c2 | c3 | c4
+----+----+----+----
+(0 rows)
+
+----
+---- No. G-2-4 debug message
+----
+-- No. G-2-4-1
+/*+SeqScan(a)IndexScan(a)SeqScan(c)NestLoop(a) */
+SELECT * FROM s1.t1 a, s1.t2 b WHERE false;
+INFO: hint syntax error at or near ") "
+DETAIL: NestLoop hint requires at least two relations.
+INFO: hint syntax error at or near "SeqScan(a)IndexScan(a)SeqScan(c)NestLoop(a) "
+DETAIL: Conflict scan method hint.
+LOG: pg_hint_plan:
+used hint:
+IndexScan(a)
+not used hint:
+SeqScan(c)
+duplication hint:
+SeqScan(a)
+error hint:
+NestLoop(a)
+
+ c1 | c2 | c3 | c4 | c1 | c2 | c3 | c4
+----+----+----+----+----+----+----+----
+(0 rows)
+
--- /dev/null
+LOAD 'pg_hint_plan';
+SET pg_hint_plan.enable_hint TO on;
+SET pg_hint_plan.debug_print TO on;
+SET client_min_messages TO LOG;
+SET search_path TO public;
+----
+---- No. G-1-1 RULE definition table
+----
+-- No. G-1-1-1
+EXPLAIN (COSTS false) UPDATE s1.r1 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(19 rows)
+
+/*+
+Set(enable_tidscan off)Set(enable_nestloop off)
+*/
+EXPLAIN (COSTS false) UPDATE s1.r1 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+Set(enable_nestloop off)
+Set(enable_tidscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (t1.c1 = t4.c1)
+ -> Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Hash Join
+ Hash Cond: (t3.c1 = t1.c1)
+ -> Seq Scan on t3
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t4
+ Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on r1
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+(21 rows)
+
+EXPLAIN (COSTS false) UPDATE s1.r1_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r1_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(19 rows)
+
+/*+
+Set(enable_tidscan off)Set(enable_nestloop off)
+*/
+EXPLAIN (COSTS false) UPDATE s1.r1_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+Set(enable_nestloop off)
+Set(enable_tidscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (b1t1.c1 = b1t4.c1)
+ -> Hash Join
+ Hash Cond: (b1t1.c1 = b1t2.c1)
+ -> Hash Join
+ Hash Cond: (b1t3.c1 = b1t1.c1)
+ -> Seq Scan on t3 b1t3
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t1 b1t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t4 b1t4
+ Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on r1_
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+(21 rows)
+
+-- No. G-1-1-2
+EXPLAIN (COSTS false) UPDATE s1.r2 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r2
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r2
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(39 rows)
+
+/*+
+Set(enable_tidscan off)Set(enable_nestloop off)
+*/
+EXPLAIN (COSTS false) UPDATE s1.r2 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+Set(enable_nestloop off)
+Set(enable_tidscan off)
+not used hint:
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+Set(enable_nestloop off)
+Set(enable_tidscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (t1.c1 = t4.c1)
+ -> Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Hash Join
+ Hash Cond: (t3.c1 = t1.c1)
+ -> Seq Scan on t3
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t4
+ Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on r2
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+
+ Aggregate
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (t1.c1 = t4.c1)
+ -> Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Hash Join
+ Hash Cond: (t3.c1 = t1.c1)
+ -> Seq Scan on t3
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t4
+ Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on r2
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+(43 rows)
+
+EXPLAIN (COSTS false) UPDATE s1.r2_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r2_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r2_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(39 rows)
+
+/*+
+Set(enable_tidscan off)Set(enable_nestloop off)
+*/
+EXPLAIN (COSTS false) UPDATE s1.r2_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+Set(enable_nestloop off)
+Set(enable_tidscan off)
+not used hint:
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+Set(enable_nestloop off)
+Set(enable_tidscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (b1t1.c1 = b1t4.c1)
+ -> Hash Join
+ Hash Cond: (b1t1.c1 = b1t2.c1)
+ -> Hash Join
+ Hash Cond: (b1t3.c1 = b1t1.c1)
+ -> Seq Scan on t3 b1t3
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t1 b1t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t4 b1t4
+ Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on r2_
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+
+ Aggregate
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (b2t1.c1 = b2t4.c1)
+ -> Hash Join
+ Hash Cond: (b2t1.c1 = b2t2.c1)
+ -> Hash Join
+ Hash Cond: (b2t3.c1 = b2t1.c1)
+ -> Seq Scan on t3 b2t3
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t1 b2t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t4 b2t4
+ Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on r2_
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+(43 rows)
+
+-- No. G-1-1-3
+EXPLAIN (COSTS false) UPDATE s1.r3 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r3
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r3
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r3
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(59 rows)
+
+/*+
+Set(enable_tidscan off)Set(enable_nestloop off)
+*/
+EXPLAIN (COSTS false) UPDATE s1.r3 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+Set(enable_nestloop off)
+Set(enable_tidscan off)
+not used hint:
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+Set(enable_nestloop off)
+Set(enable_tidscan off)
+not used hint:
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+Set(enable_nestloop off)
+Set(enable_tidscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (t1.c1 = t4.c1)
+ -> Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Hash Join
+ Hash Cond: (t3.c1 = t1.c1)
+ -> Seq Scan on t3
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t4
+ Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on r3
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+
+ Aggregate
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (t1.c1 = t4.c1)
+ -> Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Hash Join
+ Hash Cond: (t3.c1 = t1.c1)
+ -> Seq Scan on t3
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t4
+ Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on r3
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+
+ Aggregate
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (t1.c1 = t4.c1)
+ -> Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Hash Join
+ Hash Cond: (t3.c1 = t1.c1)
+ -> Seq Scan on t3
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t4
+ Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on r3
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+(65 rows)
+
+EXPLAIN (COSTS false) UPDATE s1.r3_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r3_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r3_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t4.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t3.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r3_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(59 rows)
+
+/*+
+Set(enable_tidscan off)Set(enable_nestloop off)
+*/
+EXPLAIN (COSTS false) UPDATE s1.r3_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+Set(enable_nestloop off)
+Set(enable_tidscan off)
+not used hint:
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+Set(enable_nestloop off)
+Set(enable_tidscan off)
+not used hint:
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+Set(enable_nestloop off)
+Set(enable_tidscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (b1t1.c1 = b1t4.c1)
+ -> Hash Join
+ Hash Cond: (b1t1.c1 = b1t2.c1)
+ -> Hash Join
+ Hash Cond: (b1t3.c1 = b1t1.c1)
+ -> Seq Scan on t3 b1t3
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t1 b1t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t4 b1t4
+ Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on r3_
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+
+ Aggregate
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (b2t1.c1 = b2t4.c1)
+ -> Hash Join
+ Hash Cond: (b2t1.c1 = b2t2.c1)
+ -> Hash Join
+ Hash Cond: (b2t3.c1 = b2t1.c1)
+ -> Seq Scan on t3 b2t3
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t1 b2t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t4 b2t4
+ Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on r3_
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+
+ Aggregate
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (b3t1.c1 = b3t4.c1)
+ -> Hash Join
+ Hash Cond: (b3t1.c1 = b3t2.c1)
+ -> Hash Join
+ Hash Cond: (b3t3.c1 = b3t1.c1)
+ -> Seq Scan on t3 b3t3
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t1 b3t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Seq Scan on t4 b3t4
+ Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on r3_
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+(65 rows)
+
+RESET client_min_messages;
+----
+---- No. G-2-2 category of GUC parameter and role
+----
+-- No. G-2-2-1
+SET ROLE super_user;
+/*+Set(block_size 16384)*/
+SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+INFO: parameter "block_size" cannot be changed
+ c1 | c2 | c3 | c4
+----+----+----+----
+ 1 | 1 | 1 | 1
+(1 row)
+
+-- No. G-2-2-2
+/*+Set(archive_mode off)*/
+SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+INFO: parameter "archive_mode" cannot be changed without restarting the server
+ c1 | c2 | c3 | c4
+----+----+----+----
+ 1 | 1 | 1 | 1
+(1 row)
+
+-- No. G-2-2-3
+/*+Set(archive_timeout 0)*/
+SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+INFO: parameter "archive_timeout" cannot be changed now
+ c1 | c2 | c3 | c4
+----+----+----+----
+ 1 | 1 | 1 | 1
+(1 row)
+
+-- No. G-2-2-4
+/*+Set(log_connections off)*/
+SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+INFO: parameter "log_connections" cannot be set after connection start
+ c1 | c2 | c3 | c4
+----+----+----+----
+ 1 | 1 | 1 | 1
+(1 row)
+
+-- No. G-2-2-5
+/*+Set(log_min_messages WARNING)*/
+SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ c1 | c2 | c3 | c4
+----+----+----+----
+ 1 | 1 | 1 | 1
+(1 row)
+
+RESET ROLE;
+-- No. G-2-2-6
+GRANT ALL ON SCHEMA s1 TO PUBLIC;
+GRANT SELECT ON ALL TABLES IN SCHEMA s1 TO normal_user;
+SET ROLE normal_user;
+/*+Set(log_min_messages WARNING)*/
+SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+INFO: permission denied to set parameter "log_min_messages"
+ c1 | c2 | c3 | c4
+----+----+----+----
+ 1 | 1 | 1 | 1
+(1 row)
+
+-- No. G-2-2-7
+/*+Set(enable_seqscan on)*/
+SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ c1 | c2 | c3 | c4
+----+----+----+----
+ 1 | 1 | 1 | 1
+(1 row)
+
+RESET ROLE;
+REVOKE SELECT ON ALL TABLES IN SCHEMA s1 FROM normal_user;
+REVOKE ALL ON SCHEMA s1 FROM PUBLIC;
+----
+---- No. G-2-3 conflict set hint
+----
+SET client_min_messages TO LOG;
+-- No. G-2-3-1
+/*+Set(enable_indexscan on)Set(enable_indexscan off)*/
+SELECT * FROM s1.t1 WHERE false;
+INFO: hint syntax error at or near "Set(enable_indexscan on)Set(enable_indexscan off)"
+DETAIL: Conflict set hint.
+LOG: pg_hint_plan:
+used hint:
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+Set(enable_indexscan on)
+error hint:
+
+ c1 | c2 | c3 | c4
+----+----+----+----
+(0 rows)
+
+-- No. G-2-3-2
+/*+Set(client_min_messages DEBUG5)Set(client_min_messages WARNING)Set(client_min_messages DEBUG2)*/
+SELECT * FROM s1.t1 WHERE false;
+INFO: hint syntax error at or near "Set(client_min_messages DEBUG5)Set(client_min_messages WARNING)Set(client_min_messages DEBUG2)"
+DETAIL: Conflict set hint.
+INFO: hint syntax error at or near "Set(client_min_messages WARNING)Set(client_min_messages DEBUG2)"
+DETAIL: Conflict set hint.
+LOG: pg_hint_plan:
+used hint:
+Set(client_min_messages DEBUG2)
+not used hint:
+duplication hint:
+Set(client_min_messages DEBUG5)
+Set(client_min_messages WARNING)
+error hint:
+
+ c1 | c2 | c3 | c4
+----+----+----+----
+(0 rows)
+
+-- No. G-2-3-3
+/*+Set(enable_indexscan on)Set(enable_indexscan o)*/
+SELECT * FROM s1.t1 WHERE false;
+INFO: hint syntax error at or near "Set(enable_indexscan on)Set(enable_indexscan o)"
+DETAIL: Conflict set hint.
+INFO: parameter "enable_indexscan" requires a Boolean value
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+Set(enable_indexscan on)
+error hint:
+Set(enable_indexscan o)
+
+ c1 | c2 | c3 | c4
+----+----+----+----
+(0 rows)
+
+-- No. G-2-3-4
+/*+Set(client_min_messages DEBUG5)Set(client_min_messages WARNING)Set(client_min_messages DEBU)*/
+SELECT * FROM s1.t1 WHERE false;
+INFO: hint syntax error at or near "Set(client_min_messages DEBUG5)Set(client_min_messages WARNING)Set(client_min_messages DEBU)"
+DETAIL: Conflict set hint.
+INFO: hint syntax error at or near "Set(client_min_messages WARNING)Set(client_min_messages DEBU)"
+DETAIL: Conflict set hint.
+INFO: invalid value for parameter "client_min_messages": "DEBU"
+HINT: Available values: debug5, debug4, debug3, debug2, debug1, log, notice, warning, error.
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+Set(client_min_messages DEBUG5)
+Set(client_min_messages WARNING)
+error hint:
+Set(client_min_messages DEBU)
+
+ c1 | c2 | c3 | c4
+----+----+----+----
+(0 rows)
+
+----
+---- No. G-2-4 debug message
+----
+-- No. G-2-4-1
+/*+SeqScan(a)IndexScan(a)SeqScan(c)NestLoop(a) */
+SELECT * FROM s1.t1 a, s1.t2 b WHERE false;
+INFO: hint syntax error at or near ") "
+DETAIL: NestLoop hint requires at least two relations.
+INFO: hint syntax error at or near "SeqScan(a)IndexScan(a)SeqScan(c)NestLoop(a) "
+DETAIL: Conflict scan method hint.
+LOG: pg_hint_plan:
+used hint:
+IndexScan(a)
+not used hint:
+SeqScan(c)
+duplication hint:
+SeqScan(a)
+error hint:
+NestLoop(a)
+
+ c1 | c2 | c3 | c4 | c1 | c2 | c3 | c4
+----+----+----+----+----+----+----+----
+(0 rows)
+
--- /dev/null
+LOAD 'pg_hint_plan';
+SET pg_hint_plan.enable_hint TO on;
+SET pg_hint_plan.debug_print TO on;
+SET client_min_messages TO LOG;
+SET search_path TO public;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(6 rows)
+
+----
+---- No. J-1-1 specified pattern of the object name
+----
+-- No. J-1-1-1
+/*+HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+-- No. J-1-1-2
+/*+HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 t_1, s1.t2 t_2 WHERE t_1.c1 = t_2.c1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+HashJoin(t1 t2)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------
+ Merge Join
+ Merge Cond: (t_1.c1 = t_2.c1)
+ -> Index Scan using t1_i1 on t1 t_1
+ -> Sort
+ Sort Key: t_2.c1
+ -> Seq Scan on t2 t_2
+(6 rows)
+
+-- No. J-1-1-3
+/*+HashJoin(t_1 t_2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 t_1, s1.t2 t_2 WHERE t_1.c1 = t_2.c1;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t_1 t_2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------
+ Hash Join
+ Hash Cond: (t_1.c1 = t_2.c1)
+ -> Seq Scan on t1 t_1
+ -> Hash
+ -> Seq Scan on t2 t_2
+(5 rows)
+
+----
+---- No. J-1-2 specified schema name in the hint option
+----
+-- No. J-1-2-1
+/*+HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+-- No. J-1-2-2
+/*+HashJoin(s1.t1 s1.t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+HashJoin(s1.t1 s1.t2)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(6 rows)
+
+----
+---- No. J-1-3 table doesn't exist in the hint option
+----
+-- No. J-1-3-1
+/*+HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+-- No. J-1-3-2
+/*+HashJoin(t3 t4)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+HashJoin(t3 t4)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(6 rows)
+
+----
+---- No. J-1-4 conflict table name
+----
+-- No. J-1-4-1
+/*+HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+-- No. J-1-4-2
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s2.t1 WHERE s1.t1.c1 = s2.t1.c1;
+ QUERY PLAN
+-------------------------------------
+ Merge Join
+ Merge Cond: (s1.t1.c1 = s2.t1.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: s2.t1.c1
+ -> Seq Scan on t1
+(6 rows)
+
+/*+HashJoin(t1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s2.t1 WHERE s1.t1.c1 = s2.t1.c1;
+INFO: hint syntax error at or near "HashJoin(t1 t1)"
+DETAIL: Relation name "t1" is ambiguous.
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+HashJoin(t1 t1)
+
+ QUERY PLAN
+-------------------------------------
+ Merge Join
+ Merge Cond: (s1.t1.c1 = s2.t1.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: s2.t1.c1
+ -> Seq Scan on t1
+(6 rows)
+
+/*+HashJoin(s1.t1 s2.t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s2.t1 WHERE s1.t1.c1 = s2.t1.c1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+HashJoin(s1.t1 s2.t1)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------
+ Merge Join
+ Merge Cond: (s1.t1.c1 = s2.t1.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: s2.t1.c1
+ -> Seq Scan on t1
+(6 rows)
+
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s2.t1 s2t1 WHERE s1.t1.c1 = s2t1.c1;
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = s2t1.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: s2t1.c1
+ -> Seq Scan on t1 s2t1
+(6 rows)
+
+/*+HashJoin(t1 s2t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s2.t1 s2t1 WHERE s1.t1.c1 = s2t1.c1;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(s2t1 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = s2t1.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t1 s2t1
+(5 rows)
+
+-- No. J-1-4-3
+EXPLAIN (COSTS false) SELECT *, (SELECT max(t1.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+ QUERY PLAN
+---------------------------------------------------
+ Merge Join
+ Merge Cond: (s1.t1.c1 = s1.t2.c1)
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (s1.t1.c1 = s1.t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: s1.t2.c1
+ -> Seq Scan on t2
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: s1.t2.c1
+ -> Seq Scan on t2
+(14 rows)
+
+/*+HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT *, (SELECT max(t1.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------
+ Hash Join
+ Hash Cond: (s1.t1.c1 = s1.t2.c1)
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Hash Join
+ Hash Cond: (s1.t1.c1 = s1.t2.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(12 rows)
+
+/*+NestLoop(st1 st2)HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT *, (SELECT max(st1.c1) FROM s1.t1 st1, s1.t2 st2 WHERE st1.c1 = st2.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+NestLoop(st1 st2)
+HashJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ InitPlan 1 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ -> Seq Scan on t2 st2
+ -> Index Scan using t1_i1 on t1 st1
+ Index Cond: (c1 = st2.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(11 rows)
+
+----
+---- No. J-1-5 conflict table name
+----
+-- No. J-1-5-1
+/*+HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+-- No. J-1-5-2
+/*+HashJoin(t1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+INFO: hint syntax error at or near "HashJoin(t1 t1)"
+DETAIL: Relation name "t1" is duplicated.
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+HashJoin(t1 t1)
+
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(6 rows)
+
+-- No. J-1-5-3
+/*+HashJoin(t1 t1)HashJoin(t2 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+INFO: hint syntax error at or near "HashJoin(t1 t1)HashJoin(t2 t2)"
+DETAIL: Relation name "t1" is duplicated.
+INFO: hint syntax error at or near "HashJoin(t2 t2)"
+DETAIL: Relation name "t2" is duplicated.
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+HashJoin(t1 t1)
+HashJoin(t2 t2)
+
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(6 rows)
+
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+ QUERY PLAN
+------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t3.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t3_i1 on t3
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(9 rows)
+
+/*+HashJoin(t1 t2 t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+INFO: hint syntax error at or near "HashJoin(t1 t2 t1 t2)"
+DETAIL: Relation name "t1" is duplicated.
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+HashJoin(t1 t1 t2 t2)
+
+ QUERY PLAN
+------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t4.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t3.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t3_i1 on t3
+ -> Index Scan using t4_i1 on t4
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(12 rows)
+
+----
+---- No. J-1-6 object type for the hint
+----
+-- No. J-1-6-1
+/*+HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+-- No. J-1-6-2
+EXPLAIN (COSTS false) SELECT * FROM s1.p1 t1, s1.p1 t2 WHERE t1.c1 = t2.c1;
+ QUERY PLAN
+---------------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Append
+ -> Seq Scan on p1 t1
+ -> Seq Scan on p1c1 t1
+ -> Seq Scan on p1c2 t1
+ -> Seq Scan on p1c3 t1
+ -> Hash
+ -> Append
+ -> Seq Scan on p1 t2
+ -> Seq Scan on p1c1 t2
+ -> Seq Scan on p1c2 t2
+ -> Seq Scan on p1c3 t2
+(13 rows)
+
+/*+NestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.p1 t1, s1.p1 t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+NestLoop(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------
+ Nested Loop
+ Join Filter: (t1.c1 = t2.c1)
+ -> Append
+ -> Seq Scan on p1 t1
+ -> Seq Scan on p1c1 t1
+ -> Seq Scan on p1c2 t1
+ -> Seq Scan on p1c3 t1
+ -> Append
+ -> Index Scan using p1_i on p1 t2
+ Index Cond: ((c1 = t1.c1) AND (c1 = t1.c1))
+ -> Index Scan using p1c1_i on p1c1 t2
+ Index Cond: ((c1 = t1.c1) AND (c1 = t1.c1))
+ -> Index Scan using p1c2_i on p1c2 t2
+ Index Cond: ((c1 = t1.c1) AND (c1 = t1.c1))
+ -> Index Scan using p1c3_i on p1c3 t2
+ Index Cond: ((c1 = t1.c1) AND (c1 = t1.c1))
+(16 rows)
+
+-- No. J-1-6-3
+EXPLAIN (COSTS false) SELECT * FROM s1.ul1 t1, s1.ul1 t2 WHERE t1.c1 = t2.c1;
+ QUERY PLAN
+--------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on ul1 t1
+ -> Hash
+ -> Seq Scan on ul1 t2
+(5 rows)
+
+/*+NestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ul1 t1, s1.ul1 t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+NestLoop(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------
+ Nested Loop
+ -> Seq Scan on ul1 t1
+ -> Index Scan using ul1_pkey on ul1 t2
+ Index Cond: (c1 = t1.c1)
+(4 rows)
+
+-- No. J-1-6-4
+CREATE TEMP TABLE tm1 (LIKE s1.t1 INCLUDING ALL);
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "tm1_pkey" for table "tm1"
+EXPLAIN (COSTS false) SELECT * FROM tm1 t1, tm1 t2 WHERE t1.c1 = t2.c1;
+ QUERY PLAN
+--------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on tm1 t1
+ -> Hash
+ -> Seq Scan on tm1 t2
+(5 rows)
+
+/*+NestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM tm1 t1, tm1 t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+NestLoop(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------
+ Nested Loop
+ -> Seq Scan on tm1 t1
+ -> Index Scan using tm1_pkey on tm1 t2
+ Index Cond: (c1 = t1.c1)
+(4 rows)
+
+-- No. J-1-6-5
+EXPLAIN (COSTS false) SELECT * FROM pg_catalog.pg_class t1, pg_catalog.pg_class t2 WHERE t1.oid = t2.oid;
+ QUERY PLAN
+-------------------------------------
+ Hash Join
+ Hash Cond: (t1.oid = t2.oid)
+ -> Seq Scan on pg_class t1
+ -> Hash
+ -> Seq Scan on pg_class t2
+(5 rows)
+
+/*+NestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM pg_catalog.pg_class t1, pg_catalog.pg_class t2 WHERE t1.oid = t2.oid;
+LOG: pg_hint_plan:
+used hint:
+NestLoop(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------------------
+ Nested Loop
+ -> Seq Scan on pg_class t1
+ -> Index Scan using pg_class_oid_index on pg_class t2
+ Index Cond: (oid = t1.oid)
+(4 rows)
+
+-- No. J-1-6-6
+-- refer ut-fdw.sql
+-- No. J-1-6-7
+EXPLAIN (COSTS false) SELECT * FROM s1.f1() t1, s1.f1() t2 WHERE t1.c1 = t2.c1;
+ QUERY PLAN
+--------------------------------
+ Nested Loop
+ Join Filter: (t1.c1 = t2.c1)
+ -> Function Scan on f1 t1
+ -> Function Scan on f1 t2
+(4 rows)
+
+/*+HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.f1() t1, s1.f1() t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Function Scan on f1 t1
+ -> Hash
+ -> Function Scan on f1 t2
+(5 rows)
+
+-- No. J-1-6-8
+EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1'), (2,2,2,'2'), (3,3,3,'3')) AS t1 (c1, c2, c3, c4), s1.t2 WHERE t1.c1 = t2.c1;
+ QUERY PLAN
+-------------------------------------------
+ Hash Join
+ Hash Cond: (t2.c1 = "*VALUES*".column1)
+ -> Seq Scan on t2
+ -> Hash
+ -> Values Scan on "*VALUES*"
+(5 rows)
+
+/*+NestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1'), (2,2,2,'2'), (3,3,3,'3')) AS t1 (c1, c2, c3, c4), s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+NestLoop(t1 t2)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------
+ Hash Join
+ Hash Cond: (t2.c1 = "*VALUES*".column1)
+ -> Seq Scan on t2
+ -> Hash
+ -> Values Scan on "*VALUES*"
+(5 rows)
+
+/*+NestLoop(*VALUES* t2)*/
+EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1'), (2,2,2,'2'), (3,3,3,'3')) AS t1 (c1, c2, c3, c4), s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+NestLoop(*VALUES* t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------
+ Nested Loop
+ Join Filter: ("*VALUES*".column1 = t2.c1)
+ -> Seq Scan on t2
+ -> Materialize
+ -> Values Scan on "*VALUES*"
+(5 rows)
+
+-- No. J-1-6-9
+EXPLAIN (COSTS false) WITH c1(c1) AS (SELECT max(t1.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1) SELECT * FROM s1.t1, c1 WHERE t1.c1 = c1.c1;
+ QUERY PLAN
+--------------------------------------------------
+ Nested Loop
+ CTE c1
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (s1.t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+ -> CTE Scan on c1
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = c1.c1)
+(12 rows)
+
+/*+NestLoop(t1 t2)HashJoin(t1 c1)*/
+EXPLAIN (COSTS false) WITH c1(c1) AS (SELECT max(t1.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1) SELECT * FROM s1.t1, c1 WHERE t1.c1 = c1.c1;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(c1 t1)
+NestLoop(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------
+ Hash Join
+ Hash Cond: (s1.t1.c1 = c1.c1)
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ -> Seq Scan on t2
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = t2.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> CTE Scan on c1
+(11 rows)
+
+-- No. J-1-6-10
+EXPLAIN (COSTS false) SELECT * FROM s1.v1 t1, s1.v1 t2 WHERE t1.c1 = t2.c1;
+ QUERY PLAN
+----------------------------------
+ Hash Join
+ Hash Cond: (v1t1.c1 = v1t1.c1)
+ -> Seq Scan on t1 v1t1
+ -> Hash
+ -> Seq Scan on t1 v1t1
+(5 rows)
+
+/*+NestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.v1 t1, s1.v1 t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+NestLoop(t1 t2)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Hash Join
+ Hash Cond: (v1t1.c1 = v1t1.c1)
+ -> Seq Scan on t1 v1t1
+ -> Hash
+ -> Seq Scan on t1 v1t1
+(5 rows)
+
+/*+NestLoop(v1t1 v1t1_)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.v1 t1, s1.v1_ t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+NestLoop(v1t1 v1t1_)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Seq Scan on t1 v1t1
+ -> Index Scan using t1_i1 on t1 v1t1_
+ Index Cond: (c1 = v1t1.c1)
+(4 rows)
+
+-- No. J-1-6-11
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1 AND t1.c1 = (SELECT max(st1.c1) FROM s1.t1 st1, s1.t2 st2 WHERE st1.c1 = st2.c1);
+ QUERY PLAN
+------------------------------------------------------
+ Nested Loop
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (st1.c1 = st2.c1)
+ -> Index Scan using t1_i1 on t1 st1
+ -> Sort
+ Sort Key: st2.c1
+ -> Seq Scan on t2 st2
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = $0)
+ -> Seq Scan on t2
+ Filter: (c1 = $0)
+(13 rows)
+
+/*+MergeJoin(t1 t2)NestLoop(st1 st2)*/
+EXPLAIN (COSTS true) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1 AND t1.c1 = (SELECT max(st1.c1) FROM s1.t1 st1, s1.t2 st2 WHERE st1.c1 = st2.c1);
+LOG: pg_hint_plan:
+used hint:
+NestLoop(st1 st2)
+MergeJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------------------------------------------------
+ Nested Loop (cost=10000000074.28..10000000084.81 rows=1 width=29)
+ InitPlan 1 (returns $1)
+ -> Aggregate (cost=74.27..74.28 rows=1 width=4)
+ -> Nested Loop (cost=0.00..74.02 rows=100 width=4)
+ -> Seq Scan on t2 st2 (cost=0.00..2.00 rows=100 width=4)
+ -> Index Scan using t1_i1 on t1 st1 (cost=0.00..0.71 rows=1 width=4)
+ Index Cond: (c1 = st2.c1)
+ -> Index Scan using t1_i1 on t1 (cost=0.00..8.27 rows=1 width=15)
+ Index Cond: (c1 = $1)
+ -> Seq Scan on t2 (cost=0.00..2.25 rows=1 width=14)
+ Filter: (c1 = $1)
+(11 rows)
+
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, (SELECT t2.c1 FROM s1.t2) st2 WHERE t1.c1 = st2.c1;
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(6 rows)
+
+/*+HashJoin(t1 st2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, (SELECT t2.c1 FROM s1.t2) st2 WHERE t1.c1 = st2.c1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+HashJoin(st2 t1)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(6 rows)
+
+/*+HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, (SELECT t2.c1 FROM s1.t2) st2 WHERE t1.c1 = st2.c1;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+----
+---- No. J-2-1 complexity query block
+----
+-- No. J-2-1-1
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1), (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+;
+ QUERY PLAN
+-------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(47 rows)
+
+/*+
+Leading(bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2)
+MergeJoin(bmt1 bmt2)HashJoin(bmt1 bmt2 bmt3)NestLoop(bmt1 bmt2 bmt3 bmt4)
+MergeJoin(b1t2 b1t3)HashJoin(b1t2 b1t3 b1t4)NestLoop(b1t2 b1t3 b1t4 b1t1)
+MergeJoin(b2t3 b2t4)HashJoin(b2t3 b2t4 b2t1)NestLoop(b2t3 b2t4 b2t1 b2t2)
+*/
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1), (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+;
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(b1t2 b1t3)
+MergeJoin(b2t3 b2t4)
+MergeJoin(bmt1 bmt2)
+HashJoin(b1t2 b1t3 b1t4)
+HashJoin(b2t1 b2t3 b2t4)
+HashJoin(bmt1 bmt2 bmt3)
+NestLoop(b1t1 b1t2 b1t3 b1t4)
+NestLoop(b2t1 b2t2 b2t3 b2t4)
+NestLoop(bmt1 bmt2 bmt3 bmt4)
+Leading(bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t1.c1)
+ -> Hash Join
+ Hash Cond: (b1t4.c1 = b1t2.c1)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (b1t2.c1 = b1t3.c1)
+ -> Sort
+ Sort Key: b1t2.c1
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b1t3.c1
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Hash Join
+ Hash Cond: (b2t1.c1 = b2t3.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (b2t3.c1 = b2t4.c1)
+ -> Sort
+ Sort Key: b2t3.c1
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b2t4.c1
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Hash Join
+ Hash Cond: (bmt3.c1 = bmt1.c1)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt2.c1)
+ -> Sort
+ Sort Key: bmt1.c1
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: bmt2.c1
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(62 rows)
+
+-- No. J-2-1-2
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1), (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+), (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+;
+ QUERY PLAN
+-------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t4.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t3.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t2.c1)
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(63 rows)
+
+/*+
+Leading(bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2 b3t4 b3t1 b3t2 b3t3)
+MergeJoin(bmt1 bmt2)HashJoin(bmt1 bmt2 bmt3)NestLoop(bmt1 bmt2 bmt3 bmt4)
+MergeJoin(b1t2 b1t3)HashJoin(b1t2 b1t3 b1t4)NestLoop(b1t2 b1t3 b1t4 b1t1)
+MergeJoin(b2t3 b2t4)HashJoin(b2t3 b2t4 b2t1)NestLoop(b2t3 b2t4 b2t1 b2t2)
+MergeJoin(b3t4 b3t1)HashJoin(b3t4 b3t1 b3t2)NestLoop(b3t1 b3t2 b3t3 b3t4)
+*/
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1), (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+), (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+;
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(b1t2 b1t3)
+MergeJoin(b2t3 b2t4)
+MergeJoin(b3t1 b3t4)
+MergeJoin(bmt1 bmt2)
+HashJoin(b1t2 b1t3 b1t4)
+HashJoin(b2t1 b2t3 b2t4)
+HashJoin(b3t1 b3t2 b3t4)
+HashJoin(bmt1 bmt2 bmt3)
+NestLoop(b1t1 b1t2 b1t3 b1t4)
+NestLoop(b2t1 b2t2 b2t3 b2t4)
+NestLoop(b3t1 b3t2 b3t3 b3t4)
+NestLoop(bmt1 bmt2 bmt3 bmt4)
+Leading(bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2 b3t4 b3t1 b3t2 b3t3)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t1.c1)
+ -> Hash Join
+ Hash Cond: (b1t4.c1 = b1t2.c1)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (b1t2.c1 = b1t3.c1)
+ -> Sort
+ Sort Key: b1t2.c1
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b1t3.c1
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Hash Join
+ Hash Cond: (b2t1.c1 = b2t3.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (b2t3.c1 = b2t4.c1)
+ -> Sort
+ Sort Key: b2t3.c1
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b2t4.c1
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t3.c1)
+ -> Hash Join
+ Hash Cond: (b3t2.c1 = b3t1.c1)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (b3t1.c1 = b3t4.c1)
+ -> Sort
+ Sort Key: b3t1.c1
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b3t4.c1
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Hash Join
+ Hash Cond: (bmt3.c1 = bmt1.c1)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt2.c1)
+ -> Sort
+ Sort Key: bmt1.c1
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: bmt2.c1
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(83 rows)
+
+-- No. J-2-1-3
+EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, (SELECT ctid, * FROM s1.t3 bmt3) sbmt3, (SELECT ctid, * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = sbmt3.c1 AND sbmt3.ctid = '(1,1)' AND bmt1.c1 = sbmt4.c1 AND sbmt4.ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(15 rows)
+
+/*+
+Leading(bmt4 bmt3 bmt2 bmt1)
+MergeJoin(bmt4 bmt3)HashJoin(bmt4 bmt3 bmt2)NestLoop(bmt1 bmt2 bmt3 bmt4)
+*/
+EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, (SELECT ctid, * FROM s1.t3 bmt3) sbmt3, (SELECT ctid, * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = sbmt3.c1 AND sbmt3.ctid = '(1,1)' AND bmt1.c1 = sbmt4.c1 AND sbmt4.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(bmt3 bmt4)
+HashJoin(bmt2 bmt3 bmt4)
+NestLoop(bmt1 bmt2 bmt3 bmt4)
+Leading(bmt4 bmt3 bmt2 bmt1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (bmt2.c1 = bmt1.c1)
+ -> Hash Join
+ Hash Cond: (bmt2.c1 = bmt3.c1)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (bmt3.c1 = bmt4.c1)
+ -> Sort
+ Sort Key: bmt3.c1
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: bmt4.c1
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+(20 rows)
+
+-- No. J-2-1-4
+EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, (SELECT ctid, * FROM s1.t2 bmt2) sbmt2, (SELECT ctid, * FROM s1.t3 bmt3) sbmt3, (SELECT ctid, * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = sbmt2.c1 AND sbmt2.ctid = '(1,1)' AND bmt1.c1 = sbmt3.c1 AND sbmt3.ctid = '(1,1)' AND bmt1.c1 = sbmt4.c1 AND sbmt4.ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(15 rows)
+
+/*+
+Leading(bmt4 bmt3 bmt2 bmt1)
+MergeJoin(bmt4 bmt3)HashJoin(bmt4 bmt3 bmt2)NestLoop(bmt1 bmt2 bmt3 bmt4)
+*/
+EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, (SELECT ctid, * FROM s1.t2 bmt2) sbmt2, (SELECT ctid, * FROM s1.t3 bmt3) sbmt3, (SELECT ctid, * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = sbmt2.c1 AND sbmt2.ctid = '(1,1)' AND bmt1.c1 = sbmt3.c1 AND sbmt3.ctid = '(1,1)' AND bmt1.c1 = sbmt4.c1 AND sbmt4.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(bmt3 bmt4)
+HashJoin(bmt2 bmt3 bmt4)
+NestLoop(bmt1 bmt2 bmt3 bmt4)
+Leading(bmt4 bmt3 bmt2 bmt1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (bmt2.c1 = bmt1.c1)
+ -> Hash Join
+ Hash Cond: (bmt2.c1 = bmt3.c1)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (bmt3.c1 = bmt4.c1)
+ -> Sort
+ Sort Key: bmt3.c1
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: bmt4.c1
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+(20 rows)
+
+-- No. J-2-1-5
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+ AND bmt1.c1 <> (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+) AND bmt1.c1 <> (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+;
+ QUERY PLAN
+-------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 <> $0) AND (c1 <> $1))
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(48 rows)
+
+/*+
+Leading(bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2)
+MergeJoin(bmt1 bmt2)HashJoin(bmt1 bmt2 bmt3)NestLoop(bmt1 bmt2 bmt3 bmt4)
+MergeJoin(b1t2 b1t3)HashJoin(b1t2 b1t3 b1t4)NestLoop(b1t2 b1t3 b1t4 b1t1)
+MergeJoin(b2t3 b2t4)HashJoin(b2t3 b2t4 b2t1)NestLoop(b2t3 b2t4 b2t1 b2t2)
+*/
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+ AND bmt1.c1 <> (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+) AND bmt1.c1 <> (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+;
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(b1t2 b1t3)
+MergeJoin(b2t3 b2t4)
+MergeJoin(bmt1 bmt2)
+HashJoin(b1t2 b1t3 b1t4)
+HashJoin(b2t1 b2t3 b2t4)
+HashJoin(bmt1 bmt2 bmt3)
+NestLoop(b1t1 b1t2 b1t3 b1t4)
+NestLoop(b2t1 b2t2 b2t3 b2t4)
+NestLoop(bmt1 bmt2 bmt3 bmt4)
+Leading(bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t1.c1)
+ -> Hash Join
+ Hash Cond: (b1t4.c1 = b1t2.c1)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (b1t2.c1 = b1t3.c1)
+ -> Sort
+ Sort Key: b1t2.c1
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b1t3.c1
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Hash Join
+ Hash Cond: (b2t1.c1 = b2t3.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (b2t3.c1 = b2t4.c1)
+ -> Sort
+ Sort Key: b2t3.c1
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b2t4.c1
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Hash Join
+ Hash Cond: (bmt3.c1 = bmt1.c1)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt2.c1)
+ -> Sort
+ Sort Key: bmt1.c1
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 <> $0) AND (c1 <> $1))
+ -> Sort
+ Sort Key: bmt2.c1
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(63 rows)
+
+-- No. J-2-1-6
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+ AND bmt1.c1 <> (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+) AND bmt1.c1 <> (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+) AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+;
+ QUERY PLAN
+------------------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t4.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t3.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t2.c1)
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 <> $0) AND (c1 <> $1) AND (c1 <> $2))
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(64 rows)
+
+/*+
+Leading(bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2 b3t4 b3t1 b3t2 b3t3)
+MergeJoin(bmt1 bmt2)HashJoin(bmt1 bmt2 bmt3)NestLoop(bmt1 bmt2 bmt3 bmt4)
+MergeJoin(b1t2 b1t3)HashJoin(b1t2 b1t3 b1t4)NestLoop(b1t2 b1t3 b1t4 b1t1)
+MergeJoin(b2t3 b2t4)HashJoin(b2t3 b2t4 b2t1)NestLoop(b2t3 b2t4 b2t1 b2t2)
+MergeJoin(b3t4 b3t1)HashJoin(b3t4 b3t1 b3t2)NestLoop(b3t1 b3t2 b3t3 b3t4)
+*/
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+ AND bmt1.c1 <> (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+) AND bmt1.c1 <> (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+) AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+;
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(b1t2 b1t3)
+MergeJoin(b2t3 b2t4)
+MergeJoin(b3t1 b3t4)
+MergeJoin(bmt1 bmt2)
+HashJoin(b1t2 b1t3 b1t4)
+HashJoin(b2t1 b2t3 b2t4)
+HashJoin(b3t1 b3t2 b3t4)
+HashJoin(bmt1 bmt2 bmt3)
+NestLoop(b1t1 b1t2 b1t3 b1t4)
+NestLoop(b2t1 b2t2 b2t3 b2t4)
+NestLoop(b3t1 b3t2 b3t3 b3t4)
+NestLoop(bmt1 bmt2 bmt3 bmt4)
+Leading(bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2 b3t4 b3t1 b3t2 b3t3)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t1.c1)
+ -> Hash Join
+ Hash Cond: (b1t4.c1 = b1t2.c1)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (b1t2.c1 = b1t3.c1)
+ -> Sort
+ Sort Key: b1t2.c1
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b1t3.c1
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Hash Join
+ Hash Cond: (b2t1.c1 = b2t3.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (b2t3.c1 = b2t4.c1)
+ -> Sort
+ Sort Key: b2t3.c1
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b2t4.c1
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t3.c1)
+ -> Hash Join
+ Hash Cond: (b3t2.c1 = b3t1.c1)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (b3t1.c1 = b3t4.c1)
+ -> Sort
+ Sort Key: b3t1.c1
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b3t4.c1
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Hash Join
+ Hash Cond: (bmt3.c1 = bmt1.c1)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt2.c1)
+ -> Sort
+ Sort Key: bmt1.c1
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 <> $0) AND (c1 <> $1) AND (c1 <> $2))
+ -> Sort
+ Sort Key: bmt2.c1
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(84 rows)
+
+-- No. J-2-1-7
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+, c2 (c1) AS (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
+, c1, c2
+ WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 = c2.c1
+;
+ QUERY PLAN
+-----------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ CTE c2
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = c2.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = c1.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> CTE Scan on c1
+ -> CTE Scan on c2
+(53 rows)
+
+/*+
+Leading(c2 c1 bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2)
+MergeJoin(c2 c1)HashJoin(c2 c1 bmt1)NestLoop(c2 c1 bmt1 bmt2)MergeJoin(c2 c1 bmt1 bmt2 bmt3)HashJoin(c2 c1 bmt1 bmt2 bmt3 bmt4)
+MergeJoin(b1t2 b1t3)HashJoin(b1t2 b1t3 b1t4)NestLoop(b1t2 b1t3 b1t4 b1t1)
+MergeJoin(b2t3 b2t4)HashJoin(b2t3 b2t4 b2t1)NestLoop(b2t3 b2t4 b2t1 b2t2)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+, c2 (c1) AS (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
+, c1, c2
+ WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 = c2.c1
+;
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(b1t2 b1t3)
+MergeJoin(b2t3 b2t4)
+MergeJoin(c1 c2)
+HashJoin(b1t2 b1t3 b1t4)
+HashJoin(b2t1 b2t3 b2t4)
+HashJoin(bmt1 c1 c2)
+NestLoop(b1t1 b1t2 b1t3 b1t4)
+NestLoop(b2t1 b2t2 b2t3 b2t4)
+NestLoop(bmt1 bmt2 c1 c2)
+MergeJoin(bmt1 bmt2 bmt3 c1 c2)
+HashJoin(bmt1 bmt2 bmt3 bmt4 c1 c2)
+Leading(c2 c1 bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t1.c1)
+ -> Hash Join
+ Hash Cond: (b1t4.c1 = b1t2.c1)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (b1t2.c1 = b1t3.c1)
+ -> Sort
+ Sort Key: b1t2.c1
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b1t3.c1
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ CTE c2
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Hash Join
+ Hash Cond: (b2t1.c1 = b2t3.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (b2t3.c1 = b2t4.c1)
+ -> Sort
+ Sort Key: b2t3.c1
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b2t4.c1
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash Join
+ Hash Cond: (bmt4.c1 = bmt1.c1)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt3.c1)
+ -> Sort
+ Sort Key: bmt1.c1
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Hash Join
+ Hash Cond: (bmt1.c1 = c1.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (c1.c1 = c2.c1)
+ -> Sort
+ Sort Key: c1.c1
+ -> CTE Scan on c1
+ -> Sort
+ Sort Key: c2.c1
+ -> CTE Scan on c2
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: bmt3.c1
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+(73 rows)
+
+-- No. J-2-1-8
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+, c2 (c1) AS (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+, c3 (c1) AS (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
+, c1, c2, c3
+ WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 = c2.c1
+AND bmt1.c1 = c3.c1
+;
+ QUERY PLAN
+-----------------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ CTE c2
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ CTE c3
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t4.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t3.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t2.c1)
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = c3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = c2.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = c1.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> CTE Scan on c1
+ -> CTE Scan on c2
+ -> CTE Scan on c3
+(72 rows)
+
+/*+
+Leading(c3 c2 c1 bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2 b3t4 b3t1 b3t2 b3t3)
+MergeJoin(c3 c2)HashJoin(c3 c2 c1)NestLoop(c3 c2 c1 bmt1)MergeJoin(c3 c2 c1 bmt1 bmt2)HashJoin(c3 c2 c1 bmt1 bmt2 bmt3)NestLoop(c3 c2 c1 bmt1 bmt2 bmt3 bmt4)
+MergeJoin(b1t2 b1t3)HashJoin(b1t2 b1t3 b1t4)NestLoop(b1t2 b1t3 b1t4 b1t1)
+MergeJoin(b2t3 b2t4)HashJoin(b2t3 b2t4 b2t1)NestLoop(b2t3 b2t4 b2t1 b2t2)
+MergeJoin(b3t4 b3t1)HashJoin(b3t4 b3t1 b3t2)NestLoop(b3t1 b3t2 b3t3 b3t4)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+, c2 (c1) AS (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+, c3 (c1) AS (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
+, c1, c2, c3
+ WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 = c2.c1
+AND bmt1.c1 = c3.c1
+;
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(b1t2 b1t3)
+MergeJoin(b2t3 b2t4)
+MergeJoin(b3t1 b3t4)
+MergeJoin(c2 c3)
+HashJoin(b1t2 b1t3 b1t4)
+HashJoin(b2t1 b2t3 b2t4)
+HashJoin(b3t1 b3t2 b3t4)
+HashJoin(c1 c2 c3)
+NestLoop(b1t1 b1t2 b1t3 b1t4)
+NestLoop(b2t1 b2t2 b2t3 b2t4)
+NestLoop(b3t1 b3t2 b3t3 b3t4)
+NestLoop(bmt1 c1 c2 c3)
+MergeJoin(bmt1 bmt2 c1 c2 c3)
+HashJoin(bmt1 bmt2 bmt3 c1 c2 c3)
+NestLoop(bmt1 bmt2 bmt3 bmt4 c1 c2 c3)
+Leading(c3 c2 c1 bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2 b3t4 b3t1 b3t2 b3t3)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t1.c1)
+ -> Hash Join
+ Hash Cond: (b1t4.c1 = b1t2.c1)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (b1t2.c1 = b1t3.c1)
+ -> Sort
+ Sort Key: b1t2.c1
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b1t3.c1
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ CTE c2
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Hash Join
+ Hash Cond: (b2t1.c1 = b2t3.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (b2t3.c1 = b2t4.c1)
+ -> Sort
+ Sort Key: b2t3.c1
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b2t4.c1
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ CTE c3
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t3.c1)
+ -> Hash Join
+ Hash Cond: (b3t2.c1 = b3t1.c1)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (b3t1.c1 = b3t4.c1)
+ -> Sort
+ Sort Key: b3t1.c1
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b3t4.c1
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Hash Join
+ Hash Cond: (bmt3.c1 = bmt1.c1)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt2.c1)
+ -> Sort
+ Sort Key: bmt1.c1
+ -> Nested Loop
+ Join Filter: (c1.c1 = bmt1.c1)
+ -> Hash Join
+ Hash Cond: (c2.c1 = c1.c1)
+ -> Merge Join
+ Merge Cond: (c2.c1 = c3.c1)
+ -> Sort
+ Sort Key: c2.c1
+ -> CTE Scan on c2
+ -> Sort
+ Sort Key: c3.c1
+ -> CTE Scan on c3
+ -> Hash
+ -> CTE Scan on c1
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: bmt2.c1
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(97 rows)
+
+----
+---- No. J-2-2 the number of the tables per quiry block
+----
+-- No. J-2-2-1
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = 1
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = 1
+)
+ FROM s1.t1 bmt1, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = 1
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = 1
+)
+;
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Result
+ InitPlan 1 (returns $0)
+ -> Limit
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 4 (returns $3)
+ -> Result
+ InitPlan 3 (returns $2)
+ -> Limit
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 6 (returns $5)
+ -> Result
+ InitPlan 5 (returns $4)
+ -> Limit
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 IS NOT NULL) AND (c1 = 1))
+ -> Nested Loop
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 <> $5) AND (c1 = 1))
+ -> CTE Scan on c1
+ Filter: (c1 = 1)
+(28 rows)
+
+/*+
+Leading(c1 bmt1 b1t1 b2t1 b3t1)
+HashJoin(bmt1 c1)
+HashJoin(b1t1 c1)
+HashJoin(b2t1 c1)
+HashJoin(b3t1 c1)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = 1
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = 1
+)
+ FROM s1.t1 bmt1, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = 1
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = 1
+)
+;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(bmt1 c1)
+Leading(c1 bmt1 b1t1 b2t1 b3t1)
+not used hint:
+HashJoin(b1t1 c1)
+HashJoin(b2t1 c1)
+HashJoin(b3t1 c1)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Result
+ InitPlan 1 (returns $0)
+ -> Limit
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 4 (returns $3)
+ -> Result
+ InitPlan 3 (returns $2)
+ -> Limit
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 6 (returns $5)
+ -> Result
+ InitPlan 5 (returns $4)
+ -> Limit
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 IS NOT NULL) AND (c1 = 1))
+ -> Nested Loop
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 <> $5) AND (c1 = 1))
+ -> CTE Scan on c1
+ Filter: (c1 = 1)
+(28 rows)
+
+-- No. J-2-2-2
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)'
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)'
+)
+;
+ QUERY PLAN
+-------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t2.c1)
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = c1.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 <> $2)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> CTE Scan on c1
+(35 rows)
+
+/*+
+Leading(c1 bmt2 b1t2 b2t2 b3t2 bmt1 b1t1 b2t1 b3t1)
+MergeJoin(c1 bmt2)
+HashJoin(c1 bmt1 bmt2)
+MergeJoin(b1t1 b1t2)
+MergeJoin(b2t1 b2t2)
+MergeJoin(b3t1 b3t2)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)'
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)'
+)
+;
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(b1t1 b1t2)
+MergeJoin(b2t1 b2t2)
+MergeJoin(b3t1 b3t2)
+MergeJoin(bmt2 c1)
+HashJoin(bmt1 bmt2 c1)
+Leading(c1 bmt2 b1t2 b2t2 b3t2 bmt1 b1t1 b2t1 b3t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t2.c1)
+ -> Sort
+ Sort Key: b1t1.c1
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b1t2.c1
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (b2t1.c1 = b2t2.c1)
+ -> Sort
+ Sort Key: b2t1.c1
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b2t2.c1
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (b3t1.c1 = b3t2.c1)
+ -> Sort
+ Sort Key: b3t1.c1
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b3t2.c1
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash Join
+ Hash Cond: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 <> $2)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (bmt2.c1 = c1.c1)
+ -> Sort
+ Sort Key: bmt2.c1
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: c1.c1
+ -> CTE Scan on c1
+(52 rows)
+
+-- No. J-2-2-3
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+;
+ QUERY PLAN
+-------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t4.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t3.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t2.c1)
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = c1.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Nested Loop
+ Join Filter: (bmt3.c1 = bmt1.c1)
+ -> Nested Loop
+ Join Filter: (bmt3.c1 = bmt4.c1)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 <> $2)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> CTE Scan on c1
+(67 rows)
+
+/*+
+Leading(c1 bmt4 b1t4 b2t4 b3t4 bmt3 b1t3 b2t3 b3t3 bmt2 b1t2 b2t2 b3t2 bmt1 b1t1 b2t1 b3t1)
+MergeJoin(c1 bmt4)
+HashJoin(c1 bmt4 bmt3)
+NestLoop(c1 bmt4 bmt3 bmt2)
+MergeJoin(c1 bmt4 bmt3 bmt2 bmt1)
+HashJoin(b1t4 b1t3)
+NestLoop(b1t4 b1t3 b1t2)
+MergeJoin(b1t4 b1t3 b1t2 b1t1)
+HashJoin(b2t4 b2t3)
+NestLoop(b2t4 b2t3 b2t2)
+MergeJoin(b2t4 b2t3 b2t2 b2t1)
+HashJoin(b3t4 b3t3)
+NestLoop(b3t4 b3t3 b3t2)
+MergeJoin(b3t4 b3t3 b3t2 b3t1)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(b1t3 b1t4)
+HashJoin(b2t3 b2t4)
+HashJoin(b3t3 b3t4)
+MergeJoin(bmt4 c1)
+NestLoop(b1t2 b1t3 b1t4)
+NestLoop(b2t2 b2t3 b2t4)
+NestLoop(b3t2 b3t3 b3t4)
+HashJoin(bmt3 bmt4 c1)
+MergeJoin(b1t1 b1t2 b1t3 b1t4)
+MergeJoin(b2t1 b2t2 b2t3 b2t4)
+MergeJoin(b3t1 b3t2 b3t3 b3t4)
+NestLoop(bmt2 bmt3 bmt4 c1)
+MergeJoin(bmt1 bmt2 bmt3 bmt4 c1)
+Leading(c1 bmt4 b1t4 b2t4 b3t4 bmt3 b1t3 b2t3 b3t3 bmt2 b1t2 b2t2 b3t2 bmt1 b1t1 b2t1 b3t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (b1t2.c1 = b1t1.c1)
+ -> Sort
+ Sort Key: b1t2.c1
+ -> Nested Loop
+ Join Filter: (b1t3.c1 = b1t2.c1)
+ -> Hash Join
+ Hash Cond: (b1t3.c1 = b1t4.c1)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b1t1.c1
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (b2t2.c1 = b2t1.c1)
+ -> Sort
+ Sort Key: b2t2.c1
+ -> Nested Loop
+ Join Filter: (b2t3.c1 = b2t2.c1)
+ -> Hash Join
+ Hash Cond: (b2t3.c1 = b2t4.c1)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b2t1.c1
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (b3t2.c1 = b3t1.c1)
+ -> Sort
+ Sort Key: b3t2.c1
+ -> Nested Loop
+ Join Filter: (b3t3.c1 = b3t2.c1)
+ -> Hash Join
+ Hash Cond: (b3t3.c1 = b3t4.c1)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b3t1.c1
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Merge Join
+ Merge Cond: (bmt2.c1 = bmt1.c1)
+ -> Sort
+ Sort Key: bmt2.c1
+ -> Nested Loop
+ Join Filter: (bmt3.c1 = bmt2.c1)
+ -> Hash Join
+ Hash Cond: (bmt3.c1 = bmt4.c1)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (bmt4.c1 = c1.c1)
+ -> Sort
+ Sort Key: bmt4.c1
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: c1.c1
+ -> CTE Scan on c1
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: bmt1.c1
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 <> $2)
+(91 rows)
+
+-- No. J-2-2-4
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = 1
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)'
+)
+;
+ QUERY PLAN
+-------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $2)
+ -> Result
+ InitPlan 2 (returns $1)
+ -> Limit
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 4 (returns $3)
+ -> Aggregate
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = c1.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Nested Loop
+ Join Filter: (bmt3.c1 = bmt1.c1)
+ -> Nested Loop
+ Join Filter: (bmt3.c1 = bmt4.c1)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 <> $3)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> CTE Scan on c1
+(46 rows)
+
+/*+
+Leading(c1 bmt4 b1t4 bmt3 b1t3 bmt2 b1t2 bmt1 b1t1 b2t1 b3t1)
+MergeJoin(c1 bmt4)
+HashJoin(c1 bmt4 bmt3)
+NestLoop(c1 bmt4 bmt3 bmt2)
+MergeJoin(c1 bmt4 bmt3 bmt2 bmt1)
+MergeJoin(b1t4 b1t3)
+HashJoin(b1t4 b1t3 b1t2)
+NestLoop(b1t4 b1t3 b1t2 b1t1)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = 1
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)'
+)
+;
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(b1t3 b1t4)
+MergeJoin(bmt4 c1)
+HashJoin(b1t2 b1t3 b1t4)
+HashJoin(bmt3 bmt4 c1)
+NestLoop(b1t1 b1t2 b1t3 b1t4)
+NestLoop(bmt2 bmt3 bmt4 c1)
+MergeJoin(bmt1 bmt2 bmt3 bmt4 c1)
+Leading(c1 bmt4 b1t4 bmt3 b1t3 bmt2 b1t2 bmt1 b1t1 b2t1 b3t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t1.c1)
+ -> Hash Join
+ Hash Cond: (b1t2.c1 = b1t3.c1)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (b1t3.c1 = b1t4.c1)
+ -> Sort
+ Sort Key: b1t3.c1
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b1t4.c1
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $2)
+ -> Result
+ InitPlan 2 (returns $1)
+ -> Limit
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 4 (returns $3)
+ -> Aggregate
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Merge Join
+ Merge Cond: (bmt2.c1 = bmt1.c1)
+ -> Sort
+ Sort Key: bmt2.c1
+ -> Nested Loop
+ Join Filter: (bmt3.c1 = bmt2.c1)
+ -> Hash Join
+ Hash Cond: (bmt3.c1 = bmt4.c1)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (bmt4.c1 = c1.c1)
+ -> Sort
+ Sort Key: bmt4.c1
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: c1.c1
+ -> CTE Scan on c1
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: bmt1.c1
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 <> $3)
+(60 rows)
+
+----
+---- No. J-2-3 RULE definition table
+----
+-- No. J-2-3-1
+EXPLAIN (COSTS false) UPDATE s1.r1 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t2.c1 = t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(19 rows)
+
+/*+
+Leading(t4 t3 t2 t1 r1)
+MergeJoin(t4 t3 t2 t1 r1)
+HashJoin(t4 t3 t2 t1)
+NestLoop(t4 t3 t2)
+MergeJoin(t4 t3)
+*/
+EXPLAIN (COSTS false) UPDATE s1.r1 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(t3 t4)
+NestLoop(t2 t3 t4)
+HashJoin(t1 t2 t3 t4)
+MergeJoin(r1 t1 t2 t3 t4)
+Leading(t4 t3 t2 t1 r1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Nested Loop
+ Join Filter: (t3.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t3.c1 = t4.c1)
+ -> Sort
+ Sort Key: t3.c1
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: t4.c1
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(24 rows)
+
+EXPLAIN (COSTS false) UPDATE s1.r1_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r1_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(19 rows)
+
+/*+
+Leading(b1t4 b1t3 b1t2 b1t1 r1_)
+MergeJoin(b1t4 b1t3 b1t2 b1t1 r1_)
+HashJoin(b1t4 b1t3 b1t2 b1t1)
+NestLoop(b1t4 b1t3 b1t2)
+MergeJoin(b1t4 b1t3)
+*/
+EXPLAIN (COSTS false) UPDATE s1.r1_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(b1t3 b1t4)
+NestLoop(b1t2 b1t3 b1t4)
+HashJoin(b1t1 b1t2 b1t3 b1t4)
+MergeJoin(b1t1 b1t2 b1t3 b1t4 r1_)
+Leading(b1t4 b1t3 b1t2 b1t1 r1_)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Nested Loop
+ Join Filter: (b1t3.c1 = b1t2.c1)
+ -> Merge Join
+ Merge Cond: (b1t3.c1 = b1t4.c1)
+ -> Sort
+ Sort Key: b1t3.c1
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b1t4.c1
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r1_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(24 rows)
+
+-- No. J-2-3-2
+EXPLAIN (COSTS false) UPDATE s1.r2 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t2.c1 = t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r2
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t2.c1 = t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r2
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(39 rows)
+
+/*+
+Leading(t4 t3 t2 t1 r2)
+MergeJoin(t4 t3 t2 t1 r2)
+HashJoin(t4 t3 t2 t1)
+NestLoop(t4 t3 t2)
+MergeJoin(t4 t3)
+*/
+EXPLAIN (COSTS false) UPDATE s1.r2 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(t3 t4)
+NestLoop(t2 t3 t4)
+HashJoin(t1 t2 t3 t4)
+MergeJoin(r2 t1 t2 t3 t4)
+Leading(t4 t3 t2 t1 r2)
+not used hint:
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(t3 t4)
+NestLoop(t2 t3 t4)
+HashJoin(t1 t2 t3 t4)
+MergeJoin(r2 t1 t2 t3 t4)
+Leading(t4 t3 t2 t1 r2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Nested Loop
+ Join Filter: (t3.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t3.c1 = t4.c1)
+ -> Sort
+ Sort Key: t3.c1
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: t4.c1
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r2
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+
+ Aggregate
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Nested Loop
+ Join Filter: (t3.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t3.c1 = t4.c1)
+ -> Sort
+ Sort Key: t3.c1
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: t4.c1
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r2
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(49 rows)
+
+EXPLAIN (COSTS false) UPDATE s1.r2_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r2_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t2.c1 = b2t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r2_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(39 rows)
+
+/*+Leading(
+b1t1 b1t2 b1t3 b1t4
+b2t1 b2t2 b2t3 b2t4 r2_
+)
+MergeJoin(b1t1 b1t2)
+HashJoin(b1t1 b1t2 b1t3)
+NestLoop(b1t1 b1t2 b1t3 b1t4)
+MergeJoin(b1t1 b1t2 b1t3 b1t4 r2_)
+MergeJoin(b2t1 b2t2)
+HashJoin(b2t1 b2t2 b2t3)
+NestLoop(b2t1 b2t2 b2t3 b2t4)
+MergeJoin(b2t1 b2t2 b2t3 b2t4 r2_)
+*/
+EXPLAIN (COSTS false) UPDATE s1.r2_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(b1t1 b1t2)
+HashJoin(b1t1 b1t2 b1t3)
+NestLoop(b1t1 b1t2 b1t3 b1t4)
+MergeJoin(b1t1 b1t2 b1t3 b1t4 r2_)
+Leading(b1t1 b1t2 b1t3 b1t4 b2t1 b2t2 b2t3 b2t4 r2_)
+not used hint:
+MergeJoin(b2t1 b2t2)
+HashJoin(b2t1 b2t2 b2t3)
+NestLoop(b2t1 b2t2 b2t3 b2t4)
+MergeJoin(b2t1 b2t2 b2t3 b2t4 r2_)
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(b2t1 b2t2)
+HashJoin(b2t1 b2t2 b2t3)
+NestLoop(b2t1 b2t2 b2t3 b2t4)
+MergeJoin(b2t1 b2t2 b2t3 b2t4 r2_)
+Leading(b1t1 b1t2 b1t3 b1t4 b2t1 b2t2 b2t3 b2t4 r2_)
+not used hint:
+MergeJoin(b1t1 b1t2)
+HashJoin(b1t1 b1t2 b1t3)
+NestLoop(b1t1 b1t2 b1t3 b1t4)
+MergeJoin(b1t1 b1t2 b1t3 b1t4 r2_)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Hash Join
+ Hash Cond: (b1t3.c1 = b1t1.c1)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t2.c1)
+ -> Sort
+ Sort Key: b1t1.c1
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b1t2.c1
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r2_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Hash Join
+ Hash Cond: (b2t3.c1 = b2t1.c1)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (b2t1.c1 = b2t2.c1)
+ -> Sort
+ Sort Key: b2t1.c1
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b2t2.c1
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r2_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(49 rows)
+
+-- No. J-2-3-3
+EXPLAIN (COSTS false) UPDATE s1.r3 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t2.c1 = t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r3
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t2.c1 = t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r3
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t2.c1 = t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r3
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(59 rows)
+
+/*+
+Leading(t4 t3 t2 t1 r3)
+MergeJoin(t4 t3 t2 t1 r3)
+HashJoin(t4 t3 t2 t1)
+NestLoop(t4 t3 t2)
+MergeJoin(t4 t3)
+*/
+EXPLAIN (COSTS false) UPDATE s1.r3 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(t3 t4)
+NestLoop(t2 t3 t4)
+HashJoin(t1 t2 t3 t4)
+MergeJoin(r3 t1 t2 t3 t4)
+Leading(t4 t3 t2 t1 r3)
+not used hint:
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(t3 t4)
+NestLoop(t2 t3 t4)
+HashJoin(t1 t2 t3 t4)
+MergeJoin(r3 t1 t2 t3 t4)
+Leading(t4 t3 t2 t1 r3)
+not used hint:
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(t3 t4)
+NestLoop(t2 t3 t4)
+HashJoin(t1 t2 t3 t4)
+MergeJoin(r3 t1 t2 t3 t4)
+Leading(t4 t3 t2 t1 r3)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Nested Loop
+ Join Filter: (t3.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t3.c1 = t4.c1)
+ -> Sort
+ Sort Key: t3.c1
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: t4.c1
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r3
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+
+ Aggregate
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Nested Loop
+ Join Filter: (t3.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t3.c1 = t4.c1)
+ -> Sort
+ Sort Key: t3.c1
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: t4.c1
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r3
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+
+ Aggregate
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Nested Loop
+ Join Filter: (t3.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t3.c1 = t4.c1)
+ -> Sort
+ Sort Key: t3.c1
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: t4.c1
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r3
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(74 rows)
+
+EXPLAIN (COSTS false) UPDATE s1.r3_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r3_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t2.c1 = b2t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r3_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t4.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t3.c1)
+ -> Nested Loop
+ Join Filter: (b3t2.c1 = b3t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r3_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(59 rows)
+
+/*+Leading(
+b1t1 b1t2 b1t3 b1t4
+b2t1 b2t2 b2t3 b2t4
+b3t1 b3t2 b3t3 b3t4 r3_
+)
+MergeJoin(b1t1 b1t2)
+HashJoin(b1t1 b1t2 b1t3)
+NestLoop(b1t1 b1t2 b1t3 b1t4)
+MergeJoin(b1t1 b1t2 b1t3 b1t4 r3_)
+MergeJoin(b2t1 b2t2)
+HashJoin(b2t1 b2t2 b2t3)
+NestLoop(b2t1 b2t2 b2t3 b2t4)
+MergeJoin(b2t1 b2t2 b2t3 b2t4 r3_)
+MergeJoin(b3t1 b3t2)
+HashJoin(b3t1 b3t2 b3t3)
+NestLoop(b3t1 b3t2 b3t3 b3t4)
+MergeJoin(b3t1 b3t2 b3t3 b3t4 r3_)
+*/
+EXPLAIN (COSTS false) UPDATE s1.r3_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(b1t1 b1t2)
+HashJoin(b1t1 b1t2 b1t3)
+NestLoop(b1t1 b1t2 b1t3 b1t4)
+MergeJoin(b1t1 b1t2 b1t3 b1t4 r3_)
+Leading(b1t1 b1t2 b1t3 b1t4 b2t1 b2t2 b2t3 b2t4 b3t1 b3t2 b3t3 b3t4 r3_)
+not used hint:
+MergeJoin(b2t1 b2t2)
+MergeJoin(b3t1 b3t2)
+HashJoin(b2t1 b2t2 b2t3)
+HashJoin(b3t1 b3t2 b3t3)
+NestLoop(b2t1 b2t2 b2t3 b2t4)
+NestLoop(b3t1 b3t2 b3t3 b3t4)
+MergeJoin(b2t1 b2t2 b2t3 b2t4 r3_)
+MergeJoin(b3t1 b3t2 b3t3 b3t4 r3_)
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(b2t1 b2t2)
+HashJoin(b2t1 b2t2 b2t3)
+NestLoop(b2t1 b2t2 b2t3 b2t4)
+MergeJoin(b2t1 b2t2 b2t3 b2t4 r3_)
+Leading(b1t1 b1t2 b1t3 b1t4 b2t1 b2t2 b2t3 b2t4 b3t1 b3t2 b3t3 b3t4 r3_)
+not used hint:
+MergeJoin(b1t1 b1t2)
+MergeJoin(b3t1 b3t2)
+HashJoin(b1t1 b1t2 b1t3)
+HashJoin(b3t1 b3t2 b3t3)
+NestLoop(b1t1 b1t2 b1t3 b1t4)
+NestLoop(b3t1 b3t2 b3t3 b3t4)
+MergeJoin(b1t1 b1t2 b1t3 b1t4 r3_)
+MergeJoin(b3t1 b3t2 b3t3 b3t4 r3_)
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(b3t1 b3t2)
+HashJoin(b3t1 b3t2 b3t3)
+NestLoop(b3t1 b3t2 b3t3 b3t4)
+MergeJoin(b3t1 b3t2 b3t3 b3t4 r3_)
+Leading(b1t1 b1t2 b1t3 b1t4 b2t1 b2t2 b2t3 b2t4 b3t1 b3t2 b3t3 b3t4 r3_)
+not used hint:
+MergeJoin(b1t1 b1t2)
+MergeJoin(b2t1 b2t2)
+HashJoin(b1t1 b1t2 b1t3)
+HashJoin(b2t1 b2t2 b2t3)
+NestLoop(b1t1 b1t2 b1t3 b1t4)
+NestLoop(b2t1 b2t2 b2t3 b2t4)
+MergeJoin(b1t1 b1t2 b1t3 b1t4 r3_)
+MergeJoin(b2t1 b2t2 b2t3 b2t4 r3_)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Hash Join
+ Hash Cond: (b1t3.c1 = b1t1.c1)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t2.c1)
+ -> Sort
+ Sort Key: b1t1.c1
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b1t2.c1
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r3_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Hash Join
+ Hash Cond: (b2t3.c1 = b2t1.c1)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (b2t1.c1 = b2t2.c1)
+ -> Sort
+ Sort Key: b2t1.c1
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b2t2.c1
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r3_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t4.c1)
+ -> Hash Join
+ Hash Cond: (b3t3.c1 = b3t1.c1)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (b3t1.c1 = b3t2.c1)
+ -> Sort
+ Sort Key: b3t1.c1
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b3t2.c1
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r3_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(74 rows)
+
+----
+---- No. J-2-4 VALUES clause
+----
+-- No. J-2-4-1
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+ QUERY PLAN
+-------------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Hash Join
+ Hash Cond: (t2.c1 = "*VALUES*".column1)
+ -> Seq Scan on t2
+ -> Hash
+ -> Values Scan on "*VALUES*"
+(10 rows)
+
+/*+ Leading(t3 t1 t2) HashJoin(t3 t1)NestLoop(t3 t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t3 t1 t2)
+not used hint:
+HashJoin(t1 t3)
+NestLoop(t1 t2 t3)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------
+ Nested Loop
+ Join Filter: (t1.c1 = "*VALUES*".column1)
+ -> Values Scan on "*VALUES*"
+ -> Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(9 rows)
+
+/*+ Leading(*VALUES* t1 t2) HashJoin(*VALUES* t1)NestLoop(*VALUES* t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(*VALUES* t1)
+NestLoop(*VALUES* t1 t2)
+Leading(*VALUES* t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------
+ Nested Loop
+ Join Filter: (t1.c1 = t2.c1)
+ -> Hash Join
+ Hash Cond: (t1.c1 = "*VALUES*".column1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Values Scan on "*VALUES*"
+ -> Seq Scan on t2
+(8 rows)
+
+-- No. J-2-4-2
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4), (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t4 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+ QUERY PLAN
+-------------------------------------------------------------
+ Nested Loop
+ Join Filter: (t1.c1 = "*VALUES*".column1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Hash Join
+ Hash Cond: (t2.c1 = "*VALUES*".column1)
+ -> Seq Scan on t2
+ -> Hash
+ -> Values Scan on "*VALUES*"
+ -> Values Scan on "*VALUES*"
+(13 rows)
+
+/*+ Leading(t4 t3 t2 t1) NestLoop(t4 t3)HashJoin(t4 t3 t2)MergeJoin(t4 t3 t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4), (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t4 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t3 t2 t1)
+not used hint:
+NestLoop(t3 t4)
+HashJoin(t2 t3 t4)
+MergeJoin(t1 t2 t3 t4)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------------------------
+ Nested Loop
+ Join Filter: (t1.c1 = "*VALUES*".column1)
+ -> Nested Loop
+ Join Filter: ("*VALUES*".column1 = "*VALUES*".column1)
+ -> Values Scan on "*VALUES*"
+ -> Values Scan on "*VALUES*"
+ -> Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(12 rows)
+
+/*+ Leading(*VALUES* t3 t2 t1) NestLoop(t4 t3)HashJoin(*VALUES* t3 t2)MergeJoin(*VALUES* t3 t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4), (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t4 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+INFO: hint syntax error at or near "HashJoin(*VALUES* t3 t2)MergeJoin(*VALUES* t3 t2 t1)"
+DETAIL: Relation name "*VALUES*" is ambiguous.
+INFO: hint syntax error at or near "MergeJoin(*VALUES* t3 t2 t1)"
+DETAIL: Relation name "*VALUES*" is ambiguous.
+INFO: hint syntax error at or near "Leading(*VALUES* t3 t2 t1) NestLoop(t4 t3)HashJoin(*VALUES* t3 t2)MergeJoin(*VALUES* t3 t2 t1)"
+DETAIL: Relation name "*VALUES*" is ambiguous.
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+NestLoop(t3 t4)
+Leading(*VALUES* t3 t2 t1)
+duplication hint:
+error hint:
+HashJoin(*VALUES* t2 t3)
+MergeJoin(*VALUES* t1 t2 t3)
+
+ QUERY PLAN
+-------------------------------------------------------------
+ Nested Loop
+ Join Filter: (t1.c1 = "*VALUES*".column1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Hash Join
+ Hash Cond: (t2.c1 = "*VALUES*".column1)
+ -> Seq Scan on t2
+ -> Hash
+ -> Values Scan on "*VALUES*"
+ -> Values Scan on "*VALUES*"
+(13 rows)
+
+----
+---- No. J-3-1 join method hint
+----
+-- No. J-3-1-1~6
+SET enable_nestloop TO on;
+SET enable_mergejoin TO off;
+SET enable_hashjoin TO off;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+ QUERY PLAN
+------------------------------------
+ Nested Loop
+ -> Seq Scan on t2
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = t2.c1)
+(4 rows)
+
+/*+NestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+NestLoop(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Nested Loop
+ -> Seq Scan on t2
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = t2.c1)
+(4 rows)
+
+/*+HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+/*+MergeJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(6 rows)
+
+SET enable_mergejoin TO on;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1 AND t1.ctid = '(1,1)';;
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.c1 = t2.c1)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+(5 rows)
+
+/*+NoNestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1 AND t1.ctid = '(1,1)';;
+LOG: pg_hint_plan:
+used hint:
+NoNestLoop(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Sort
+ Sort Key: t1.c1
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(9 rows)
+
+SET enable_mergejoin TO off;
+/*+NoHashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+NoHashJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Nested Loop
+ -> Seq Scan on t2
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = t2.c1)
+(4 rows)
+
+/*+NoMergeJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+NoMergeJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Nested Loop
+ -> Seq Scan on t2
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = t2.c1)
+(4 rows)
+
+-- No. J-3-1-7~12
+SET enable_nestloop TO off;
+SET enable_mergejoin TO off;
+SET enable_hashjoin TO on;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+/*+NestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+NestLoop(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Nested Loop
+ -> Seq Scan on t2
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = t2.c1)
+(4 rows)
+
+/*+HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+/*+MergeJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(6 rows)
+
+/*+NoNestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+NoNestLoop(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+/*+NoHashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+NoHashJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Nested Loop
+ -> Seq Scan on t2
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = t2.c1)
+(4 rows)
+
+/*+NoMergeJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+NoMergeJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+-- No. J-3-1-13~18
+SET enable_nestloop TO off;
+SET enable_mergejoin TO on;
+SET enable_hashjoin TO off;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(6 rows)
+
+/*+NestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+NestLoop(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Nested Loop
+ -> Seq Scan on t2
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = t2.c1)
+(4 rows)
+
+/*+HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+/*+MergeJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(6 rows)
+
+/*+NoNestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+NoNestLoop(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(6 rows)
+
+/*+NoHashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+NoHashJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(6 rows)
+
+/*+NoMergeJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+NoMergeJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Nested Loop
+ -> Seq Scan on t2
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = t2.c1)
+(4 rows)
+
+SET enable_nestloop TO on;
+SET enable_mergejoin TO on;
+SET enable_hashjoin TO on;
+----
+---- No. J-3-2 join inherit tables
+----
+EXPLAIN (COSTS false) SELECT * FROM s1.p1, s1.p2 WHERE p1.c1 = p2.c1;
+ QUERY PLAN
+---------------------------------------
+ Hash Join
+ Hash Cond: (s1.p2.c1 = s1.p1.c1)
+ -> Append
+ -> Seq Scan on p2
+ -> Seq Scan on p2c1 p2
+ -> Seq Scan on p2c2 p2
+ -> Seq Scan on p2c3 p2
+ -> Seq Scan on p2c1c1 p2
+ -> Seq Scan on p2c1c2 p2
+ -> Seq Scan on p2c2c1 p2
+ -> Seq Scan on p2c2c2 p2
+ -> Seq Scan on p2c3c1 p2
+ -> Seq Scan on p2c3c2 p2
+ -> Hash
+ -> Append
+ -> Seq Scan on p1
+ -> Seq Scan on p1c1 p1
+ -> Seq Scan on p1c2 p1
+ -> Seq Scan on p1c3 p1
+(19 rows)
+
+-- No. J-3-2-1
+/*+MergeJoin(p1 p2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.p1, s1.p2 WHERE p1.c1 = p2.c1;
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(p1 p2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Merge Join
+ Merge Cond: (s1.p1.c1 = s1.p2.c1)
+ -> Sort
+ Sort Key: s1.p1.c1
+ -> Append
+ -> Seq Scan on p1
+ -> Seq Scan on p1c1 p1
+ -> Seq Scan on p1c2 p1
+ -> Seq Scan on p1c3 p1
+ -> Sort
+ Sort Key: s1.p2.c1
+ -> Append
+ -> Seq Scan on p2
+ -> Seq Scan on p2c1 p2
+ -> Seq Scan on p2c2 p2
+ -> Seq Scan on p2c3 p2
+ -> Seq Scan on p2c1c1 p2
+ -> Seq Scan on p2c1c2 p2
+ -> Seq Scan on p2c2c1 p2
+ -> Seq Scan on p2c2c2 p2
+ -> Seq Scan on p2c3c1 p2
+ -> Seq Scan on p2c3c2 p2
+(22 rows)
+
+-- No. J-3-2-2
+/*+MergeJoin(p1c1 p2c1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.p1, s1.p2 WHERE p1.c1 = p2.c1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+MergeJoin(p1c1 p2c1)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------
+ Hash Join
+ Hash Cond: (s1.p2.c1 = s1.p1.c1)
+ -> Append
+ -> Seq Scan on p2
+ -> Seq Scan on p2c1 p2
+ -> Seq Scan on p2c2 p2
+ -> Seq Scan on p2c3 p2
+ -> Seq Scan on p2c1c1 p2
+ -> Seq Scan on p2c1c2 p2
+ -> Seq Scan on p2c2c1 p2
+ -> Seq Scan on p2c2c2 p2
+ -> Seq Scan on p2c3c1 p2
+ -> Seq Scan on p2c3c2 p2
+ -> Hash
+ -> Append
+ -> Seq Scan on p1
+ -> Seq Scan on p1c1 p1
+ -> Seq Scan on p1c2 p1
+ -> Seq Scan on p1c3 p1
+(19 rows)
+
+----
+---- No. J-3-3 conflict join method hint
+----
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(6 rows)
+
+-- No. J-3-3-1
+/*+HashJoin(t1 t2)NestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+INFO: hint syntax error at or near "HashJoin(t1 t2)NestLoop(t1 t2)"
+DETAIL: Conflict join method hint.
+LOG: pg_hint_plan:
+used hint:
+NestLoop(t1 t2)
+not used hint:
+duplication hint:
+HashJoin(t1 t2)
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Nested Loop
+ -> Seq Scan on t2
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = t2.c1)
+(4 rows)
+
+-- No. J-3-3-2
+/*+MergeJoin(t1 t2)HashJoin(t1 t2)NestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+INFO: hint syntax error at or near "MergeJoin(t1 t2)HashJoin(t1 t2)NestLoop(t1 t2)"
+DETAIL: Conflict join method hint.
+INFO: hint syntax error at or near "HashJoin(t1 t2)NestLoop(t1 t2)"
+DETAIL: Conflict join method hint.
+LOG: pg_hint_plan:
+used hint:
+NestLoop(t1 t2)
+not used hint:
+duplication hint:
+MergeJoin(t1 t2)
+HashJoin(t1 t2)
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Nested Loop
+ -> Seq Scan on t2
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = t2.c1)
+(4 rows)
+
+-- No. J-3-3-3
+/*+HashJoin(t1 t2)NestLoop(t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+INFO: hint syntax error at or near "HashJoin(t1 t2)NestLoop(t2 t1)"
+DETAIL: Conflict join method hint.
+LOG: pg_hint_plan:
+used hint:
+NestLoop(t1 t2)
+not used hint:
+duplication hint:
+HashJoin(t1 t2)
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Nested Loop
+ -> Seq Scan on t2
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = t2.c1)
+(4 rows)
+
+-- No. J-3-3-4
+/*+MergeJoin(t2 t1)HashJoin(t1 t2)NestLoop(t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+INFO: hint syntax error at or near "MergeJoin(t2 t1)HashJoin(t1 t2)NestLoop(t2 t1)"
+DETAIL: Conflict join method hint.
+INFO: hint syntax error at or near "HashJoin(t1 t2)NestLoop(t2 t1)"
+DETAIL: Conflict join method hint.
+LOG: pg_hint_plan:
+used hint:
+NestLoop(t1 t2)
+not used hint:
+duplication hint:
+MergeJoin(t1 t2)
+HashJoin(t1 t2)
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Nested Loop
+ -> Seq Scan on t2
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = t2.c1)
+(4 rows)
+
+----
+---- No. J-3-4 hint state output
+----
+-- No. J-3-4-1
+/*+NestLoop(t1 t2)*/
+SELECT * FROM s1.t1, s1.t2 WHERE false;
+LOG: pg_hint_plan:
+used hint:
+NestLoop(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ c1 | c2 | c3 | c4 | c1 | c2 | c3 | c4
+----+----+----+----+----+----+----+----
+(0 rows)
+
+-- No. J-3-4-2
+/*+HashJoin(t1 t2)*/
+SELECT * FROM s1.t1, s1.t2 WHERE false;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ c1 | c2 | c3 | c4 | c1 | c2 | c3 | c4
+----+----+----+----+----+----+----+----
+(0 rows)
+
+-- No. J-3-4-3
+/*+MergeJoin(t1 t2)*/
+SELECT * FROM s1.t1, s1.t2 WHERE false;
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ c1 | c2 | c3 | c4 | c1 | c2 | c3 | c4
+----+----+----+----+----+----+----+----
+(0 rows)
+
+-- No. J-3-4-4
+/*+NoNestLoop(t1 t2)*/
+SELECT * FROM s1.t1, s1.t2 WHERE false;
+LOG: pg_hint_plan:
+used hint:
+NoNestLoop(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ c1 | c2 | c3 | c4 | c1 | c2 | c3 | c4
+----+----+----+----+----+----+----+----
+(0 rows)
+
+-- No. J-3-4-5
+/*+NoHashJoin(t1 t2)*/
+SELECT * FROM s1.t1, s1.t2 WHERE false;
+LOG: pg_hint_plan:
+used hint:
+NoHashJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ c1 | c2 | c3 | c4 | c1 | c2 | c3 | c4
+----+----+----+----+----+----+----+----
+(0 rows)
+
+-- No. J-3-4-6
+/*+NoMergeJoin(t1 t2)*/
+SELECT * FROM s1.t1, s1.t2 WHERE false;
+LOG: pg_hint_plan:
+used hint:
+NoMergeJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ c1 | c2 | c3 | c4 | c1 | c2 | c3 | c4
+----+----+----+----+----+----+----+----
+(0 rows)
+
+-- No. J-3-4-7
+/*+NestLoop()*/
+SELECT * FROM s1.t1 WHERE false;
+INFO: hint syntax error at or near ")"
+DETAIL: Relation name is necessary.
+ c1 | c2 | c3 | c4
+----+----+----+----
+(0 rows)
+
+-- No. J-3-4-8
+/*+NestLoop(t1)*/
+SELECT * FROM s1.t1 WHERE false;
+INFO: hint syntax error at or near ")"
+DETAIL: NestLoop hint requires at least two relations.
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+NestLoop(t1)
+
+ c1 | c2 | c3 | c4
+----+----+----+----
+(0 rows)
+
+-- No. J-3-4-9
+/*+NestLoop(t1 t2)*/
+SELECT * FROM s1.t1, s1.t2 WHERE false;
+LOG: pg_hint_plan:
+used hint:
+NestLoop(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ c1 | c2 | c3 | c4 | c1 | c2 | c3 | c4
+----+----+----+----+----+----+----+----
+(0 rows)
+
+-- No. J-3-4-10
+/*+NestLoop(t1 t2 t3)*/
+SELECT * FROM s1.t1, s1.t2, s1.t3 WHERE false;
+LOG: pg_hint_plan:
+used hint:
+NestLoop(t1 t2 t3)
+not used hint:
+duplication hint:
+error hint:
+
+ c1 | c2 | c3 | c4 | c1 | c2 | c3 | c4 | c1 | c2 | c3 | c4
+----+----+----+----+----+----+----+----+----+----+----+----
+(0 rows)
+
--- /dev/null
+LOAD 'pg_hint_plan';
+SET pg_hint_plan.enable_hint TO on;
+SET pg_hint_plan.debug_print TO on;
+SET client_min_messages TO LOG;
+SET search_path TO public;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(6 rows)
+
+----
+---- No. J-1-1 specified pattern of the object name
+----
+-- No. J-1-1-1
+/*+HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+-- No. J-1-1-2
+/*+HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 t_1, s1.t2 t_2 WHERE t_1.c1 = t_2.c1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+HashJoin(t1 t2)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------
+ Merge Join
+ Merge Cond: (t_1.c1 = t_2.c1)
+ -> Index Scan using t1_i1 on t1 t_1
+ -> Sort
+ Sort Key: t_2.c1
+ -> Seq Scan on t2 t_2
+(6 rows)
+
+-- No. J-1-1-3
+/*+HashJoin(t_1 t_2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 t_1, s1.t2 t_2 WHERE t_1.c1 = t_2.c1;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t_1 t_2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------
+ Hash Join
+ Hash Cond: (t_1.c1 = t_2.c1)
+ -> Seq Scan on t1 t_1
+ -> Hash
+ -> Seq Scan on t2 t_2
+(5 rows)
+
+----
+---- No. J-1-2 specified schema name in the hint option
+----
+-- No. J-1-2-1
+/*+HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+-- No. J-1-2-2
+/*+HashJoin(s1.t1 s1.t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+HashJoin(s1.t1 s1.t2)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(6 rows)
+
+----
+---- No. J-1-3 table doesn't exist in the hint option
+----
+-- No. J-1-3-1
+/*+HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+-- No. J-1-3-2
+/*+HashJoin(t3 t4)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+HashJoin(t3 t4)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(6 rows)
+
+----
+---- No. J-1-4 conflict table name
+----
+-- No. J-1-4-1
+/*+HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+-- No. J-1-4-2
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s2.t1 WHERE s1.t1.c1 = s2.t1.c1;
+ QUERY PLAN
+-------------------------------------
+ Merge Join
+ Merge Cond: (s1.t1.c1 = s2.t1.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: s2.t1.c1
+ -> Seq Scan on t1
+(6 rows)
+
+/*+HashJoin(t1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s2.t1 WHERE s1.t1.c1 = s2.t1.c1;
+INFO: hint syntax error at or near "HashJoin(t1 t1)"
+DETAIL: Relation name "t1" is ambiguous.
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+HashJoin(t1 t1)
+
+ QUERY PLAN
+-------------------------------------
+ Merge Join
+ Merge Cond: (s1.t1.c1 = s2.t1.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: s2.t1.c1
+ -> Seq Scan on t1
+(6 rows)
+
+/*+HashJoin(s1.t1 s2.t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s2.t1 WHERE s1.t1.c1 = s2.t1.c1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+HashJoin(s1.t1 s2.t1)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------
+ Merge Join
+ Merge Cond: (s1.t1.c1 = s2.t1.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: s2.t1.c1
+ -> Seq Scan on t1
+(6 rows)
+
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s2.t1 s2t1 WHERE s1.t1.c1 = s2t1.c1;
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = s2t1.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: s2t1.c1
+ -> Seq Scan on t1 s2t1
+(6 rows)
+
+/*+HashJoin(t1 s2t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s2.t1 s2t1 WHERE s1.t1.c1 = s2t1.c1;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(s2t1 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = s2t1.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t1 s2t1
+(5 rows)
+
+-- No. J-1-4-3
+EXPLAIN (COSTS false) SELECT *, (SELECT max(t1.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+ QUERY PLAN
+-------------------------------------------------------
+ Merge Join
+ Merge Cond: (s1.t1.c1 = s1.t2.c1)
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (s1.t1.c1 = s1.t2.c1)
+ -> Index Only Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: s1.t2.c1
+ -> Seq Scan on t2
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: s1.t2.c1
+ -> Seq Scan on t2
+(14 rows)
+
+/*+HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT *, (SELECT max(t1.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------
+ Hash Join
+ Hash Cond: (s1.t1.c1 = s1.t2.c1)
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Hash Join
+ Hash Cond: (s1.t1.c1 = s1.t2.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(12 rows)
+
+/*+NestLoop(st1 st2)HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT *, (SELECT max(st1.c1) FROM s1.t1 st1, s1.t2 st2 WHERE st1.c1 = st2.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+NestLoop(st1 st2)
+HashJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ InitPlan 1 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ -> Seq Scan on t2 st2
+ -> Index Only Scan using t1_i1 on t1 st1
+ Index Cond: (c1 = st2.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(11 rows)
+
+----
+---- No. J-1-5 conflict table name
+----
+-- No. J-1-5-1
+/*+HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+-- No. J-1-5-2
+/*+HashJoin(t1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+INFO: hint syntax error at or near "HashJoin(t1 t1)"
+DETAIL: Relation name "t1" is duplicated.
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+HashJoin(t1 t1)
+
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(6 rows)
+
+-- No. J-1-5-3
+/*+HashJoin(t1 t1)HashJoin(t2 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+INFO: hint syntax error at or near "HashJoin(t1 t1)HashJoin(t2 t2)"
+DETAIL: Relation name "t1" is duplicated.
+INFO: hint syntax error at or near "HashJoin(t2 t2)"
+DETAIL: Relation name "t2" is duplicated.
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+HashJoin(t1 t1)
+HashJoin(t2 t2)
+
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(6 rows)
+
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+ QUERY PLAN
+------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t3.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t3_i1 on t3
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(9 rows)
+
+/*+HashJoin(t1 t2 t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+INFO: hint syntax error at or near "HashJoin(t1 t2 t1 t2)"
+DETAIL: Relation name "t1" is duplicated.
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+HashJoin(t1 t1 t2 t2)
+
+ QUERY PLAN
+------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t4.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t3.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t3_i1 on t3
+ -> Index Scan using t4_i1 on t4
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(12 rows)
+
+----
+---- No. J-1-6 object type for the hint
+----
+-- No. J-1-6-1
+/*+HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+-- No. J-1-6-2
+EXPLAIN (COSTS false) SELECT * FROM s1.p1 t1, s1.p1 t2 WHERE t1.c1 = t2.c1;
+ QUERY PLAN
+---------------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Append
+ -> Seq Scan on p1 t1
+ -> Seq Scan on p1c1 t1
+ -> Seq Scan on p1c2 t1
+ -> Seq Scan on p1c3 t1
+ -> Hash
+ -> Append
+ -> Seq Scan on p1 t2
+ -> Seq Scan on p1c1 t2
+ -> Seq Scan on p1c2 t2
+ -> Seq Scan on p1c3 t2
+(13 rows)
+
+/*+NestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.p1 t1, s1.p1 t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+NestLoop(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------
+ Nested Loop
+ -> Append
+ -> Seq Scan on p1 t1
+ -> Seq Scan on p1c1 t1
+ -> Seq Scan on p1c2 t1
+ -> Seq Scan on p1c3 t1
+ -> Append
+ -> Seq Scan on p1 t2
+ Filter: (t1.c1 = c1)
+ -> Index Scan using p1c1_i on p1c1 t2
+ Index Cond: (c1 = t1.c1)
+ -> Index Scan using p1c2_i on p1c2 t2
+ Index Cond: (c1 = t1.c1)
+ -> Index Scan using p1c3_i on p1c3 t2
+ Index Cond: (c1 = t1.c1)
+(15 rows)
+
+-- No. J-1-6-3
+EXPLAIN (COSTS false) SELECT * FROM s1.ul1 t1, s1.ul1 t2 WHERE t1.c1 = t2.c1;
+ QUERY PLAN
+--------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on ul1 t1
+ -> Hash
+ -> Seq Scan on ul1 t2
+(5 rows)
+
+/*+NestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ul1 t1, s1.ul1 t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+NestLoop(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------
+ Nested Loop
+ -> Seq Scan on ul1 t1
+ -> Index Scan using ul1_pkey on ul1 t2
+ Index Cond: (c1 = t1.c1)
+(4 rows)
+
+-- No. J-1-6-4
+CREATE TEMP TABLE tm1 (LIKE s1.t1 INCLUDING ALL);
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "tm1_pkey" for table "tm1"
+EXPLAIN (COSTS false) SELECT * FROM tm1 t1, tm1 t2 WHERE t1.c1 = t2.c1;
+ QUERY PLAN
+--------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on tm1 t1
+ -> Hash
+ -> Seq Scan on tm1 t2
+(5 rows)
+
+/*+NestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM tm1 t1, tm1 t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+NestLoop(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------
+ Nested Loop
+ -> Seq Scan on tm1 t1
+ -> Index Scan using tm1_pkey on tm1 t2
+ Index Cond: (c1 = t1.c1)
+(4 rows)
+
+-- No. J-1-6-5
+EXPLAIN (COSTS false) SELECT * FROM pg_catalog.pg_class t1, pg_catalog.pg_class t2 WHERE t1.oid = t2.oid;
+ QUERY PLAN
+-------------------------------------
+ Hash Join
+ Hash Cond: (t1.oid = t2.oid)
+ -> Seq Scan on pg_class t1
+ -> Hash
+ -> Seq Scan on pg_class t2
+(5 rows)
+
+/*+NestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM pg_catalog.pg_class t1, pg_catalog.pg_class t2 WHERE t1.oid = t2.oid;
+LOG: pg_hint_plan:
+used hint:
+NestLoop(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------------------
+ Nested Loop
+ -> Seq Scan on pg_class t1
+ -> Index Scan using pg_class_oid_index on pg_class t2
+ Index Cond: (oid = t1.oid)
+(4 rows)
+
+-- No. J-1-6-6
+-- refer ut-fdw.sql
+-- No. J-1-6-7
+EXPLAIN (COSTS false) SELECT * FROM s1.f1() t1, s1.f1() t2 WHERE t1.c1 = t2.c1;
+ QUERY PLAN
+--------------------------------
+ Nested Loop
+ Join Filter: (t1.c1 = t2.c1)
+ -> Function Scan on f1 t1
+ -> Function Scan on f1 t2
+(4 rows)
+
+/*+HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.f1() t1, s1.f1() t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Function Scan on f1 t1
+ -> Hash
+ -> Function Scan on f1 t2
+(5 rows)
+
+-- No. J-1-6-8
+EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1'), (2,2,2,'2'), (3,3,3,'3')) AS t1 (c1, c2, c3, c4), s1.t2 WHERE t1.c1 = t2.c1;
+ QUERY PLAN
+-------------------------------------------
+ Hash Join
+ Hash Cond: (t2.c1 = "*VALUES*".column1)
+ -> Seq Scan on t2
+ -> Hash
+ -> Values Scan on "*VALUES*"
+(5 rows)
+
+/*+NestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1'), (2,2,2,'2'), (3,3,3,'3')) AS t1 (c1, c2, c3, c4), s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+NestLoop(t1 t2)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------
+ Hash Join
+ Hash Cond: (t2.c1 = "*VALUES*".column1)
+ -> Seq Scan on t2
+ -> Hash
+ -> Values Scan on "*VALUES*"
+(5 rows)
+
+/*+NestLoop(*VALUES* t2)*/
+EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1'), (2,2,2,'2'), (3,3,3,'3')) AS t1 (c1, c2, c3, c4), s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+NestLoop(*VALUES* t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------
+ Nested Loop
+ Join Filter: ("*VALUES*".column1 = t2.c1)
+ -> Seq Scan on t2
+ -> Materialize
+ -> Values Scan on "*VALUES*"
+(5 rows)
+
+-- No. J-1-6-9
+EXPLAIN (COSTS false) WITH c1(c1) AS (SELECT max(t1.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1) SELECT * FROM s1.t1, c1 WHERE t1.c1 = c1.c1;
+ QUERY PLAN
+-------------------------------------------------------
+ Nested Loop
+ CTE c1
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (s1.t1.c1 = t2.c1)
+ -> Index Only Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+ -> CTE Scan on c1
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = c1.c1)
+(12 rows)
+
+/*+NestLoop(t1 t2)HashJoin(t1 c1)*/
+EXPLAIN (COSTS false) WITH c1(c1) AS (SELECT max(t1.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1) SELECT * FROM s1.t1, c1 WHERE t1.c1 = c1.c1;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(c1 t1)
+NestLoop(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------
+ Hash Join
+ Hash Cond: (s1.t1.c1 = c1.c1)
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ -> Seq Scan on t2
+ -> Index Only Scan using t1_i1 on t1
+ Index Cond: (c1 = t2.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> CTE Scan on c1
+(11 rows)
+
+-- No. J-1-6-10
+EXPLAIN (COSTS false) SELECT * FROM s1.v1 t1, s1.v1 t2 WHERE t1.c1 = t2.c1;
+ QUERY PLAN
+----------------------------------
+ Hash Join
+ Hash Cond: (v1t1.c1 = v1t1.c1)
+ -> Seq Scan on t1 v1t1
+ -> Hash
+ -> Seq Scan on t1 v1t1
+(5 rows)
+
+/*+NestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.v1 t1, s1.v1 t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+NestLoop(t1 t2)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Hash Join
+ Hash Cond: (v1t1.c1 = v1t1.c1)
+ -> Seq Scan on t1 v1t1
+ -> Hash
+ -> Seq Scan on t1 v1t1
+(5 rows)
+
+/*+NestLoop(v1t1 v1t1_)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.v1 t1, s1.v1_ t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+NestLoop(v1t1 v1t1_)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Seq Scan on t1 v1t1
+ -> Index Scan using t1_i1 on t1 v1t1_
+ Index Cond: (c1 = v1t1.c1)
+(4 rows)
+
+-- No. J-1-6-11
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1 AND t1.c1 = (SELECT max(st1.c1) FROM s1.t1 st1, s1.t2 st2 WHERE st1.c1 = st2.c1);
+ QUERY PLAN
+-----------------------------------------------------------
+ Nested Loop
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (st1.c1 = st2.c1)
+ -> Index Only Scan using t1_i1 on t1 st1
+ -> Sort
+ Sort Key: st2.c1
+ -> Seq Scan on t2 st2
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = $0)
+ -> Seq Scan on t2
+ Filter: (c1 = $0)
+(13 rows)
+
+/*+MergeJoin(t1 t2)NestLoop(st1 st2)*/
+EXPLAIN (COSTS true) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1 AND t1.c1 = (SELECT max(st1.c1) FROM s1.t1 st1, s1.t2 st2 WHERE st1.c1 = st2.c1);
+LOG: pg_hint_plan:
+used hint:
+NestLoop(st1 st2)
+MergeJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------------------------------------
+ Nested Loop (cost=10000000074.46..10000000084.99 rows=1 width=29)
+ InitPlan 1 (returns $1)
+ -> Aggregate (cost=74.45..74.46 rows=1 width=4)
+ -> Nested Loop (cost=0.00..74.20 rows=100 width=4)
+ -> Seq Scan on t2 st2 (cost=0.00..2.00 rows=100 width=4)
+ -> Index Only Scan using t1_i1 on t1 st1 (cost=0.00..0.71 rows=1 width=4)
+ Index Cond: (c1 = st2.c1)
+ -> Index Scan using t1_i1 on t1 (cost=0.00..8.27 rows=1 width=15)
+ Index Cond: (c1 = $1)
+ -> Seq Scan on t2 (cost=0.00..2.25 rows=1 width=14)
+ Filter: (c1 = $1)
+(11 rows)
+
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, (SELECT t2.c1 FROM s1.t2) st2 WHERE t1.c1 = st2.c1;
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(6 rows)
+
+/*+HashJoin(t1 st2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, (SELECT t2.c1 FROM s1.t2) st2 WHERE t1.c1 = st2.c1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+HashJoin(st2 t1)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(6 rows)
+
+/*+HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, (SELECT t2.c1 FROM s1.t2) st2 WHERE t1.c1 = st2.c1;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+----
+---- No. J-2-1 complexity query block
+----
+-- No. J-2-1-1
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1), (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+;
+ QUERY PLAN
+-------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(47 rows)
+
+/*+
+Leading(bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2)
+MergeJoin(bmt1 bmt2)HashJoin(bmt1 bmt2 bmt3)NestLoop(bmt1 bmt2 bmt3 bmt4)
+MergeJoin(b1t2 b1t3)HashJoin(b1t2 b1t3 b1t4)NestLoop(b1t2 b1t3 b1t4 b1t1)
+MergeJoin(b2t3 b2t4)HashJoin(b2t3 b2t4 b2t1)NestLoop(b2t3 b2t4 b2t1 b2t2)
+*/
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1), (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+;
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(b1t2 b1t3)
+MergeJoin(b2t3 b2t4)
+MergeJoin(bmt1 bmt2)
+HashJoin(b1t2 b1t3 b1t4)
+HashJoin(b2t1 b2t3 b2t4)
+HashJoin(bmt1 bmt2 bmt3)
+NestLoop(b1t1 b1t2 b1t3 b1t4)
+NestLoop(b2t1 b2t2 b2t3 b2t4)
+NestLoop(bmt1 bmt2 bmt3 bmt4)
+Leading(bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t1.c1)
+ -> Hash Join
+ Hash Cond: (b1t4.c1 = b1t2.c1)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (b1t2.c1 = b1t3.c1)
+ -> Sort
+ Sort Key: b1t2.c1
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b1t3.c1
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Hash Join
+ Hash Cond: (b2t1.c1 = b2t3.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (b2t3.c1 = b2t4.c1)
+ -> Sort
+ Sort Key: b2t3.c1
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b2t4.c1
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Hash Join
+ Hash Cond: (bmt3.c1 = bmt1.c1)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt2.c1)
+ -> Sort
+ Sort Key: bmt1.c1
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: bmt2.c1
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(62 rows)
+
+-- No. J-2-1-2
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1), (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+), (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+;
+ QUERY PLAN
+-------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t4.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t3.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t2.c1)
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(63 rows)
+
+/*+
+Leading(bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2 b3t4 b3t1 b3t2 b3t3)
+MergeJoin(bmt1 bmt2)HashJoin(bmt1 bmt2 bmt3)NestLoop(bmt1 bmt2 bmt3 bmt4)
+MergeJoin(b1t2 b1t3)HashJoin(b1t2 b1t3 b1t4)NestLoop(b1t2 b1t3 b1t4 b1t1)
+MergeJoin(b2t3 b2t4)HashJoin(b2t3 b2t4 b2t1)NestLoop(b2t3 b2t4 b2t1 b2t2)
+MergeJoin(b3t4 b3t1)HashJoin(b3t4 b3t1 b3t2)NestLoop(b3t1 b3t2 b3t3 b3t4)
+*/
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1), (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+), (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+;
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(b1t2 b1t3)
+MergeJoin(b2t3 b2t4)
+MergeJoin(b3t1 b3t4)
+MergeJoin(bmt1 bmt2)
+HashJoin(b1t2 b1t3 b1t4)
+HashJoin(b2t1 b2t3 b2t4)
+HashJoin(b3t1 b3t2 b3t4)
+HashJoin(bmt1 bmt2 bmt3)
+NestLoop(b1t1 b1t2 b1t3 b1t4)
+NestLoop(b2t1 b2t2 b2t3 b2t4)
+NestLoop(b3t1 b3t2 b3t3 b3t4)
+NestLoop(bmt1 bmt2 bmt3 bmt4)
+Leading(bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2 b3t4 b3t1 b3t2 b3t3)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t1.c1)
+ -> Hash Join
+ Hash Cond: (b1t4.c1 = b1t2.c1)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (b1t2.c1 = b1t3.c1)
+ -> Sort
+ Sort Key: b1t2.c1
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b1t3.c1
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Hash Join
+ Hash Cond: (b2t1.c1 = b2t3.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (b2t3.c1 = b2t4.c1)
+ -> Sort
+ Sort Key: b2t3.c1
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b2t4.c1
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t3.c1)
+ -> Hash Join
+ Hash Cond: (b3t2.c1 = b3t1.c1)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (b3t1.c1 = b3t4.c1)
+ -> Sort
+ Sort Key: b3t1.c1
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b3t4.c1
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Hash Join
+ Hash Cond: (bmt3.c1 = bmt1.c1)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt2.c1)
+ -> Sort
+ Sort Key: bmt1.c1
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: bmt2.c1
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(83 rows)
+
+-- No. J-2-1-3
+EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, (SELECT ctid, * FROM s1.t3 bmt3) sbmt3, (SELECT ctid, * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = sbmt3.c1 AND sbmt3.ctid = '(1,1)' AND bmt1.c1 = sbmt4.c1 AND sbmt4.ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(15 rows)
+
+/*+
+Leading(bmt4 bmt3 bmt2 bmt1)
+MergeJoin(bmt4 bmt3)HashJoin(bmt4 bmt3 bmt2)NestLoop(bmt1 bmt2 bmt3 bmt4)
+*/
+EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, (SELECT ctid, * FROM s1.t3 bmt3) sbmt3, (SELECT ctid, * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = sbmt3.c1 AND sbmt3.ctid = '(1,1)' AND bmt1.c1 = sbmt4.c1 AND sbmt4.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(bmt3 bmt4)
+HashJoin(bmt2 bmt3 bmt4)
+NestLoop(bmt1 bmt2 bmt3 bmt4)
+Leading(bmt4 bmt3 bmt2 bmt1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (bmt2.c1 = bmt1.c1)
+ -> Hash Join
+ Hash Cond: (bmt2.c1 = bmt3.c1)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (bmt3.c1 = bmt4.c1)
+ -> Sort
+ Sort Key: bmt3.c1
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: bmt4.c1
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+(20 rows)
+
+-- No. J-2-1-4
+EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, (SELECT ctid, * FROM s1.t2 bmt2) sbmt2, (SELECT ctid, * FROM s1.t3 bmt3) sbmt3, (SELECT ctid, * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = sbmt2.c1 AND sbmt2.ctid = '(1,1)' AND bmt1.c1 = sbmt3.c1 AND sbmt3.ctid = '(1,1)' AND bmt1.c1 = sbmt4.c1 AND sbmt4.ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(15 rows)
+
+/*+
+Leading(bmt4 bmt3 bmt2 bmt1)
+MergeJoin(bmt4 bmt3)HashJoin(bmt4 bmt3 bmt2)NestLoop(bmt1 bmt2 bmt3 bmt4)
+*/
+EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, (SELECT ctid, * FROM s1.t2 bmt2) sbmt2, (SELECT ctid, * FROM s1.t3 bmt3) sbmt3, (SELECT ctid, * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = sbmt2.c1 AND sbmt2.ctid = '(1,1)' AND bmt1.c1 = sbmt3.c1 AND sbmt3.ctid = '(1,1)' AND bmt1.c1 = sbmt4.c1 AND sbmt4.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(bmt3 bmt4)
+HashJoin(bmt2 bmt3 bmt4)
+NestLoop(bmt1 bmt2 bmt3 bmt4)
+Leading(bmt4 bmt3 bmt2 bmt1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (bmt2.c1 = bmt1.c1)
+ -> Hash Join
+ Hash Cond: (bmt2.c1 = bmt3.c1)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (bmt3.c1 = bmt4.c1)
+ -> Sort
+ Sort Key: bmt3.c1
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: bmt4.c1
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+(20 rows)
+
+-- No. J-2-1-5
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+ AND bmt1.c1 <> (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+) AND bmt1.c1 <> (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+;
+ QUERY PLAN
+-------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 <> $0) AND (c1 <> $1))
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(48 rows)
+
+/*+
+Leading(bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2)
+MergeJoin(bmt1 bmt2)HashJoin(bmt1 bmt2 bmt3)NestLoop(bmt1 bmt2 bmt3 bmt4)
+MergeJoin(b1t2 b1t3)HashJoin(b1t2 b1t3 b1t4)NestLoop(b1t2 b1t3 b1t4 b1t1)
+MergeJoin(b2t3 b2t4)HashJoin(b2t3 b2t4 b2t1)NestLoop(b2t3 b2t4 b2t1 b2t2)
+*/
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+ AND bmt1.c1 <> (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+) AND bmt1.c1 <> (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+;
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(b1t2 b1t3)
+MergeJoin(b2t3 b2t4)
+MergeJoin(bmt1 bmt2)
+HashJoin(b1t2 b1t3 b1t4)
+HashJoin(b2t1 b2t3 b2t4)
+HashJoin(bmt1 bmt2 bmt3)
+NestLoop(b1t1 b1t2 b1t3 b1t4)
+NestLoop(b2t1 b2t2 b2t3 b2t4)
+NestLoop(bmt1 bmt2 bmt3 bmt4)
+Leading(bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t1.c1)
+ -> Hash Join
+ Hash Cond: (b1t4.c1 = b1t2.c1)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (b1t2.c1 = b1t3.c1)
+ -> Sort
+ Sort Key: b1t2.c1
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b1t3.c1
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Hash Join
+ Hash Cond: (b2t1.c1 = b2t3.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (b2t3.c1 = b2t4.c1)
+ -> Sort
+ Sort Key: b2t3.c1
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b2t4.c1
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Hash Join
+ Hash Cond: (bmt3.c1 = bmt1.c1)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt2.c1)
+ -> Sort
+ Sort Key: bmt1.c1
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 <> $0) AND (c1 <> $1))
+ -> Sort
+ Sort Key: bmt2.c1
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(63 rows)
+
+-- No. J-2-1-6
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+ AND bmt1.c1 <> (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+) AND bmt1.c1 <> (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+) AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+;
+ QUERY PLAN
+------------------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t4.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t3.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t2.c1)
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 <> $0) AND (c1 <> $1) AND (c1 <> $2))
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(64 rows)
+
+/*+
+Leading(bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2 b3t4 b3t1 b3t2 b3t3)
+MergeJoin(bmt1 bmt2)HashJoin(bmt1 bmt2 bmt3)NestLoop(bmt1 bmt2 bmt3 bmt4)
+MergeJoin(b1t2 b1t3)HashJoin(b1t2 b1t3 b1t4)NestLoop(b1t2 b1t3 b1t4 b1t1)
+MergeJoin(b2t3 b2t4)HashJoin(b2t3 b2t4 b2t1)NestLoop(b2t3 b2t4 b2t1 b2t2)
+MergeJoin(b3t4 b3t1)HashJoin(b3t4 b3t1 b3t2)NestLoop(b3t1 b3t2 b3t3 b3t4)
+*/
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+ AND bmt1.c1 <> (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+) AND bmt1.c1 <> (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+) AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+;
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(b1t2 b1t3)
+MergeJoin(b2t3 b2t4)
+MergeJoin(b3t1 b3t4)
+MergeJoin(bmt1 bmt2)
+HashJoin(b1t2 b1t3 b1t4)
+HashJoin(b2t1 b2t3 b2t4)
+HashJoin(b3t1 b3t2 b3t4)
+HashJoin(bmt1 bmt2 bmt3)
+NestLoop(b1t1 b1t2 b1t3 b1t4)
+NestLoop(b2t1 b2t2 b2t3 b2t4)
+NestLoop(b3t1 b3t2 b3t3 b3t4)
+NestLoop(bmt1 bmt2 bmt3 bmt4)
+Leading(bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2 b3t4 b3t1 b3t2 b3t3)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t1.c1)
+ -> Hash Join
+ Hash Cond: (b1t4.c1 = b1t2.c1)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (b1t2.c1 = b1t3.c1)
+ -> Sort
+ Sort Key: b1t2.c1
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b1t3.c1
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Hash Join
+ Hash Cond: (b2t1.c1 = b2t3.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (b2t3.c1 = b2t4.c1)
+ -> Sort
+ Sort Key: b2t3.c1
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b2t4.c1
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t3.c1)
+ -> Hash Join
+ Hash Cond: (b3t2.c1 = b3t1.c1)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (b3t1.c1 = b3t4.c1)
+ -> Sort
+ Sort Key: b3t1.c1
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b3t4.c1
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Hash Join
+ Hash Cond: (bmt3.c1 = bmt1.c1)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt2.c1)
+ -> Sort
+ Sort Key: bmt1.c1
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 <> $0) AND (c1 <> $1) AND (c1 <> $2))
+ -> Sort
+ Sort Key: bmt2.c1
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(84 rows)
+
+-- No. J-2-1-7
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+, c2 (c1) AS (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
+, c1, c2
+ WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 = c2.c1
+;
+ QUERY PLAN
+-----------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ CTE c2
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = c2.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = c1.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> CTE Scan on c1
+ -> CTE Scan on c2
+(53 rows)
+
+/*+
+Leading(c2 c1 bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2)
+MergeJoin(c2 c1)HashJoin(c2 c1 bmt1)NestLoop(c2 c1 bmt1 bmt2)MergeJoin(c2 c1 bmt1 bmt2 bmt3)HashJoin(c2 c1 bmt1 bmt2 bmt3 bmt4)
+MergeJoin(b1t2 b1t3)HashJoin(b1t2 b1t3 b1t4)NestLoop(b1t2 b1t3 b1t4 b1t1)
+MergeJoin(b2t3 b2t4)HashJoin(b2t3 b2t4 b2t1)NestLoop(b2t3 b2t4 b2t1 b2t2)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+, c2 (c1) AS (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
+, c1, c2
+ WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 = c2.c1
+;
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(b1t2 b1t3)
+MergeJoin(b2t3 b2t4)
+MergeJoin(c1 c2)
+HashJoin(b1t2 b1t3 b1t4)
+HashJoin(b2t1 b2t3 b2t4)
+HashJoin(bmt1 c1 c2)
+NestLoop(b1t1 b1t2 b1t3 b1t4)
+NestLoop(b2t1 b2t2 b2t3 b2t4)
+NestLoop(bmt1 bmt2 c1 c2)
+MergeJoin(bmt1 bmt2 bmt3 c1 c2)
+HashJoin(bmt1 bmt2 bmt3 bmt4 c1 c2)
+Leading(c2 c1 bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t1.c1)
+ -> Hash Join
+ Hash Cond: (b1t4.c1 = b1t2.c1)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (b1t2.c1 = b1t3.c1)
+ -> Sort
+ Sort Key: b1t2.c1
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b1t3.c1
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ CTE c2
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Hash Join
+ Hash Cond: (b2t1.c1 = b2t3.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (b2t3.c1 = b2t4.c1)
+ -> Sort
+ Sort Key: b2t3.c1
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b2t4.c1
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash Join
+ Hash Cond: (bmt4.c1 = bmt1.c1)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt3.c1)
+ -> Sort
+ Sort Key: bmt1.c1
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Hash Join
+ Hash Cond: (bmt1.c1 = c1.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (c1.c1 = c2.c1)
+ -> Sort
+ Sort Key: c1.c1
+ -> CTE Scan on c1
+ -> Sort
+ Sort Key: c2.c1
+ -> CTE Scan on c2
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: bmt3.c1
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+(73 rows)
+
+-- No. J-2-1-8
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+, c2 (c1) AS (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+, c3 (c1) AS (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
+, c1, c2, c3
+ WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 = c2.c1
+AND bmt1.c1 = c3.c1
+;
+ QUERY PLAN
+-----------------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ CTE c2
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ CTE c3
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t4.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t3.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t2.c1)
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = c3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = c2.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = c1.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> CTE Scan on c1
+ -> CTE Scan on c2
+ -> CTE Scan on c3
+(72 rows)
+
+/*+
+Leading(c3 c2 c1 bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2 b3t4 b3t1 b3t2 b3t3)
+MergeJoin(c3 c2)HashJoin(c3 c2 c1)NestLoop(c3 c2 c1 bmt1)MergeJoin(c3 c2 c1 bmt1 bmt2)HashJoin(c3 c2 c1 bmt1 bmt2 bmt3)NestLoop(c3 c2 c1 bmt1 bmt2 bmt3 bmt4)
+MergeJoin(b1t2 b1t3)HashJoin(b1t2 b1t3 b1t4)NestLoop(b1t2 b1t3 b1t4 b1t1)
+MergeJoin(b2t3 b2t4)HashJoin(b2t3 b2t4 b2t1)NestLoop(b2t3 b2t4 b2t1 b2t2)
+MergeJoin(b3t4 b3t1)HashJoin(b3t4 b3t1 b3t2)NestLoop(b3t1 b3t2 b3t3 b3t4)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+, c2 (c1) AS (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+, c3 (c1) AS (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
+, c1, c2, c3
+ WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 = c2.c1
+AND bmt1.c1 = c3.c1
+;
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(b1t2 b1t3)
+MergeJoin(b2t3 b2t4)
+MergeJoin(b3t1 b3t4)
+MergeJoin(c2 c3)
+HashJoin(b1t2 b1t3 b1t4)
+HashJoin(b2t1 b2t3 b2t4)
+HashJoin(b3t1 b3t2 b3t4)
+HashJoin(c1 c2 c3)
+NestLoop(b1t1 b1t2 b1t3 b1t4)
+NestLoop(b2t1 b2t2 b2t3 b2t4)
+NestLoop(b3t1 b3t2 b3t3 b3t4)
+NestLoop(bmt1 c1 c2 c3)
+MergeJoin(bmt1 bmt2 c1 c2 c3)
+HashJoin(bmt1 bmt2 bmt3 c1 c2 c3)
+NestLoop(bmt1 bmt2 bmt3 bmt4 c1 c2 c3)
+Leading(c3 c2 c1 bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2 b3t4 b3t1 b3t2 b3t3)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t1.c1)
+ -> Hash Join
+ Hash Cond: (b1t4.c1 = b1t2.c1)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (b1t2.c1 = b1t3.c1)
+ -> Sort
+ Sort Key: b1t2.c1
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b1t3.c1
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ CTE c2
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Hash Join
+ Hash Cond: (b2t1.c1 = b2t3.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (b2t3.c1 = b2t4.c1)
+ -> Sort
+ Sort Key: b2t3.c1
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b2t4.c1
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ CTE c3
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t3.c1)
+ -> Hash Join
+ Hash Cond: (b3t2.c1 = b3t1.c1)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (b3t1.c1 = b3t4.c1)
+ -> Sort
+ Sort Key: b3t1.c1
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b3t4.c1
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Hash Join
+ Hash Cond: (bmt3.c1 = bmt1.c1)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt2.c1)
+ -> Sort
+ Sort Key: bmt1.c1
+ -> Nested Loop
+ Join Filter: (c1.c1 = bmt1.c1)
+ -> Hash Join
+ Hash Cond: (c2.c1 = c1.c1)
+ -> Merge Join
+ Merge Cond: (c2.c1 = c3.c1)
+ -> Sort
+ Sort Key: c2.c1
+ -> CTE Scan on c2
+ -> Sort
+ Sort Key: c3.c1
+ -> CTE Scan on c3
+ -> Hash
+ -> CTE Scan on c1
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: bmt2.c1
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(97 rows)
+
+----
+---- No. J-2-2 the number of the tables per quiry block
+----
+-- No. J-2-2-1
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = 1
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = 1
+)
+ FROM s1.t1 bmt1, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = 1
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = 1
+)
+;
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Result
+ InitPlan 1 (returns $0)
+ -> Limit
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 4 (returns $3)
+ -> Result
+ InitPlan 3 (returns $2)
+ -> Limit
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 6 (returns $5)
+ -> Result
+ InitPlan 5 (returns $4)
+ -> Limit
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 IS NOT NULL) AND (c1 = 1))
+ -> Nested Loop
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 <> $5) AND (c1 = 1))
+ -> CTE Scan on c1
+ Filter: (c1 = 1)
+(28 rows)
+
+/*+
+Leading(c1 bmt1 b1t1 b2t1 b3t1)
+HashJoin(bmt1 c1)
+HashJoin(b1t1 c1)
+HashJoin(b2t1 c1)
+HashJoin(b3t1 c1)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = 1
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = 1
+)
+ FROM s1.t1 bmt1, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = 1
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = 1
+)
+;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(bmt1 c1)
+Leading(c1 bmt1 b1t1 b2t1 b3t1)
+not used hint:
+HashJoin(b1t1 c1)
+HashJoin(b2t1 c1)
+HashJoin(b3t1 c1)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Result
+ InitPlan 1 (returns $0)
+ -> Limit
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 4 (returns $3)
+ -> Result
+ InitPlan 3 (returns $2)
+ -> Limit
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 6 (returns $5)
+ -> Result
+ InitPlan 5 (returns $4)
+ -> Limit
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 IS NOT NULL) AND (c1 = 1))
+ -> Nested Loop
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 <> $5) AND (c1 = 1))
+ -> CTE Scan on c1
+ Filter: (c1 = 1)
+(28 rows)
+
+-- No. J-2-2-2
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)'
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)'
+)
+;
+ QUERY PLAN
+-------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t2.c1)
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = c1.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 <> $2)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> CTE Scan on c1
+(35 rows)
+
+/*+
+Leading(c1 bmt2 b1t2 b2t2 b3t2 bmt1 b1t1 b2t1 b3t1)
+MergeJoin(c1 bmt2)
+HashJoin(c1 bmt1 bmt2)
+MergeJoin(b1t1 b1t2)
+MergeJoin(b2t1 b2t2)
+MergeJoin(b3t1 b3t2)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)'
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)'
+)
+;
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(b1t1 b1t2)
+MergeJoin(b2t1 b2t2)
+MergeJoin(b3t1 b3t2)
+MergeJoin(bmt2 c1)
+HashJoin(bmt1 bmt2 c1)
+Leading(c1 bmt2 b1t2 b2t2 b3t2 bmt1 b1t1 b2t1 b3t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t2.c1)
+ -> Sort
+ Sort Key: b1t1.c1
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b1t2.c1
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (b2t1.c1 = b2t2.c1)
+ -> Sort
+ Sort Key: b2t1.c1
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b2t2.c1
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (b3t1.c1 = b3t2.c1)
+ -> Sort
+ Sort Key: b3t1.c1
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b3t2.c1
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash Join
+ Hash Cond: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 <> $2)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (bmt2.c1 = c1.c1)
+ -> Sort
+ Sort Key: bmt2.c1
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: c1.c1
+ -> CTE Scan on c1
+(52 rows)
+
+-- No. J-2-2-3
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+;
+ QUERY PLAN
+-------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t4.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t3.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t2.c1)
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = c1.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 <> $2)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> CTE Scan on c1
+(67 rows)
+
+/*+
+Leading(c1 bmt4 b1t4 b2t4 b3t4 bmt3 b1t3 b2t3 b3t3 bmt2 b1t2 b2t2 b3t2 bmt1 b1t1 b2t1 b3t1)
+MergeJoin(c1 bmt4)
+HashJoin(c1 bmt4 bmt3)
+NestLoop(c1 bmt4 bmt3 bmt2)
+MergeJoin(c1 bmt4 bmt3 bmt2 bmt1)
+HashJoin(b1t4 b1t3)
+NestLoop(b1t4 b1t3 b1t2)
+MergeJoin(b1t4 b1t3 b1t2 b1t1)
+HashJoin(b2t4 b2t3)
+NestLoop(b2t4 b2t3 b2t2)
+MergeJoin(b2t4 b2t3 b2t2 b2t1)
+HashJoin(b3t4 b3t3)
+NestLoop(b3t4 b3t3 b3t2)
+MergeJoin(b3t4 b3t3 b3t2 b3t1)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(b1t3 b1t4)
+HashJoin(b2t3 b2t4)
+HashJoin(b3t3 b3t4)
+MergeJoin(bmt4 c1)
+NestLoop(b1t2 b1t3 b1t4)
+NestLoop(b2t2 b2t3 b2t4)
+NestLoop(b3t2 b3t3 b3t4)
+HashJoin(bmt3 bmt4 c1)
+MergeJoin(b1t1 b1t2 b1t3 b1t4)
+MergeJoin(b2t1 b2t2 b2t3 b2t4)
+MergeJoin(b3t1 b3t2 b3t3 b3t4)
+NestLoop(bmt2 bmt3 bmt4 c1)
+MergeJoin(bmt1 bmt2 bmt3 bmt4 c1)
+Leading(c1 bmt4 b1t4 b2t4 b3t4 bmt3 b1t3 b2t3 b3t3 bmt2 b1t2 b2t2 b3t2 bmt1 b1t1 b2t1 b3t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (b1t2.c1 = b1t1.c1)
+ -> Sort
+ Sort Key: b1t2.c1
+ -> Nested Loop
+ Join Filter: (b1t3.c1 = b1t2.c1)
+ -> Hash Join
+ Hash Cond: (b1t3.c1 = b1t4.c1)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b1t1.c1
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (b2t2.c1 = b2t1.c1)
+ -> Sort
+ Sort Key: b2t2.c1
+ -> Nested Loop
+ Join Filter: (b2t3.c1 = b2t2.c1)
+ -> Hash Join
+ Hash Cond: (b2t3.c1 = b2t4.c1)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b2t1.c1
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (b3t2.c1 = b3t1.c1)
+ -> Sort
+ Sort Key: b3t2.c1
+ -> Nested Loop
+ Join Filter: (b3t3.c1 = b3t2.c1)
+ -> Hash Join
+ Hash Cond: (b3t3.c1 = b3t4.c1)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b3t1.c1
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Merge Join
+ Merge Cond: (bmt2.c1 = bmt1.c1)
+ -> Sort
+ Sort Key: bmt2.c1
+ -> Nested Loop
+ Join Filter: (bmt3.c1 = bmt2.c1)
+ -> Hash Join
+ Hash Cond: (bmt3.c1 = bmt4.c1)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (bmt4.c1 = c1.c1)
+ -> Sort
+ Sort Key: bmt4.c1
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: c1.c1
+ -> CTE Scan on c1
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: bmt1.c1
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 <> $2)
+(91 rows)
+
+-- No. J-2-2-4
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = 1
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)'
+)
+;
+ QUERY PLAN
+-------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $2)
+ -> Result
+ InitPlan 2 (returns $1)
+ -> Limit
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 4 (returns $3)
+ -> Aggregate
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = c1.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 <> $3)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> CTE Scan on c1
+(46 rows)
+
+/*+
+Leading(c1 bmt4 b1t4 bmt3 b1t3 bmt2 b1t2 bmt1 b1t1 b2t1 b3t1)
+MergeJoin(c1 bmt4)
+HashJoin(c1 bmt4 bmt3)
+NestLoop(c1 bmt4 bmt3 bmt2)
+MergeJoin(c1 bmt4 bmt3 bmt2 bmt1)
+MergeJoin(b1t4 b1t3)
+HashJoin(b1t4 b1t3 b1t2)
+NestLoop(b1t4 b1t3 b1t2 b1t1)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = 1
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)'
+)
+;
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(b1t3 b1t4)
+MergeJoin(bmt4 c1)
+HashJoin(b1t2 b1t3 b1t4)
+HashJoin(bmt3 bmt4 c1)
+NestLoop(b1t1 b1t2 b1t3 b1t4)
+NestLoop(bmt2 bmt3 bmt4 c1)
+MergeJoin(bmt1 bmt2 bmt3 bmt4 c1)
+Leading(c1 bmt4 b1t4 bmt3 b1t3 bmt2 b1t2 bmt1 b1t1 b2t1 b3t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t1.c1)
+ -> Hash Join
+ Hash Cond: (b1t2.c1 = b1t3.c1)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (b1t3.c1 = b1t4.c1)
+ -> Sort
+ Sort Key: b1t3.c1
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b1t4.c1
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $2)
+ -> Result
+ InitPlan 2 (returns $1)
+ -> Limit
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 4 (returns $3)
+ -> Aggregate
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Merge Join
+ Merge Cond: (bmt2.c1 = bmt1.c1)
+ -> Sort
+ Sort Key: bmt2.c1
+ -> Nested Loop
+ Join Filter: (bmt3.c1 = bmt2.c1)
+ -> Hash Join
+ Hash Cond: (bmt3.c1 = bmt4.c1)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (bmt4.c1 = c1.c1)
+ -> Sort
+ Sort Key: bmt4.c1
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: c1.c1
+ -> CTE Scan on c1
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: bmt1.c1
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 <> $3)
+(60 rows)
+
+----
+---- No. J-2-3 RULE definition table
+----
+-- No. J-2-3-1
+EXPLAIN (COSTS false) UPDATE s1.r1 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(19 rows)
+
+/*+
+Leading(t4 t3 t2 t1 r1)
+MergeJoin(t4 t3 t2 t1 r1)
+HashJoin(t4 t3 t2 t1)
+NestLoop(t4 t3 t2)
+MergeJoin(t4 t3)
+*/
+EXPLAIN (COSTS false) UPDATE s1.r1 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(t3 t4)
+NestLoop(t2 t3 t4)
+HashJoin(t1 t2 t3 t4)
+MergeJoin(r1 t1 t2 t3 t4)
+Leading(t4 t3 t2 t1 r1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Nested Loop
+ Join Filter: (t3.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t3.c1 = t4.c1)
+ -> Sort
+ Sort Key: t3.c1
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: t4.c1
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(24 rows)
+
+EXPLAIN (COSTS false) UPDATE s1.r1_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r1_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(19 rows)
+
+/*+
+Leading(b1t4 b1t3 b1t2 b1t1 r1_)
+MergeJoin(b1t4 b1t3 b1t2 b1t1 r1_)
+HashJoin(b1t4 b1t3 b1t2 b1t1)
+NestLoop(b1t4 b1t3 b1t2)
+MergeJoin(b1t4 b1t3)
+*/
+EXPLAIN (COSTS false) UPDATE s1.r1_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(b1t3 b1t4)
+NestLoop(b1t2 b1t3 b1t4)
+HashJoin(b1t1 b1t2 b1t3 b1t4)
+MergeJoin(b1t1 b1t2 b1t3 b1t4 r1_)
+Leading(b1t4 b1t3 b1t2 b1t1 r1_)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Nested Loop
+ Join Filter: (b1t3.c1 = b1t2.c1)
+ -> Merge Join
+ Merge Cond: (b1t3.c1 = b1t4.c1)
+ -> Sort
+ Sort Key: b1t3.c1
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b1t4.c1
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r1_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(24 rows)
+
+-- No. J-2-3-2
+EXPLAIN (COSTS false) UPDATE s1.r2 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r2
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r2
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(39 rows)
+
+/*+
+Leading(t4 t3 t2 t1 r2)
+MergeJoin(t4 t3 t2 t1 r2)
+HashJoin(t4 t3 t2 t1)
+NestLoop(t4 t3 t2)
+MergeJoin(t4 t3)
+*/
+EXPLAIN (COSTS false) UPDATE s1.r2 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(t3 t4)
+NestLoop(t2 t3 t4)
+HashJoin(t1 t2 t3 t4)
+MergeJoin(r2 t1 t2 t3 t4)
+Leading(t4 t3 t2 t1 r2)
+not used hint:
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(t3 t4)
+NestLoop(t2 t3 t4)
+HashJoin(t1 t2 t3 t4)
+MergeJoin(r2 t1 t2 t3 t4)
+Leading(t4 t3 t2 t1 r2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Nested Loop
+ Join Filter: (t3.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t3.c1 = t4.c1)
+ -> Sort
+ Sort Key: t3.c1
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: t4.c1
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r2
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+
+ Aggregate
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Nested Loop
+ Join Filter: (t3.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t3.c1 = t4.c1)
+ -> Sort
+ Sort Key: t3.c1
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: t4.c1
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r2
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(49 rows)
+
+EXPLAIN (COSTS false) UPDATE s1.r2_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r2_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r2_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(39 rows)
+
+/*+Leading(
+b1t1 b1t2 b1t3 b1t4
+b2t1 b2t2 b2t3 b2t4 r2_
+)
+MergeJoin(b1t1 b1t2)
+HashJoin(b1t1 b1t2 b1t3)
+NestLoop(b1t1 b1t2 b1t3 b1t4)
+MergeJoin(b1t1 b1t2 b1t3 b1t4 r2_)
+MergeJoin(b2t1 b2t2)
+HashJoin(b2t1 b2t2 b2t3)
+NestLoop(b2t1 b2t2 b2t3 b2t4)
+MergeJoin(b2t1 b2t2 b2t3 b2t4 r2_)
+*/
+EXPLAIN (COSTS false) UPDATE s1.r2_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(b1t1 b1t2)
+HashJoin(b1t1 b1t2 b1t3)
+NestLoop(b1t1 b1t2 b1t3 b1t4)
+MergeJoin(b1t1 b1t2 b1t3 b1t4 r2_)
+Leading(b1t1 b1t2 b1t3 b1t4 b2t1 b2t2 b2t3 b2t4 r2_)
+not used hint:
+MergeJoin(b2t1 b2t2)
+HashJoin(b2t1 b2t2 b2t3)
+NestLoop(b2t1 b2t2 b2t3 b2t4)
+MergeJoin(b2t1 b2t2 b2t3 b2t4 r2_)
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(b2t1 b2t2)
+HashJoin(b2t1 b2t2 b2t3)
+NestLoop(b2t1 b2t2 b2t3 b2t4)
+MergeJoin(b2t1 b2t2 b2t3 b2t4 r2_)
+Leading(b1t1 b1t2 b1t3 b1t4 b2t1 b2t2 b2t3 b2t4 r2_)
+not used hint:
+MergeJoin(b1t1 b1t2)
+HashJoin(b1t1 b1t2 b1t3)
+NestLoop(b1t1 b1t2 b1t3 b1t4)
+MergeJoin(b1t1 b1t2 b1t3 b1t4 r2_)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Hash Join
+ Hash Cond: (b1t3.c1 = b1t1.c1)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t2.c1)
+ -> Sort
+ Sort Key: b1t1.c1
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b1t2.c1
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r2_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Hash Join
+ Hash Cond: (b2t3.c1 = b2t1.c1)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (b2t1.c1 = b2t2.c1)
+ -> Sort
+ Sort Key: b2t1.c1
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b2t2.c1
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r2_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(49 rows)
+
+-- No. J-2-3-3
+EXPLAIN (COSTS false) UPDATE s1.r3 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r3
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r3
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r3
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(59 rows)
+
+/*+
+Leading(t4 t3 t2 t1 r3)
+MergeJoin(t4 t3 t2 t1 r3)
+HashJoin(t4 t3 t2 t1)
+NestLoop(t4 t3 t2)
+MergeJoin(t4 t3)
+*/
+EXPLAIN (COSTS false) UPDATE s1.r3 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(t3 t4)
+NestLoop(t2 t3 t4)
+HashJoin(t1 t2 t3 t4)
+MergeJoin(r3 t1 t2 t3 t4)
+Leading(t4 t3 t2 t1 r3)
+not used hint:
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(t3 t4)
+NestLoop(t2 t3 t4)
+HashJoin(t1 t2 t3 t4)
+MergeJoin(r3 t1 t2 t3 t4)
+Leading(t4 t3 t2 t1 r3)
+not used hint:
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(t3 t4)
+NestLoop(t2 t3 t4)
+HashJoin(t1 t2 t3 t4)
+MergeJoin(r3 t1 t2 t3 t4)
+Leading(t4 t3 t2 t1 r3)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Nested Loop
+ Join Filter: (t3.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t3.c1 = t4.c1)
+ -> Sort
+ Sort Key: t3.c1
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: t4.c1
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r3
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+
+ Aggregate
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Nested Loop
+ Join Filter: (t3.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t3.c1 = t4.c1)
+ -> Sort
+ Sort Key: t3.c1
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: t4.c1
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r3
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+
+ Aggregate
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Nested Loop
+ Join Filter: (t3.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t3.c1 = t4.c1)
+ -> Sort
+ Sort Key: t3.c1
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: t4.c1
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r3
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(74 rows)
+
+EXPLAIN (COSTS false) UPDATE s1.r3_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r3_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r3_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t4.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t3.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r3_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(59 rows)
+
+/*+Leading(
+b1t1 b1t2 b1t3 b1t4
+b2t1 b2t2 b2t3 b2t4
+b3t1 b3t2 b3t3 b3t4 r3_
+)
+MergeJoin(b1t1 b1t2)
+HashJoin(b1t1 b1t2 b1t3)
+NestLoop(b1t1 b1t2 b1t3 b1t4)
+MergeJoin(b1t1 b1t2 b1t3 b1t4 r3_)
+MergeJoin(b2t1 b2t2)
+HashJoin(b2t1 b2t2 b2t3)
+NestLoop(b2t1 b2t2 b2t3 b2t4)
+MergeJoin(b2t1 b2t2 b2t3 b2t4 r3_)
+MergeJoin(b3t1 b3t2)
+HashJoin(b3t1 b3t2 b3t3)
+NestLoop(b3t1 b3t2 b3t3 b3t4)
+MergeJoin(b3t1 b3t2 b3t3 b3t4 r3_)
+*/
+EXPLAIN (COSTS false) UPDATE s1.r3_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(b1t1 b1t2)
+HashJoin(b1t1 b1t2 b1t3)
+NestLoop(b1t1 b1t2 b1t3 b1t4)
+MergeJoin(b1t1 b1t2 b1t3 b1t4 r3_)
+Leading(b1t1 b1t2 b1t3 b1t4 b2t1 b2t2 b2t3 b2t4 b3t1 b3t2 b3t3 b3t4 r3_)
+not used hint:
+MergeJoin(b2t1 b2t2)
+MergeJoin(b3t1 b3t2)
+HashJoin(b2t1 b2t2 b2t3)
+HashJoin(b3t1 b3t2 b3t3)
+NestLoop(b2t1 b2t2 b2t3 b2t4)
+NestLoop(b3t1 b3t2 b3t3 b3t4)
+MergeJoin(b2t1 b2t2 b2t3 b2t4 r3_)
+MergeJoin(b3t1 b3t2 b3t3 b3t4 r3_)
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(b2t1 b2t2)
+HashJoin(b2t1 b2t2 b2t3)
+NestLoop(b2t1 b2t2 b2t3 b2t4)
+MergeJoin(b2t1 b2t2 b2t3 b2t4 r3_)
+Leading(b1t1 b1t2 b1t3 b1t4 b2t1 b2t2 b2t3 b2t4 b3t1 b3t2 b3t3 b3t4 r3_)
+not used hint:
+MergeJoin(b1t1 b1t2)
+MergeJoin(b3t1 b3t2)
+HashJoin(b1t1 b1t2 b1t3)
+HashJoin(b3t1 b3t2 b3t3)
+NestLoop(b1t1 b1t2 b1t3 b1t4)
+NestLoop(b3t1 b3t2 b3t3 b3t4)
+MergeJoin(b1t1 b1t2 b1t3 b1t4 r3_)
+MergeJoin(b3t1 b3t2 b3t3 b3t4 r3_)
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(b3t1 b3t2)
+HashJoin(b3t1 b3t2 b3t3)
+NestLoop(b3t1 b3t2 b3t3 b3t4)
+MergeJoin(b3t1 b3t2 b3t3 b3t4 r3_)
+Leading(b1t1 b1t2 b1t3 b1t4 b2t1 b2t2 b2t3 b2t4 b3t1 b3t2 b3t3 b3t4 r3_)
+not used hint:
+MergeJoin(b1t1 b1t2)
+MergeJoin(b2t1 b2t2)
+HashJoin(b1t1 b1t2 b1t3)
+HashJoin(b2t1 b2t2 b2t3)
+NestLoop(b1t1 b1t2 b1t3 b1t4)
+NestLoop(b2t1 b2t2 b2t3 b2t4)
+MergeJoin(b1t1 b1t2 b1t3 b1t4 r3_)
+MergeJoin(b2t1 b2t2 b2t3 b2t4 r3_)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Hash Join
+ Hash Cond: (b1t3.c1 = b1t1.c1)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t2.c1)
+ -> Sort
+ Sort Key: b1t1.c1
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b1t2.c1
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r3_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Hash Join
+ Hash Cond: (b2t3.c1 = b2t1.c1)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (b2t1.c1 = b2t2.c1)
+ -> Sort
+ Sort Key: b2t1.c1
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b2t2.c1
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r3_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t4.c1)
+ -> Hash Join
+ Hash Cond: (b3t3.c1 = b3t1.c1)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Hash
+ -> Merge Join
+ Merge Cond: (b3t1.c1 = b3t2.c1)
+ -> Sort
+ Sort Key: b3t1.c1
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: b3t2.c1
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r3_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(74 rows)
+
+----
+---- No. J-2-4 VALUES clause
+----
+-- No. J-2-4-1
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+ QUERY PLAN
+-------------------------------------------------
+ Nested Loop
+ -> Hash Join
+ Hash Cond: (t2.c1 = "*VALUES*".column1)
+ -> Seq Scan on t2
+ -> Hash
+ -> Values Scan on "*VALUES*"
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = t2.c1)
+(8 rows)
+
+/*+ Leading(t3 t1 t2) HashJoin(t3 t1)NestLoop(t3 t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t3 t1 t2)
+not used hint:
+HashJoin(t1 t3)
+NestLoop(t1 t2 t3)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------
+ Nested Loop
+ Join Filter: (t1.c1 = "*VALUES*".column1)
+ -> Values Scan on "*VALUES*"
+ -> Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(9 rows)
+
+/*+ Leading(*VALUES* t1 t2) HashJoin(*VALUES* t1)NestLoop(*VALUES* t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(*VALUES* t1)
+NestLoop(*VALUES* t1 t2)
+Leading(*VALUES* t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------
+ Nested Loop
+ -> Hash Join
+ Hash Cond: (t1.c1 = "*VALUES*".column1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Values Scan on "*VALUES*"
+ -> Index Scan using t2_i1 on t2
+ Index Cond: (c1 = t1.c1)
+(8 rows)
+
+-- No. J-2-4-2
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4), (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t4 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+ QUERY PLAN
+-------------------------------------------------------
+ Nested Loop
+ Join Filter: (t1.c1 = "*VALUES*".column1)
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (t2.c1 = "*VALUES*".column1)
+ -> Seq Scan on t2
+ -> Hash
+ -> Values Scan on "*VALUES*"
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = t2.c1)
+ -> Values Scan on "*VALUES*"
+(11 rows)
+
+/*+ Leading(t4 t3 t2 t1) NestLoop(t4 t3)HashJoin(t4 t3 t2)MergeJoin(t4 t3 t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4), (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t4 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t3 t2 t1)
+not used hint:
+NestLoop(t3 t4)
+HashJoin(t2 t3 t4)
+MergeJoin(t1 t2 t3 t4)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------
+ Nested Loop
+ Join Filter: (t1.c1 = "*VALUES*".column1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = "*VALUES*".column1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+ -> Values Scan on "*VALUES*"
+ -> Values Scan on "*VALUES*"
+(12 rows)
+
+/*+ Leading(*VALUES* t3 t2 t1) NestLoop(t4 t3)HashJoin(*VALUES* t3 t2)MergeJoin(*VALUES* t3 t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4), (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t4 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+INFO: hint syntax error at or near "HashJoin(*VALUES* t3 t2)MergeJoin(*VALUES* t3 t2 t1)"
+DETAIL: Relation name "*VALUES*" is ambiguous.
+INFO: hint syntax error at or near "MergeJoin(*VALUES* t3 t2 t1)"
+DETAIL: Relation name "*VALUES*" is ambiguous.
+INFO: hint syntax error at or near "Leading(*VALUES* t3 t2 t1) NestLoop(t4 t3)HashJoin(*VALUES* t3 t2)MergeJoin(*VALUES* t3 t2 t1)"
+DETAIL: Relation name "*VALUES*" is ambiguous.
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+NestLoop(t3 t4)
+Leading(*VALUES* t3 t2 t1)
+duplication hint:
+error hint:
+HashJoin(*VALUES* t2 t3)
+MergeJoin(*VALUES* t1 t2 t3)
+
+ QUERY PLAN
+-------------------------------------------------------
+ Nested Loop
+ Join Filter: (t1.c1 = "*VALUES*".column1)
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (t2.c1 = "*VALUES*".column1)
+ -> Seq Scan on t2
+ -> Hash
+ -> Values Scan on "*VALUES*"
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = t2.c1)
+ -> Values Scan on "*VALUES*"
+(11 rows)
+
+----
+---- No. J-3-1 join method hint
+----
+-- No. J-3-1-1~6
+SET enable_nestloop TO on;
+SET enable_mergejoin TO off;
+SET enable_hashjoin TO off;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+ QUERY PLAN
+------------------------------------
+ Nested Loop
+ -> Seq Scan on t2
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = t2.c1)
+(4 rows)
+
+/*+NestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+NestLoop(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Nested Loop
+ -> Seq Scan on t2
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = t2.c1)
+(4 rows)
+
+/*+HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+/*+MergeJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(6 rows)
+
+SET enable_mergejoin TO on;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1 AND t1.ctid = '(1,1)';;
+ QUERY PLAN
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.c1 = t2.c1)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+(5 rows)
+
+/*+NoNestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1 AND t1.ctid = '(1,1)';;
+LOG: pg_hint_plan:
+used hint:
+NoNestLoop(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Sort
+ Sort Key: t1.c1
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(9 rows)
+
+SET enable_mergejoin TO off;
+/*+NoHashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+NoHashJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Nested Loop
+ -> Seq Scan on t2
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = t2.c1)
+(4 rows)
+
+/*+NoMergeJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+NoMergeJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Nested Loop
+ -> Seq Scan on t2
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = t2.c1)
+(4 rows)
+
+-- No. J-3-1-7~12
+SET enable_nestloop TO off;
+SET enable_mergejoin TO off;
+SET enable_hashjoin TO on;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+/*+NestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+NestLoop(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Nested Loop
+ -> Seq Scan on t2
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = t2.c1)
+(4 rows)
+
+/*+HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+/*+MergeJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(6 rows)
+
+/*+NoNestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+NoNestLoop(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+/*+NoHashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+NoHashJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Nested Loop
+ -> Seq Scan on t2
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = t2.c1)
+(4 rows)
+
+/*+NoMergeJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+NoMergeJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+-- No. J-3-1-13~18
+SET enable_nestloop TO off;
+SET enable_mergejoin TO on;
+SET enable_hashjoin TO off;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(6 rows)
+
+/*+NestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+NestLoop(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Nested Loop
+ -> Seq Scan on t2
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = t2.c1)
+(4 rows)
+
+/*+HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Seq Scan on t2
+(5 rows)
+
+/*+MergeJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(6 rows)
+
+/*+NoNestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+NoNestLoop(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(6 rows)
+
+/*+NoHashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+NoHashJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(6 rows)
+
+/*+NoMergeJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+NoMergeJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Nested Loop
+ -> Seq Scan on t2
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = t2.c1)
+(4 rows)
+
+SET enable_nestloop TO on;
+SET enable_mergejoin TO on;
+SET enable_hashjoin TO on;
+----
+---- No. J-3-2 join inherit tables
+----
+EXPLAIN (COSTS false) SELECT * FROM s1.p1, s1.p2 WHERE p1.c1 = p2.c1;
+ QUERY PLAN
+---------------------------------------
+ Hash Join
+ Hash Cond: (s1.p2.c1 = s1.p1.c1)
+ -> Append
+ -> Seq Scan on p2
+ -> Seq Scan on p2c1 p2
+ -> Seq Scan on p2c2 p2
+ -> Seq Scan on p2c3 p2
+ -> Seq Scan on p2c1c1 p2
+ -> Seq Scan on p2c1c2 p2
+ -> Seq Scan on p2c2c1 p2
+ -> Seq Scan on p2c2c2 p2
+ -> Seq Scan on p2c3c1 p2
+ -> Seq Scan on p2c3c2 p2
+ -> Hash
+ -> Append
+ -> Seq Scan on p1
+ -> Seq Scan on p1c1 p1
+ -> Seq Scan on p1c2 p1
+ -> Seq Scan on p1c3 p1
+(19 rows)
+
+-- No. J-3-2-1
+/*+MergeJoin(p1 p2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.p1, s1.p2 WHERE p1.c1 = p2.c1;
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(p1 p2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Merge Join
+ Merge Cond: (s1.p1.c1 = s1.p2.c1)
+ -> Sort
+ Sort Key: s1.p1.c1
+ -> Append
+ -> Seq Scan on p1
+ -> Seq Scan on p1c1 p1
+ -> Seq Scan on p1c2 p1
+ -> Seq Scan on p1c3 p1
+ -> Sort
+ Sort Key: s1.p2.c1
+ -> Append
+ -> Seq Scan on p2
+ -> Seq Scan on p2c1 p2
+ -> Seq Scan on p2c2 p2
+ -> Seq Scan on p2c3 p2
+ -> Seq Scan on p2c1c1 p2
+ -> Seq Scan on p2c1c2 p2
+ -> Seq Scan on p2c2c1 p2
+ -> Seq Scan on p2c2c2 p2
+ -> Seq Scan on p2c3c1 p2
+ -> Seq Scan on p2c3c2 p2
+(22 rows)
+
+-- No. J-3-2-2
+/*+MergeJoin(p1c1 p2c1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.p1, s1.p2 WHERE p1.c1 = p2.c1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+MergeJoin(p1c1 p2c1)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------
+ Hash Join
+ Hash Cond: (s1.p2.c1 = s1.p1.c1)
+ -> Append
+ -> Seq Scan on p2
+ -> Seq Scan on p2c1 p2
+ -> Seq Scan on p2c2 p2
+ -> Seq Scan on p2c3 p2
+ -> Seq Scan on p2c1c1 p2
+ -> Seq Scan on p2c1c2 p2
+ -> Seq Scan on p2c2c1 p2
+ -> Seq Scan on p2c2c2 p2
+ -> Seq Scan on p2c3c1 p2
+ -> Seq Scan on p2c3c2 p2
+ -> Hash
+ -> Append
+ -> Seq Scan on p1
+ -> Seq Scan on p1c1 p1
+ -> Seq Scan on p1c2 p1
+ -> Seq Scan on p1c3 p1
+(19 rows)
+
+----
+---- No. J-3-3 conflict join method hint
+----
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+ QUERY PLAN
+------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(6 rows)
+
+-- No. J-3-3-1
+/*+HashJoin(t1 t2)NestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+INFO: hint syntax error at or near "HashJoin(t1 t2)NestLoop(t1 t2)"
+DETAIL: Conflict join method hint.
+LOG: pg_hint_plan:
+used hint:
+NestLoop(t1 t2)
+not used hint:
+duplication hint:
+HashJoin(t1 t2)
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Nested Loop
+ -> Seq Scan on t2
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = t2.c1)
+(4 rows)
+
+-- No. J-3-3-2
+/*+MergeJoin(t1 t2)HashJoin(t1 t2)NestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+INFO: hint syntax error at or near "MergeJoin(t1 t2)HashJoin(t1 t2)NestLoop(t1 t2)"
+DETAIL: Conflict join method hint.
+INFO: hint syntax error at or near "HashJoin(t1 t2)NestLoop(t1 t2)"
+DETAIL: Conflict join method hint.
+LOG: pg_hint_plan:
+used hint:
+NestLoop(t1 t2)
+not used hint:
+duplication hint:
+MergeJoin(t1 t2)
+HashJoin(t1 t2)
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Nested Loop
+ -> Seq Scan on t2
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = t2.c1)
+(4 rows)
+
+-- No. J-3-3-3
+/*+HashJoin(t1 t2)NestLoop(t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+INFO: hint syntax error at or near "HashJoin(t1 t2)NestLoop(t2 t1)"
+DETAIL: Conflict join method hint.
+LOG: pg_hint_plan:
+used hint:
+NestLoop(t1 t2)
+not used hint:
+duplication hint:
+HashJoin(t1 t2)
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Nested Loop
+ -> Seq Scan on t2
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = t2.c1)
+(4 rows)
+
+-- No. J-3-3-4
+/*+MergeJoin(t2 t1)HashJoin(t1 t2)NestLoop(t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+INFO: hint syntax error at or near "MergeJoin(t2 t1)HashJoin(t1 t2)NestLoop(t2 t1)"
+DETAIL: Conflict join method hint.
+INFO: hint syntax error at or near "HashJoin(t1 t2)NestLoop(t2 t1)"
+DETAIL: Conflict join method hint.
+LOG: pg_hint_plan:
+used hint:
+NestLoop(t1 t2)
+not used hint:
+duplication hint:
+MergeJoin(t1 t2)
+HashJoin(t1 t2)
+error hint:
+
+ QUERY PLAN
+------------------------------------
+ Nested Loop
+ -> Seq Scan on t2
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = t2.c1)
+(4 rows)
+
+----
+---- No. J-3-4 hint state output
+----
+-- No. J-3-4-1
+/*+NestLoop(t1 t2)*/
+SELECT * FROM s1.t1, s1.t2 WHERE false;
+LOG: pg_hint_plan:
+used hint:
+NestLoop(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ c1 | c2 | c3 | c4 | c1 | c2 | c3 | c4
+----+----+----+----+----+----+----+----
+(0 rows)
+
+-- No. J-3-4-2
+/*+HashJoin(t1 t2)*/
+SELECT * FROM s1.t1, s1.t2 WHERE false;
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ c1 | c2 | c3 | c4 | c1 | c2 | c3 | c4
+----+----+----+----+----+----+----+----
+(0 rows)
+
+-- No. J-3-4-3
+/*+MergeJoin(t1 t2)*/
+SELECT * FROM s1.t1, s1.t2 WHERE false;
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ c1 | c2 | c3 | c4 | c1 | c2 | c3 | c4
+----+----+----+----+----+----+----+----
+(0 rows)
+
+-- No. J-3-4-4
+/*+NoNestLoop(t1 t2)*/
+SELECT * FROM s1.t1, s1.t2 WHERE false;
+LOG: pg_hint_plan:
+used hint:
+NoNestLoop(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ c1 | c2 | c3 | c4 | c1 | c2 | c3 | c4
+----+----+----+----+----+----+----+----
+(0 rows)
+
+-- No. J-3-4-5
+/*+NoHashJoin(t1 t2)*/
+SELECT * FROM s1.t1, s1.t2 WHERE false;
+LOG: pg_hint_plan:
+used hint:
+NoHashJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ c1 | c2 | c3 | c4 | c1 | c2 | c3 | c4
+----+----+----+----+----+----+----+----
+(0 rows)
+
+-- No. J-3-4-6
+/*+NoMergeJoin(t1 t2)*/
+SELECT * FROM s1.t1, s1.t2 WHERE false;
+LOG: pg_hint_plan:
+used hint:
+NoMergeJoin(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ c1 | c2 | c3 | c4 | c1 | c2 | c3 | c4
+----+----+----+----+----+----+----+----
+(0 rows)
+
+-- No. J-3-4-7
+/*+NestLoop()*/
+SELECT * FROM s1.t1 WHERE false;
+INFO: hint syntax error at or near ")"
+DETAIL: Relation name is necessary.
+ c1 | c2 | c3 | c4
+----+----+----+----
+(0 rows)
+
+-- No. J-3-4-8
+/*+NestLoop(t1)*/
+SELECT * FROM s1.t1 WHERE false;
+INFO: hint syntax error at or near ")"
+DETAIL: NestLoop hint requires at least two relations.
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+NestLoop(t1)
+
+ c1 | c2 | c3 | c4
+----+----+----+----
+(0 rows)
+
+-- No. J-3-4-9
+/*+NestLoop(t1 t2)*/
+SELECT * FROM s1.t1, s1.t2 WHERE false;
+LOG: pg_hint_plan:
+used hint:
+NestLoop(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ c1 | c2 | c3 | c4 | c1 | c2 | c3 | c4
+----+----+----+----+----+----+----+----
+(0 rows)
+
+-- No. J-3-4-10
+/*+NestLoop(t1 t2 t3)*/
+SELECT * FROM s1.t1, s1.t2, s1.t3 WHERE false;
+LOG: pg_hint_plan:
+used hint:
+NestLoop(t1 t2 t3)
+not used hint:
+duplication hint:
+error hint:
+
+ c1 | c2 | c3 | c4 | c1 | c2 | c3 | c4 | c1 | c2 | c3 | c4
+----+----+----+----+----+----+----+----+----+----+----+----
+(0 rows)
+
--- /dev/null
+LOAD 'pg_hint_plan';
+SET pg_hint_plan.enable_hint TO on;
+SET pg_hint_plan.debug_print TO on;
+SET client_min_messages TO LOG;
+SET search_path TO public;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+ QUERY PLAN
+------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t4.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t3.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t3_i1 on t3
+ -> Index Scan using t4_i1 on t4
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(12 rows)
+
+----
+---- No. L-1-1 specified pattern of the object name
+----
+-- No. L-1-1-1
+/*+Leading(t4 t2 t3 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t2 t3 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Hash Join
+ Hash Cond: (t3.c1 = t2.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Hash Join
+ Hash Cond: (t4.c1 = t2.c1)
+ -> Seq Scan on t4
+ -> Hash
+ -> Seq Scan on t2
+(14 rows)
+
+-- No. L-1-1-2
+/*+Leading(t4 t2 t3 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 t_1, s1.t2 t_2, s1.t3 t_3, s1.t4 t_4 WHERE t_1.c1 = t_2.c1 AND t_1.c1 = t_3.c1 AND t_1.c1 = t_4.c1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+Leading(t4 t2 t3 t1)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------------
+ Merge Join
+ Merge Cond: (t_1.c1 = t_2.c1)
+ -> Merge Join
+ Merge Cond: (t_1.c1 = t_4.c1)
+ -> Merge Join
+ Merge Cond: (t_1.c1 = t_3.c1)
+ -> Index Scan using t1_i1 on t1 t_1
+ -> Index Scan using t3_i1 on t3 t_3
+ -> Index Scan using t4_i1 on t4 t_4
+ -> Sort
+ Sort Key: t_2.c1
+ -> Seq Scan on t2 t_2
+(12 rows)
+
+-- No. L-1-1-3
+/*+Leading(t_4 t_2 t_3 t_1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 t_1, s1.t2 t_2, s1.t3 t_3, s1.t4 t_4 WHERE t_1.c1 = t_2.c1 AND t_1.c1 = t_3.c1 AND t_1.c1 = t_4.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t_4 t_2 t_3 t_1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------------
+ Merge Join
+ Merge Cond: (t_1.c1 = t_2.c1)
+ -> Index Scan using t1_i1 on t1 t_1
+ -> Sort
+ Sort Key: t_2.c1
+ -> Hash Join
+ Hash Cond: (t_3.c1 = t_2.c1)
+ -> Seq Scan on t3 t_3
+ -> Hash
+ -> Hash Join
+ Hash Cond: (t_4.c1 = t_2.c1)
+ -> Seq Scan on t4 t_4
+ -> Hash
+ -> Seq Scan on t2 t_2
+(14 rows)
+
+----
+---- No. L-1-2 specified schema name in the hint option
+----
+-- No. L-1-2-1
+/*+Leading(t4 t2 t3 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t2 t3 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Hash Join
+ Hash Cond: (t3.c1 = t2.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Hash Join
+ Hash Cond: (t4.c1 = t2.c1)
+ -> Seq Scan on t4
+ -> Hash
+ -> Seq Scan on t2
+(14 rows)
+
+-- No. L-1-2-2
+/*+Leading(s1.t4 s1.t2 s1.t3 s1.t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+Leading(s1.t4 s1.t2 s1.t3 s1.t1)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t4.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t3.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t3_i1 on t3
+ -> Index Scan using t4_i1 on t4
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(12 rows)
+
+----
+---- No. L-1-3 table doesn't exist in the hint option
+----
+-- No. L-1-3-1
+/*+Leading(t4 t2 t3 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t2 t3 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Hash Join
+ Hash Cond: (t3.c1 = t2.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Hash Join
+ Hash Cond: (t4.c1 = t2.c1)
+ -> Seq Scan on t4
+ -> Hash
+ -> Seq Scan on t2
+(14 rows)
+
+-- No. L-1-3-2
+/*+Leading(t5 t2 t3 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t5 t2 t3 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------
+ Nested Loop
+ -> Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Hash Join
+ Hash Cond: (t3.c1 = t2.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Seq Scan on t2
+ -> Index Scan using t4_i1 on t4
+ Index Cond: (c1 = t1.c1)
+(13 rows)
+
+----
+---- No. L-1-4 conflict table name
+----
+-- No. L-1-4-1
+/*+Leading(t4 t2 t3 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t2 t3 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Hash Join
+ Hash Cond: (t3.c1 = t2.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Hash Join
+ Hash Cond: (t4.c1 = t2.c1)
+ -> Seq Scan on t4
+ -> Hash
+ -> Seq Scan on t2
+(14 rows)
+
+-- No. L-1-4-2
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s2.t1 WHERE s1.t1.c1 = t2.c1 AND s1.t1.c1 = t3.c1 AND s1.t1.c1 = s2.t1.c1;
+ QUERY PLAN
+------------------------------------------------
+ Merge Join
+ Merge Cond: (s1.t1.c1 = s2.t1.c1)
+ -> Merge Join
+ Merge Cond: (s1.t1.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (s1.t1.c1 = t3.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t3_i1 on t3
+ -> Index Scan using t2_i1 on t2
+ -> Sort
+ Sort Key: s2.t1.c1
+ -> Seq Scan on t1
+(12 rows)
+
+/*+Leading(t1 t2 t3 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s2.t1 WHERE s1.t1.c1 = t2.c1 AND s1.t1.c1 = t3.c1 AND s1.t1.c1 = s2.t1.c1;
+INFO: hint syntax error at or near "Leading(t1 t2 t3 t1)"
+DETAIL: Relation name "t1" is ambiguous.
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+Leading(t1 t2 t3 t1)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------
+ Merge Join
+ Merge Cond: (s1.t1.c1 = s2.t1.c1)
+ -> Merge Join
+ Merge Cond: (s1.t1.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (s1.t1.c1 = t3.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t3_i1 on t3
+ -> Index Scan using t2_i1 on t2
+ -> Sort
+ Sort Key: s2.t1.c1
+ -> Seq Scan on t1
+(12 rows)
+
+/*+Leading(s1.t1 t2 t3 s2.t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s2.t1 WHERE s1.t1.c1 = t2.c1 AND s1.t1.c1 = t3.c1 AND s1.t1.c1 = s2.t1.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(s1.t1 t2 t3 s2.t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------
+ Nested Loop
+ -> Nested Loop
+ -> Merge Join
+ Merge Cond: (t3.c1 = t2.c1)
+ -> Index Scan using t3_i1 on t3
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = t2.c1)
+(12 rows)
+
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s2.t1 s2t1 WHERE s1.t1.c1 = t2.c1 AND s1.t1.c1 = t3.c1 AND s1.t1.c1 = s2t1.c1;
+ QUERY PLAN
+------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = s2t1.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t3.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t3_i1 on t3
+ -> Index Scan using t2_i1 on t2
+ -> Sort
+ Sort Key: s2t1.c1
+ -> Seq Scan on t1 s2t1
+(12 rows)
+
+/*+Leading(s2t1 t1 t3 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s2.t1 s2t1 WHERE s1.t1.c1 = t2.c1 AND s1.t1.c1 = t3.c1 AND s1.t1.c1 = s2t1.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(s2t1 t1 t3 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t3.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = s2t1.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t1_pkey on t1 s2t1
+ -> Index Scan using t3_i1 on t3
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(12 rows)
+
+-- No. L-1-4-3
+EXPLAIN (COSTS false) SELECT *, (SELECT max(t1.c1) FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1) FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+ QUERY PLAN
+---------------------------------------------------------------
+ Merge Join
+ Merge Cond: (s1.t1.c1 = s1.t2.c1)
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (s1.t1.c1 = s1.t2.c1)
+ -> Merge Join
+ Merge Cond: (s1.t1.c1 = s1.t4.c1)
+ -> Merge Join
+ Merge Cond: (s1.t1.c1 = s1.t3.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t3_i1 on t3
+ -> Index Scan using t4_i1 on t4
+ -> Sort
+ Sort Key: s1.t2.c1
+ -> Seq Scan on t2
+ -> Merge Join
+ Merge Cond: (s1.t1.c1 = s1.t4.c1)
+ -> Merge Join
+ Merge Cond: (s1.t1.c1 = s1.t3.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t3_i1 on t3
+ -> Index Scan using t4_i1 on t4
+ -> Sort
+ Sort Key: s1.t2.c1
+ -> Seq Scan on t2
+(26 rows)
+
+/*+Leading(t4 t2 t3 t1)*/
+EXPLAIN (COSTS false) SELECT *, (SELECT max(t1.c1) FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1) FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t2 t3 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------------------------------
+ Merge Join
+ Merge Cond: (s1.t1.c1 = s1.t2.c1)
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (s1.t1.c1 = s1.t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: s1.t2.c1
+ -> Hash Join
+ Hash Cond: (s1.t3.c1 = s1.t2.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Hash Join
+ Hash Cond: (s1.t4.c1 = s1.t2.c1)
+ -> Seq Scan on t4
+ -> Hash
+ -> Seq Scan on t2
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: s1.t2.c1
+ -> Hash Join
+ Hash Cond: (s1.t3.c1 = s1.t2.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Hash Join
+ Hash Cond: (s1.t4.c1 = s1.t2.c1)
+ -> Seq Scan on t4
+ -> Hash
+ -> Seq Scan on t2
+(30 rows)
+
+/*+Leading(st1 st2 st3 st4 t4 t2 t3 t1)*/
+EXPLAIN (COSTS false) SELECT *, (SELECT max(st1.c1) FROM s1.t1 st1, s1.t2 st2, s1.t3 st3, s1.t4 st4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1) FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(st1 st2 st3 st4 t4 t2 t3 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Hash Join
+ Hash Cond: (t3.c1 = t2.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Hash Join
+ Hash Cond: (t4.c1 = t2.c1)
+ -> Seq Scan on t4
+ -> Hash
+ -> Seq Scan on t2
+ SubPlan 1
+ -> Aggregate
+ -> Result
+ One-Time Filter: ((t1.c1 = t2.c1) AND (t1.c1 = t3.c1) AND (t1.c1 = t4.c1))
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ -> Seq Scan on t1 st1
+ -> Materialize
+ -> Seq Scan on t2 st2
+ -> Materialize
+ -> Seq Scan on t3 st3
+ -> Materialize
+ -> Seq Scan on t4 st4
+(28 rows)
+
+----
+---- No. L-1-5 conflict table name
+----
+-- No. L-1-5-1
+/*+Leading(t4 t2 t3 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t2 t3 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Hash Join
+ Hash Cond: (t3.c1 = t2.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Hash Join
+ Hash Cond: (t4.c1 = t2.c1)
+ -> Seq Scan on t4
+ -> Hash
+ -> Seq Scan on t2
+(14 rows)
+
+-- No. L-1-5-2
+/*+Leading(t4 t2 t3 t1 t4)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t2 t3 t1 t4)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Hash Join
+ Hash Cond: (t3.c1 = t2.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Hash Join
+ Hash Cond: (t4.c1 = t2.c1)
+ -> Seq Scan on t4
+ -> Hash
+ -> Seq Scan on t2
+(14 rows)
+
+/*+Leading(t4 t2 t3 t4)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+INFO: hint syntax error at or near "Leading(t4 t2 t3 t4)"
+DETAIL: Relation name "t4" is duplicated.
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+Leading(t4 t2 t3 t4)
+
+ QUERY PLAN
+------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t4.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t3.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t3_i1 on t3
+ -> Index Scan using t4_i1 on t4
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(12 rows)
+
+-- No. L-1-5-3
+/*+Leading(t4 t2 t3 t1 t4 t2 t3 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t2 t3 t1 t4 t2 t3 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Hash Join
+ Hash Cond: (t3.c1 = t2.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Hash Join
+ Hash Cond: (t4.c1 = t2.c1)
+ -> Seq Scan on t4
+ -> Hash
+ -> Seq Scan on t2
+(14 rows)
+
+/*+Leading(t4 t2 t2 t4)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+INFO: hint syntax error at or near "Leading(t4 t2 t2 t4)"
+DETAIL: Relation name "t2" is duplicated.
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+Leading(t4 t2 t2 t4)
+
+ QUERY PLAN
+------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t4.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t3.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t3_i1 on t3
+ -> Index Scan using t4_i1 on t4
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(12 rows)
+
+----
+---- No. L-1-6 object type for the hint
+----
+-- No. L-1-6-1
+/*+Leading(t4 t2 t3 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t2 t3 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Hash Join
+ Hash Cond: (t3.c1 = t2.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Hash Join
+ Hash Cond: (t4.c1 = t2.c1)
+ -> Seq Scan on t4
+ -> Hash
+ -> Seq Scan on t2
+(14 rows)
+
+-- No. L-1-6-2
+EXPLAIN (COSTS false) SELECT * FROM s1.p1 t1, s1.p1 t2, s1.p1 t3, s1.p1 t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+ QUERY PLAN
+---------------------------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t4.c1)
+ -> Hash Join
+ Hash Cond: (t1.c1 = t3.c1)
+ -> Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Append
+ -> Seq Scan on p1 t1
+ -> Seq Scan on p1c1 t1
+ -> Seq Scan on p1c2 t1
+ -> Seq Scan on p1c3 t1
+ -> Hash
+ -> Append
+ -> Seq Scan on p1 t2
+ -> Seq Scan on p1c1 t2
+ -> Seq Scan on p1c2 t2
+ -> Seq Scan on p1c3 t2
+ -> Hash
+ -> Append
+ -> Seq Scan on p1 t3
+ -> Seq Scan on p1c1 t3
+ -> Seq Scan on p1c2 t3
+ -> Seq Scan on p1c3 t3
+ -> Hash
+ -> Append
+ -> Seq Scan on p1 t4
+ -> Seq Scan on p1c1 t4
+ -> Seq Scan on p1c2 t4
+ -> Seq Scan on p1c3 t4
+(29 rows)
+
+/*+Leading(t4 t3 t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.p1 t1, s1.p1 t2, s1.p1 t3, s1.p1 t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t3 t2 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------
+ Hash Join
+ Hash Cond: (t2.c1 = t1.c1)
+ -> Hash Join
+ Hash Cond: (t3.c1 = t2.c1)
+ -> Hash Join
+ Hash Cond: (t3.c1 = t4.c1)
+ -> Append
+ -> Seq Scan on p1 t3
+ -> Seq Scan on p1c1 t3
+ -> Seq Scan on p1c2 t3
+ -> Seq Scan on p1c3 t3
+ -> Hash
+ -> Append
+ -> Seq Scan on p1 t4
+ -> Seq Scan on p1c1 t4
+ -> Seq Scan on p1c2 t4
+ -> Seq Scan on p1c3 t4
+ -> Hash
+ -> Append
+ -> Seq Scan on p1 t2
+ -> Seq Scan on p1c1 t2
+ -> Seq Scan on p1c2 t2
+ -> Seq Scan on p1c3 t2
+ -> Hash
+ -> Append
+ -> Seq Scan on p1 t1
+ -> Seq Scan on p1c1 t1
+ -> Seq Scan on p1c2 t1
+ -> Seq Scan on p1c3 t1
+(29 rows)
+
+-- No. L-1-6-3
+EXPLAIN (COSTS false) SELECT * FROM s1.ul1 t1, s1.ul1 t2, s1.ul1 t3, s1.ul1 t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+ QUERY PLAN
+--------------------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t4.c1)
+ -> Hash Join
+ Hash Cond: (t1.c1 = t3.c1)
+ -> Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on ul1 t1
+ -> Hash
+ -> Seq Scan on ul1 t2
+ -> Hash
+ -> Seq Scan on ul1 t3
+ -> Hash
+ -> Seq Scan on ul1 t4
+(13 rows)
+
+/*+Leading(t4 t3 t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ul1 t1, s1.ul1 t2, s1.ul1 t3, s1.ul1 t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t3 t2 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------
+ Hash Join
+ Hash Cond: (t2.c1 = t1.c1)
+ -> Hash Join
+ Hash Cond: (t3.c1 = t2.c1)
+ -> Hash Join
+ Hash Cond: (t3.c1 = t4.c1)
+ -> Seq Scan on ul1 t3
+ -> Hash
+ -> Seq Scan on ul1 t4
+ -> Hash
+ -> Seq Scan on ul1 t2
+ -> Hash
+ -> Seq Scan on ul1 t1
+(13 rows)
+
+-- No. L-1-6-4
+CREATE TEMP TABLE tm1 (LIKE s1.t1 INCLUDING ALL);
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "tm1_pkey" for table "tm1"
+EXPLAIN (COSTS false) SELECT * FROM tm1 t1, tm1 t2, tm1 t3, tm1 t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+ QUERY PLAN
+--------------------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t4.c1)
+ -> Hash Join
+ Hash Cond: (t1.c1 = t3.c1)
+ -> Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on tm1 t1
+ -> Hash
+ -> Seq Scan on tm1 t2
+ -> Hash
+ -> Seq Scan on tm1 t3
+ -> Hash
+ -> Seq Scan on tm1 t4
+(13 rows)
+
+/*+Leading(t4 t3 t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM tm1 t1, tm1 t2, tm1 t3, tm1 t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t3 t2 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------
+ Hash Join
+ Hash Cond: (t2.c1 = t1.c1)
+ -> Hash Join
+ Hash Cond: (t3.c1 = t2.c1)
+ -> Hash Join
+ Hash Cond: (t3.c1 = t4.c1)
+ -> Seq Scan on tm1 t3
+ -> Hash
+ -> Seq Scan on tm1 t4
+ -> Hash
+ -> Seq Scan on tm1 t2
+ -> Hash
+ -> Seq Scan on tm1 t1
+(13 rows)
+
+-- No. L-1-6-5
+EXPLAIN (COSTS false) SELECT * FROM pg_catalog.pg_class t1, pg_catalog.pg_class t2, pg_catalog.pg_class t3, pg_catalog.pg_class t4 WHERE t1.oid = t2.oid AND t1.oid = t3.oid AND t1.oid = t4.oid;
+ QUERY PLAN
+-------------------------------------------------
+ Hash Join
+ Hash Cond: (t1.oid = t4.oid)
+ -> Hash Join
+ Hash Cond: (t1.oid = t3.oid)
+ -> Hash Join
+ Hash Cond: (t1.oid = t2.oid)
+ -> Seq Scan on pg_class t1
+ -> Hash
+ -> Seq Scan on pg_class t2
+ -> Hash
+ -> Seq Scan on pg_class t3
+ -> Hash
+ -> Seq Scan on pg_class t4
+(13 rows)
+
+/*+Leading(t4 t3 t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM pg_catalog.pg_class t1, pg_catalog.pg_class t2, pg_catalog.pg_class t3, pg_catalog.pg_class t4 WHERE t1.oid = t2.oid AND t1.oid = t3.oid AND t1.oid = t4.oid;
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t3 t2 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------
+ Hash Join
+ Hash Cond: (t2.oid = t1.oid)
+ -> Hash Join
+ Hash Cond: (t3.oid = t2.oid)
+ -> Hash Join
+ Hash Cond: (t3.oid = t4.oid)
+ -> Seq Scan on pg_class t3
+ -> Hash
+ -> Seq Scan on pg_class t4
+ -> Hash
+ -> Seq Scan on pg_class t2
+ -> Hash
+ -> Seq Scan on pg_class t1
+(13 rows)
+
+-- No. L-1-6-6
+-- refer ut-fdw.sql
+-- No. L-1-6-7
+EXPLAIN (COSTS false) SELECT * FROM s1.f1() t1, s1.f1() t2, s1.f1() t3, s1.f1() t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+ QUERY PLAN
+--------------------------------------------
+ Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t2.c1)
+ -> Function Scan on f1 t1
+ -> Function Scan on f1 t2
+ -> Function Scan on f1 t3
+ -> Function Scan on f1 t4
+(10 rows)
+
+/*+Leading(t4 t3 t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.f1() t1, s1.f1() t2, s1.f1() t3, s1.f1() t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t3 t2 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------
+ Nested Loop
+ Join Filter: (t2.c1 = t1.c1)
+ -> Nested Loop
+ Join Filter: (t3.c1 = t2.c1)
+ -> Nested Loop
+ Join Filter: (t3.c1 = t4.c1)
+ -> Function Scan on f1 t3
+ -> Function Scan on f1 t4
+ -> Function Scan on f1 t2
+ -> Function Scan on f1 t1
+(10 rows)
+
+-- No. L-1-6-8
+EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1')) AS t1 (c1, c2, c3, c4), s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+ QUERY PLAN
+-------------------------------------------------------
+ Nested Loop
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (t2.c1 = "*VALUES*".column1)
+ -> Seq Scan on t2
+ -> Hash
+ -> Values Scan on "*VALUES*"
+ -> Index Scan using t3_i1 on t3
+ Index Cond: (c1 = "*VALUES*".column1)
+ -> Index Scan using t4_i1 on t4
+ Index Cond: (c1 = "*VALUES*".column1)
+(11 rows)
+
+/*+Leading(t4 t3 t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1')) AS t1 (c1, c2, c3, c4), s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t3 t2 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------
+ Nested Loop
+ Join Filter: (t2.c1 = "*VALUES*".column1)
+ -> Values Scan on "*VALUES*"
+ -> Hash Join
+ Hash Cond: (t3.c1 = t2.c1)
+ -> Hash Join
+ Hash Cond: (t3.c1 = t4.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Seq Scan on t4
+ -> Hash
+ -> Seq Scan on t2
+(12 rows)
+
+-- No. L-1-6-9
+EXPLAIN (COSTS false) WITH c1(c1) AS (SELECT st1.c1 FROM s1.t1 st1, s1.t1 st2, s1.t1 st3, s1.t1 st4 WHERE st1.c1 = st2.c1 AND st1.c1 = st3.c1 AND st1.c1 = st4.c1) SELECT * FROM c1 ct1, c1 ct2, c1 ct3, c1 ct4 WHERE ct1.c1 = ct2.c1 AND ct1.c1 = ct3.c1 AND ct1.c1 = ct4.c1;
+ QUERY PLAN
+----------------------------------------------------
+ Merge Join
+ Merge Cond: (ct1.c1 = ct3.c1)
+ CTE c1
+ -> Hash Join
+ Hash Cond: (st1.c1 = st4.c1)
+ -> Hash Join
+ Hash Cond: (st1.c1 = st3.c1)
+ -> Hash Join
+ Hash Cond: (st1.c1 = st2.c1)
+ -> Seq Scan on t1 st1
+ -> Hash
+ -> Seq Scan on t1 st2
+ -> Hash
+ -> Seq Scan on t1 st3
+ -> Hash
+ -> Seq Scan on t1 st4
+ -> Merge Join
+ Merge Cond: (ct1.c1 = ct2.c1)
+ -> Sort
+ Sort Key: ct1.c1
+ -> CTE Scan on c1 ct1
+ -> Sort
+ Sort Key: ct2.c1
+ -> CTE Scan on c1 ct2
+ -> Materialize
+ -> Merge Join
+ Merge Cond: (ct3.c1 = ct4.c1)
+ -> Sort
+ Sort Key: ct3.c1
+ -> CTE Scan on c1 ct3
+ -> Sort
+ Sort Key: ct4.c1
+ -> CTE Scan on c1 ct4
+(33 rows)
+
+/*+Leading(ct4 ct3 ct2 ct1 st4 st3 st2 st1)*/
+EXPLAIN (COSTS false) WITH c1(c1) AS (SELECT st1.c1 FROM s1.t1 st1, s1.t1 st2, s1.t1 st3, s1.t1 st4 WHERE st1.c1 = st2.c1 AND st1.c1 = st3.c1 AND st1.c1 = st4.c1) SELECT * FROM c1 ct1, c1 ct2, c1 ct3, c1 ct4 WHERE ct1.c1 = ct2.c1 AND ct1.c1 = ct3.c1 AND ct1.c1 = ct4.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(ct4 ct3 ct2 ct1 st4 st3 st2 st1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------
+ Merge Join
+ Merge Cond: (ct1.c1 = ct2.c1)
+ CTE c1
+ -> Hash Join
+ Hash Cond: (st2.c1 = st1.c1)
+ -> Hash Join
+ Hash Cond: (st3.c1 = st2.c1)
+ -> Hash Join
+ Hash Cond: (st3.c1 = st4.c1)
+ -> Seq Scan on t1 st3
+ -> Hash
+ -> Seq Scan on t1 st4
+ -> Hash
+ -> Seq Scan on t1 st2
+ -> Hash
+ -> Seq Scan on t1 st1
+ -> Sort
+ Sort Key: ct1.c1
+ -> CTE Scan on c1 ct1
+ -> Materialize
+ -> Merge Join
+ Merge Cond: (ct2.c1 = ct3.c1)
+ -> Sort
+ Sort Key: ct2.c1
+ -> CTE Scan on c1 ct2
+ -> Materialize
+ -> Merge Join
+ Merge Cond: (ct3.c1 = ct4.c1)
+ -> Sort
+ Sort Key: ct3.c1
+ -> CTE Scan on c1 ct3
+ -> Sort
+ Sort Key: ct4.c1
+ -> CTE Scan on c1 ct4
+(34 rows)
+
+-- No. L-1-6-10
+EXPLAIN (COSTS false) SELECT * FROM s1.v1 t1, s1.v1 t2, s1.v1 t3, s1.v1 t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+ QUERY PLAN
+----------------------------------------------
+ Hash Join
+ Hash Cond: (v1t1.c1 = v1t1.c1)
+ -> Hash Join
+ Hash Cond: (v1t1.c1 = v1t1.c1)
+ -> Hash Join
+ Hash Cond: (v1t1.c1 = v1t1.c1)
+ -> Seq Scan on t1 v1t1
+ -> Hash
+ -> Seq Scan on t1 v1t1
+ -> Hash
+ -> Seq Scan on t1 v1t1
+ -> Hash
+ -> Seq Scan on t1 v1t1
+(13 rows)
+
+/*+Leading(t4 t3 t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.v1 t1, s1.v1 t2, s1.v1 t3, s1.v1 t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+Leading(t4 t3 t2 t1)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------
+ Hash Join
+ Hash Cond: (v1t1.c1 = v1t1.c1)
+ -> Hash Join
+ Hash Cond: (v1t1.c1 = v1t1.c1)
+ -> Hash Join
+ Hash Cond: (v1t1.c1 = v1t1.c1)
+ -> Seq Scan on t1 v1t1
+ -> Hash
+ -> Seq Scan on t1 v1t1
+ -> Hash
+ -> Seq Scan on t1 v1t1
+ -> Hash
+ -> Seq Scan on t1 v1t1
+(13 rows)
+
+EXPLAIN (COSTS false) SELECT * FROM s1.v1 t1, s1.v1_ t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+ QUERY PLAN
+---------------------------------------------
+ Hash Join
+ Hash Cond: (v1t1.c1 = t4.c1)
+ -> Hash Join
+ Hash Cond: (v1t1.c1 = v1t1_.c1)
+ -> Hash Join
+ Hash Cond: (t3.c1 = v1t1.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Seq Scan on t1 v1t1
+ -> Hash
+ -> Seq Scan on t1 v1t1_
+ -> Hash
+ -> Seq Scan on t4
+(13 rows)
+
+/*+Leading(t4 v1t1_ v1t1 t3)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.v1 t1, s1.v1_ t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 v1t1_ v1t1 t3)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------
+ Hash Join
+ Hash Cond: (v1t1.c1 = t3.c1)
+ -> Hash Join
+ Hash Cond: (v1t1_.c1 = v1t1.c1)
+ -> Hash Join
+ Hash Cond: (t4.c1 = v1t1_.c1)
+ -> Seq Scan on t4
+ -> Hash
+ -> Seq Scan on t1 v1t1_
+ -> Hash
+ -> Seq Scan on t1 v1t1
+ -> Hash
+ -> Seq Scan on t3
+(13 rows)
+
+-- No. L-1-6-11
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, (SELECT t4.c1 FROM s1.t4) st4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = st4.c1;
+ QUERY PLAN
+------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t4.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t3.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t3_i1 on t3
+ -> Index Scan using t4_i1 on t4
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(12 rows)
+
+/*+Leading(st4 t2 t3 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, (SELECT t4.c1 FROM s1.t4) st4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = st4.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(st4 t2 t3 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------
+ Nested Loop
+ -> Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Hash Join
+ Hash Cond: (t3.c1 = t2.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Seq Scan on t2
+ -> Index Scan using t4_i1 on t4
+ Index Cond: (c1 = t1.c1)
+(13 rows)
+
+/*+Leading(t4 t2 t3 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, (SELECT t4.c1 FROM s1.t4) st4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = st4.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t2 t3 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Hash Join
+ Hash Cond: (t3.c1 = t2.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Hash Join
+ Hash Cond: (t4.c1 = t2.c1)
+ -> Seq Scan on t4
+ -> Hash
+ -> Seq Scan on t2
+(14 rows)
+
+----
+---- No. L-2-1 complexity query block
+----
+-- No. L-2-1-1
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1), (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+;
+ QUERY PLAN
+-------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(47 rows)
+
+/*+
+Leading(bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2)
+*/
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1), (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+;
+LOG: pg_hint_plan:
+used hint:
+Leading(bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t1.c1)
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t3.c1)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Nested Loop
+ Join Filter: (b2t3.c1 = b2t1.c1)
+ -> Nested Loop
+ Join Filter: (b2t3.c1 = b2t4.c1)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(47 rows)
+
+-- No. L-2-1-2
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1), (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+), (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+;
+ QUERY PLAN
+-------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t4.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t3.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t2.c1)
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(63 rows)
+
+/*+
+Leading(bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2 b3t4 b3t1 b3t2 b3t3)
+*/
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1), (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+), (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+;
+LOG: pg_hint_plan:
+used hint:
+Leading(bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2 b3t4 b3t1 b3t2 b3t3)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t1.c1)
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t3.c1)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Nested Loop
+ Join Filter: (b2t3.c1 = b2t1.c1)
+ -> Nested Loop
+ Join Filter: (b2t3.c1 = b2t4.c1)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t3.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t2.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t4.c1)
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(63 rows)
+
+-- No. L-2-1-3
+EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, (SELECT ctid, * FROM s1.t3 bmt3) sbmt3, (SELECT ctid, * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = sbmt3.c1 AND sbmt3.ctid = '(1,1)' AND bmt1.c1 = sbmt4.c1 AND sbmt4.ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(15 rows)
+
+/*+
+Leading(bmt4 bmt3 bmt2 bmt1)
+*/
+EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, (SELECT ctid, * FROM s1.t3 bmt3) sbmt3, (SELECT ctid, * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = sbmt3.c1 AND sbmt3.ctid = '(1,1)' AND bmt1.c1 = sbmt4.c1 AND sbmt4.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+Leading(bmt4 bmt3 bmt2 bmt1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (bmt2.c1 = bmt1.c1)
+ -> Nested Loop
+ Join Filter: (bmt3.c1 = bmt2.c1)
+ -> Nested Loop
+ Join Filter: (bmt3.c1 = bmt4.c1)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+(15 rows)
+
+-- No. L-2-1-4
+EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, (SELECT ctid, * FROM s1.t2 bmt2) sbmt2, (SELECT ctid, * FROM s1.t3 bmt3) sbmt3, (SELECT ctid, * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = sbmt2.c1 AND sbmt2.ctid = '(1,1)' AND bmt1.c1 = sbmt3.c1 AND sbmt3.ctid = '(1,1)' AND bmt1.c1 = sbmt4.c1 AND sbmt4.ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(15 rows)
+
+/*+
+Leading(bmt4 bmt3 bmt2 bmt1)
+*/
+EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, (SELECT ctid, * FROM s1.t2 bmt2) sbmt2, (SELECT ctid, * FROM s1.t3 bmt3) sbmt3, (SELECT ctid, * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = sbmt2.c1 AND sbmt2.ctid = '(1,1)' AND bmt1.c1 = sbmt3.c1 AND sbmt3.ctid = '(1,1)' AND bmt1.c1 = sbmt4.c1 AND sbmt4.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+Leading(bmt4 bmt3 bmt2 bmt1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (bmt2.c1 = bmt1.c1)
+ -> Nested Loop
+ Join Filter: (bmt3.c1 = bmt2.c1)
+ -> Nested Loop
+ Join Filter: (bmt3.c1 = bmt4.c1)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+(15 rows)
+
+-- No. L-2-1-5
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+ AND bmt1.c1 <> (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+) AND bmt1.c1 <> (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+;
+ QUERY PLAN
+-------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 <> $0) AND (c1 <> $1))
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(48 rows)
+
+/*+
+Leading(bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2)
+*/
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+ AND bmt1.c1 <> (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+) AND bmt1.c1 <> (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+;
+LOG: pg_hint_plan:
+used hint:
+Leading(bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t1.c1)
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t3.c1)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Nested Loop
+ Join Filter: (b2t3.c1 = b2t1.c1)
+ -> Nested Loop
+ Join Filter: (b2t3.c1 = b2t4.c1)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 <> $0) AND (c1 <> $1))
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(48 rows)
+
+-- No. L-2-1-6
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+ AND bmt1.c1 <> (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+) AND bmt1.c1 <> (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+) AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+;
+ QUERY PLAN
+------------------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t4.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t3.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t2.c1)
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 <> $0) AND (c1 <> $1) AND (c1 <> $2))
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(64 rows)
+
+/*+
+Leading(bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2 b3t4 b3t1 b3t2 b3t3)
+*/
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+ AND bmt1.c1 <> (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+) AND bmt1.c1 <> (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+) AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+;
+LOG: pg_hint_plan:
+used hint:
+Leading(bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2 b3t4 b3t1 b3t2 b3t3)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t1.c1)
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t3.c1)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Nested Loop
+ Join Filter: (b2t3.c1 = b2t1.c1)
+ -> Nested Loop
+ Join Filter: (b2t3.c1 = b2t4.c1)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t3.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t2.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t4.c1)
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 <> $0) AND (c1 <> $1) AND (c1 <> $2))
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(64 rows)
+
+-- No. L-2-1-7
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+, c2 (c1) AS (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
+, c1, c2
+ WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 = c2.c1
+;
+ QUERY PLAN
+-----------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ CTE c2
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = c2.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = c1.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> CTE Scan on c1
+ -> CTE Scan on c2
+(53 rows)
+
+/*+
+Leading(c2 c1 bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+, c2 (c1) AS (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
+, c1, c2
+ WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 = c2.c1
+;
+LOG: pg_hint_plan:
+used hint:
+Leading(c2 c1 bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t1.c1)
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t3.c1)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ CTE c2
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Nested Loop
+ Join Filter: (b2t3.c1 = b2t1.c1)
+ -> Nested Loop
+ Join Filter: (b2t3.c1 = b2t4.c1)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Nested Loop
+ Join Filter: (c1.c1 = bmt1.c1)
+ -> Nested Loop
+ Join Filter: (c1.c1 = c2.c1)
+ -> CTE Scan on c1
+ -> CTE Scan on c2
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(53 rows)
+
+-- No. L-2-1-8
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+, c2 (c1) AS (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+, c3 (c1) AS (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
+, c1, c2, c3
+ WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 = c2.c1
+AND bmt1.c1 = c3.c1
+;
+ QUERY PLAN
+-----------------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ CTE c2
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ CTE c3
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t4.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t3.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t2.c1)
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = c3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = c2.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = c1.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> CTE Scan on c1
+ -> CTE Scan on c2
+ -> CTE Scan on c3
+(72 rows)
+
+/*+
+Leading(c3 c2 c1 bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2 b3t4 b3t1 b3t2 b3t3)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+, c2 (c1) AS (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+, c3 (c1) AS (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
+, c1, c2, c3
+ WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 = c2.c1
+AND bmt1.c1 = c3.c1
+;
+LOG: pg_hint_plan:
+used hint:
+Leading(c3 c2 c1 bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2 b3t4 b3t1 b3t2 b3t3)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t1.c1)
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t3.c1)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ CTE c2
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Nested Loop
+ Join Filter: (b2t3.c1 = b2t1.c1)
+ -> Nested Loop
+ Join Filter: (b2t3.c1 = b2t4.c1)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ CTE c3
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t3.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t2.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t4.c1)
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Nested Loop
+ Join Filter: (c1.c1 = bmt1.c1)
+ -> Nested Loop
+ Join Filter: (c2.c1 = c1.c1)
+ -> Nested Loop
+ Join Filter: (c2.c1 = c3.c1)
+ -> CTE Scan on c2
+ -> CTE Scan on c3
+ -> CTE Scan on c1
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(72 rows)
+
+----
+---- No. L-2-2 the number of the tables per quiry block
+----
+-- No. L-2-2-1
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = 1
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = 1
+)
+ FROM s1.t1 bmt1, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = 1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = 1
+)
+;
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Result
+ InitPlan 1 (returns $0)
+ -> Limit
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 4 (returns $3)
+ -> Result
+ InitPlan 3 (returns $2)
+ -> Limit
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 6 (returns $5)
+ -> Result
+ InitPlan 5 (returns $4)
+ -> Limit
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 IS NOT NULL) AND (c1 = 1))
+ -> Nested Loop
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 <> $5) AND (c1 = 1))
+ -> CTE Scan on c1
+(27 rows)
+
+/*+
+Leading(c1 bmt1 b1t1 b2t1 b3t1)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = 1
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = 1
+)
+ FROM s1.t1 bmt1, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = 1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = 1
+)
+;
+LOG: pg_hint_plan:
+used hint:
+Leading(c1 bmt1 b1t1 b2t1 b3t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Result
+ InitPlan 1 (returns $0)
+ -> Limit
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 4 (returns $3)
+ -> Result
+ InitPlan 3 (returns $2)
+ -> Limit
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 6 (returns $5)
+ -> Result
+ InitPlan 5 (returns $4)
+ -> Limit
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 IS NOT NULL) AND (c1 = 1))
+ -> Nested Loop
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 <> $5) AND (c1 = 1))
+ -> CTE Scan on c1
+(27 rows)
+
+-- No. L-2-2-2
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)'
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)'
+)
+;
+ QUERY PLAN
+-------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t2.c1)
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = c1.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 <> $2)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> CTE Scan on c1
+(35 rows)
+
+/*+
+Leading(c1 bmt2 b1t2 b2t2 b3t2 bmt1 b1t1 b2t1 b3t1)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)'
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)'
+)
+;
+LOG: pg_hint_plan:
+used hint:
+Leading(c1 bmt2 b1t2 b2t2 b3t2 bmt1 b1t1 b2t1 b3t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t2.c1)
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt2.c1 = bmt1.c1)
+ -> Nested Loop
+ Join Filter: (bmt2.c1 = c1.c1)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> CTE Scan on c1
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 <> $2)
+(35 rows)
+
+-- No. L-2-2-3
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+;
+ QUERY PLAN
+-------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t4.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t3.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t2.c1)
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = c1.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Nested Loop
+ Join Filter: (bmt3.c1 = bmt1.c1)
+ -> Nested Loop
+ Join Filter: (bmt3.c1 = bmt4.c1)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 <> $2)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> CTE Scan on c1
+(67 rows)
+
+/*+
+Leading(c1 bmt4 b1t4 b2t4 b3t4 bmt3 b1t3 b2t3 b3t3 bmt2 b1t2 b2t2 b3t2 bmt1 b1t1 b2t1 b3t1)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+;
+LOG: pg_hint_plan:
+used hint:
+Leading(c1 bmt4 b1t4 b2t4 b3t4 bmt3 b1t3 b2t3 b3t3 bmt2 b1t2 b2t2 b3t2 bmt1 b1t1 b2t1 b3t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t1.c1)
+ -> Nested Loop
+ Join Filter: (b1t3.c1 = b1t2.c1)
+ -> Nested Loop
+ Join Filter: (b1t3.c1 = b1t4.c1)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t2.c1 = b2t1.c1)
+ -> Nested Loop
+ Join Filter: (b2t3.c1 = b2t2.c1)
+ -> Nested Loop
+ Join Filter: (b2t3.c1 = b2t4.c1)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b3t2.c1 = b3t1.c1)
+ -> Nested Loop
+ Join Filter: (b3t3.c1 = b3t2.c1)
+ -> Nested Loop
+ Join Filter: (b3t3.c1 = b3t4.c1)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt2.c1 = bmt1.c1)
+ -> Nested Loop
+ Join Filter: (bmt3.c1 = bmt2.c1)
+ -> Nested Loop
+ Join Filter: (bmt4.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt4.c1 = c1.c1)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> CTE Scan on c1
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 <> $2)
+(67 rows)
+
+-- No. L-2-2-4
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = 1
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)'
+)
+;
+ QUERY PLAN
+-------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $2)
+ -> Result
+ InitPlan 2 (returns $1)
+ -> Limit
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 4 (returns $3)
+ -> Aggregate
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = c1.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Nested Loop
+ Join Filter: (bmt3.c1 = bmt1.c1)
+ -> Nested Loop
+ Join Filter: (bmt3.c1 = bmt4.c1)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 <> $3)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> CTE Scan on c1
+(46 rows)
+
+/*+
+Leading(c1 bmt4 b1t4 bmt3 b1t3 bmt2 b1t2 bmt1 b1t1 b2t1 b3t1)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = 1
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)'
+)
+;
+LOG: pg_hint_plan:
+used hint:
+Leading(c1 bmt4 b1t4 bmt3 b1t3 bmt2 b1t2 bmt1 b1t1 b2t1 b3t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t1.c1)
+ -> Nested Loop
+ Join Filter: (b1t3.c1 = b1t2.c1)
+ -> Nested Loop
+ Join Filter: (b1t3.c1 = b1t4.c1)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $2)
+ -> Result
+ InitPlan 2 (returns $1)
+ -> Limit
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 4 (returns $3)
+ -> Aggregate
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt2.c1 = bmt1.c1)
+ -> Nested Loop
+ Join Filter: (bmt3.c1 = bmt2.c1)
+ -> Nested Loop
+ Join Filter: (bmt4.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt4.c1 = c1.c1)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> CTE Scan on c1
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 <> $3)
+(46 rows)
+
+----
+---- No. L-2-3 RULE definition table
+----
+-- No. L-2-3-1
+EXPLAIN (COSTS false) UPDATE s1.r1 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t2.c1 = t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(19 rows)
+
+/*+ Leading(t4 t3 t2 t1 r1) */
+EXPLAIN (COSTS false) UPDATE s1.r1 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t3 t2 t1 r1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (t2.c1 = t1.c1)
+ -> Nested Loop
+ Join Filter: (t3.c1 = t2.c1)
+ -> Nested Loop
+ Join Filter: (t3.c1 = t4.c1)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(19 rows)
+
+EXPLAIN (COSTS false) UPDATE s1.r1_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r1_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(19 rows)
+
+/*+ Leading(b1t1 b1t2 b1t3 b1t4 r1_) */
+EXPLAIN (COSTS false) UPDATE s1.r1_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+Leading(b1t1 b1t2 b1t3 b1t4 r1_)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r1_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(19 rows)
+
+-- No. L-2-3-2
+EXPLAIN (COSTS false) UPDATE s1.r2 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t2.c1 = t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r2
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t2.c1 = t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r2
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(39 rows)
+
+/*+ Leading(t4 t3 t2 t1 r2) */
+EXPLAIN (COSTS false) UPDATE s1.r2 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t3 t2 t1 r2)
+not used hint:
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t3 t2 t1 r2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (t2.c1 = t1.c1)
+ -> Nested Loop
+ Join Filter: (t3.c1 = t2.c1)
+ -> Nested Loop
+ Join Filter: (t3.c1 = t4.c1)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r2
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (t2.c1 = t1.c1)
+ -> Nested Loop
+ Join Filter: (t3.c1 = t2.c1)
+ -> Nested Loop
+ Join Filter: (t3.c1 = t4.c1)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r2
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(39 rows)
+
+EXPLAIN (COSTS false) UPDATE s1.r2_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r2_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t2.c1 = b2t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r2_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(39 rows)
+
+/*+Leading(
+b1t1 b1t2 b1t3 b1t4
+b2t1 b2t2 b2t3 b2t4 r2_
+) */
+EXPLAIN (COSTS false) UPDATE s1.r2_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+Leading(b1t1 b1t2 b1t3 b1t4 b2t1 b2t2 b2t3 b2t4 r2_)
+not used hint:
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+Leading(b1t1 b1t2 b1t3 b1t4 b2t1 b2t2 b2t3 b2t4 r2_)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r2_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r2_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(39 rows)
+
+-- No. L-2-3-3
+EXPLAIN (COSTS false) UPDATE s1.r3 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t2.c1 = t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r3
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t2.c1 = t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r3
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t2.c1 = t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r3
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(59 rows)
+
+/*+ Leading(t4 t3 t2 t1 r3) */
+EXPLAIN (COSTS false) UPDATE s1.r3 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t3 t2 t1 r3)
+not used hint:
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t3 t2 t1 r3)
+not used hint:
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t3 t2 t1 r3)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (t2.c1 = t1.c1)
+ -> Nested Loop
+ Join Filter: (t3.c1 = t2.c1)
+ -> Nested Loop
+ Join Filter: (t3.c1 = t4.c1)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r3
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (t2.c1 = t1.c1)
+ -> Nested Loop
+ Join Filter: (t3.c1 = t2.c1)
+ -> Nested Loop
+ Join Filter: (t3.c1 = t4.c1)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r3
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (t2.c1 = t1.c1)
+ -> Nested Loop
+ Join Filter: (t3.c1 = t2.c1)
+ -> Nested Loop
+ Join Filter: (t3.c1 = t4.c1)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r3
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(59 rows)
+
+EXPLAIN (COSTS false) UPDATE s1.r3_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r3_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t2.c1 = b2t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r3_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t4.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t3.c1)
+ -> Nested Loop
+ Join Filter: (b3t2.c1 = b3t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r3_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(59 rows)
+
+/*+Leading(
+b1t1 b1t2 b1t3 b1t4
+b2t1 b2t2 b2t3 b2t4
+b3t1 b3t2 b3t3 b3t4 r3_
+) */
+EXPLAIN (COSTS false) UPDATE s1.r3_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+Leading(b1t1 b1t2 b1t3 b1t4 b2t1 b2t2 b2t3 b2t4 b3t1 b3t2 b3t3 b3t4 r3_)
+not used hint:
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+Leading(b1t1 b1t2 b1t3 b1t4 b2t1 b2t2 b2t3 b2t4 b3t1 b3t2 b3t3 b3t4 r3_)
+not used hint:
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+Leading(b1t1 b1t2 b1t3 b1t4 b2t1 b2t2 b2t3 b2t4 b3t1 b3t2 b3t3 b3t4 r3_)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r3_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r3_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t4.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t3.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t2.c1)
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r3_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(59 rows)
+
+----
+---- No. L-2-4 VALUES clause
+----
+-- No. L-2-4-1
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+ QUERY PLAN
+-------------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Hash Join
+ Hash Cond: (t2.c1 = "*VALUES*".column1)
+ -> Seq Scan on t2
+ -> Hash
+ -> Values Scan on "*VALUES*"
+(10 rows)
+
+/*+ Leading(t3 t1 t2) */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t3 t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------
+ Nested Loop
+ Join Filter: (t1.c1 = "*VALUES*".column1)
+ -> Values Scan on "*VALUES*"
+ -> Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(9 rows)
+
+/*+ Leading(*VALUES* t1 t2) */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(*VALUES* t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------
+ Hash Join
+ Hash Cond: (t2.c1 = t1.c1)
+ -> Seq Scan on t2
+ -> Hash
+ -> Nested Loop
+ -> Values Scan on "*VALUES*"
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = "*VALUES*".column1)
+(8 rows)
+
+-- No. L-2-4-2
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4), (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t4 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+ QUERY PLAN
+-------------------------------------------------------------
+ Nested Loop
+ Join Filter: (t1.c1 = "*VALUES*".column1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Hash Join
+ Hash Cond: (t2.c1 = "*VALUES*".column1)
+ -> Seq Scan on t2
+ -> Hash
+ -> Values Scan on "*VALUES*"
+ -> Values Scan on "*VALUES*"
+(13 rows)
+
+/*+ Leading(t4 t3 t2 t1) */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4), (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t4 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t3 t2 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------------------------
+ Nested Loop
+ Join Filter: (t1.c1 = "*VALUES*".column1)
+ -> Nested Loop
+ Join Filter: ("*VALUES*".column1 = "*VALUES*".column1)
+ -> Values Scan on "*VALUES*"
+ -> Values Scan on "*VALUES*"
+ -> Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(12 rows)
+
+/*+ Leading(*VALUES* t3 t2 t1) */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4), (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t4 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+INFO: hint syntax error at or near "Leading(*VALUES* t3 t2 t1) "
+DETAIL: Relation name "*VALUES*" is ambiguous.
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+Leading(*VALUES* t3 t2 t1)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------------
+ Nested Loop
+ Join Filter: (t1.c1 = "*VALUES*".column1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Hash Join
+ Hash Cond: (t2.c1 = "*VALUES*".column1)
+ -> Seq Scan on t2
+ -> Hash
+ -> Values Scan on "*VALUES*"
+ -> Values Scan on "*VALUES*"
+(13 rows)
+
+----
+---- No. L-3-1 leading the order of table joins
+----
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+ QUERY PLAN
+------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t3.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t3_i1 on t3
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(9 rows)
+
+-- No. L-3-1-1
+/*+Leading(t3 t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t3 t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t3.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t3_i1 on t3
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(9 rows)
+
+-- No. L-3-1-2
+/*+Leading(t1 t2 t3)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t1 t2 t3)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------
+ Hash Join
+ Hash Cond: (t3.c1 = t1.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(10 rows)
+
+----
+---- No. L-3-2 GUC parameter to disable hints
+----
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+ QUERY PLAN
+------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t3.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t3_i1 on t3
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(9 rows)
+
+-- No. L-3-2-1
+Set geqo_threshold = 3;
+Set geqo_seed = 0;
+/*+Leading(t1 t2 t3)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+Leading(t1 t2 t3)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t3.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t3_i1 on t3
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(9 rows)
+
+Reset geqo_threshold;
+-- No. L-3-2-2
+Set geqo_threshold = 4;
+Set geqo_seed = 0;
+/*+Leading(t1 t2 t3)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t1 t2 t3)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------
+ Hash Join
+ Hash Cond: (t3.c1 = t1.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(10 rows)
+
+Reset geqo_threshold;
+-- No. L-3-2-3
+Set from_collapse_limit = 2;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.v2 WHERE t1.c1 = v2.c1;
+ QUERY PLAN
+-----------------------------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = v2t1.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Merge Join
+ Merge Cond: (v2t1.c1 = v2t2.c1)
+ -> Index Scan using t1_i1 on t1 v2t1
+ -> Sort
+ Sort Key: v2t2.c1
+ -> Seq Scan on t2 v2t2
+(10 rows)
+
+/*+Leading(t1 v2t1 v2t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.v2 WHERE t1.c1 = v2.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t1 v2t1 v2t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = v2t1.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Merge Join
+ Merge Cond: (v2t1.c1 = v2t2.c1)
+ -> Index Scan using t1_i1 on t1 v2t1
+ -> Sort
+ Sort Key: v2t2.c1
+ -> Seq Scan on t2 v2t2
+(10 rows)
+
+Reset from_collapse_limit;
+-- No. L-3-2-4
+Set from_collapse_limit = 3;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.v2 WHERE t1.c1 = v2.c1;
+ QUERY PLAN
+-----------------------------------------------
+ Merge Join
+ Merge Cond: (v2t1.c1 = v2t2.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = v2t1.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t1_i1 on t1 v2t1
+ -> Sort
+ Sort Key: v2t2.c1
+ -> Seq Scan on t2 v2t2
+(9 rows)
+
+/*+Leading(v2t1 v2t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.v2 WHERE t1.c1 = v2.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(v2t1 v2t2 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = v2t1.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Merge Join
+ Merge Cond: (v2t1.c1 = v2t2.c1)
+ -> Index Scan using t1_i1 on t1 v2t1
+ -> Sort
+ Sort Key: v2t2.c1
+ -> Seq Scan on t2 v2t2
+(10 rows)
+
+Reset from_collapse_limit;
+-- No. L-3-2-5
+Set join_collapse_limit = 2;
+EXPLAIN (COSTS false) SELECT * FROM s1.t3
+ JOIN s1.t2 ON (t3.c1 = t2.c1)
+ JOIN s1.t1 ON (t1.c1 = t3.c1);
+ QUERY PLAN
+------------------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t3.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Hash Join
+ Hash Cond: (t3.c1 = t2.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Seq Scan on t2
+(9 rows)
+
+/*+Leading(t1 t2 t3)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t3
+ JOIN s1.t2 ON (t3.c1 = t2.c1)
+ JOIN s1.t1 ON (t1.c1 = t3.c1);
+LOG: pg_hint_plan:
+used hint:
+Leading(t1 t2 t3)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t3.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Hash Join
+ Hash Cond: (t3.c1 = t2.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Seq Scan on t2
+(9 rows)
+
+Reset join_collapse_limit;
+-- No. L-3-2-6
+Set join_collapse_limit = 3;
+EXPLAIN (COSTS false) SELECT * FROM s1.t3
+ JOIN s1.t2 ON (t3.c1 = t2.c1)
+ JOIN s1.t1 ON (t1.c1 = t3.c1);
+ QUERY PLAN
+------------------------------------------------
+ Hash Join
+ Hash Cond: (t3.c1 = t2.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(10 rows)
+
+/*+Leading(t1 t2 t3)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t3
+ JOIN s1.t2 ON (t3.c1 = t2.c1)
+ JOIN s1.t1 ON (t1.c1 = t3.c1);
+LOG: pg_hint_plan:
+used hint:
+Leading(t1 t2 t3)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------
+ Hash Join
+ Hash Cond: (t3.c1 = t2.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(10 rows)
+
+Reset join_collapse_limit;
+----
+---- No. L-3-3 join between parents or between children
+----
+-- No. L-3-3-1
+/*+Leading(t1 t2 t3)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.p2c1 t1
+ JOIN s1.p2c2 t2 ON (t1.c1 = t2.c1)
+ JOIN s1.p2c3 t3 ON (t1.c1 = t3.c1);
+LOG: pg_hint_plan:
+used hint:
+Leading(t1 t2 t3)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t3.c1)
+ -> Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Append
+ -> Seq Scan on p2c1 t1
+ -> Seq Scan on p2c1c1 t1
+ -> Seq Scan on p2c1c2 t1
+ -> Hash
+ -> Append
+ -> Seq Scan on p2c2 t2
+ -> Seq Scan on p2c2c1 t2
+ -> Seq Scan on p2c2c2 t2
+ -> Hash
+ -> Append
+ -> Seq Scan on p2c3 t3
+ -> Seq Scan on p2c3c1 t3
+ -> Seq Scan on p2c3c2 t3
+(18 rows)
+
+-- No. L-3-3-2
+/*+Leading(p2c1c1 p2c2c1 p2c3c1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.p2c1 t1
+ JOIN s1.p2c2 t2 ON (t1.c1 = t2.c1)
+ JOIN s1.p2c3 t3 ON (t1.c1 = t3.c1);
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+Leading(p2c1c1 p2c2c1 p2c3c1)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t3.c1)
+ -> Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Append
+ -> Seq Scan on p2c1 t1
+ -> Seq Scan on p2c1c1 t1
+ -> Seq Scan on p2c1c2 t1
+ -> Hash
+ -> Append
+ -> Seq Scan on p2c2 t2
+ -> Seq Scan on p2c2c1 t2
+ -> Seq Scan on p2c2c2 t2
+ -> Hash
+ -> Append
+ -> Seq Scan on p2c3 t3
+ -> Seq Scan on p2c3c1 t3
+ -> Seq Scan on p2c3c2 t3
+(18 rows)
+
+----
+---- No. L-3-4 conflict leading hint
+----
+-- No. L-3-4-1
+EXPLAIN (COSTS false) SELECT * FROM s1.t1
+ JOIN s1.t2 ON (t1.c1 = t2.c1)
+ JOIN s1.t3 ON (t1.c1 = t3.c1);
+ QUERY PLAN
+------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t3.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t3_i1 on t3
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(9 rows)
+
+/*+Leading(t2 t3 t1)Leading(t1 t2 t3)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1
+ JOIN s1.t2 ON (t1.c1 = t2.c1)
+ JOIN s1.t3 ON (t1.c1 = t3.c1);
+INFO: hint syntax error at or near "Leading(t2 t3 t1)Leading(t1 t2 t3)"
+DETAIL: Conflict leading hint.
+LOG: pg_hint_plan:
+used hint:
+Leading(t1 t2 t3)
+not used hint:
+duplication hint:
+Leading(t2 t3 t1)
+error hint:
+
+ QUERY PLAN
+------------------------------------------------
+ Hash Join
+ Hash Cond: (t3.c1 = t1.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(10 rows)
+
+-- No. L-3-4-2
+/*+Leading(t3 t1 t2)Leading(t2 t3 t1)Leading(t1 t2 t3)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1
+ JOIN s1.t2 ON (t1.c1 = t2.c1)
+ JOIN s1.t3 ON (t1.c1 = t3.c1);
+INFO: hint syntax error at or near "Leading(t3 t1 t2)Leading(t2 t3 t1)Leading(t1 t2 t3)"
+DETAIL: Conflict leading hint.
+INFO: hint syntax error at or near "Leading(t2 t3 t1)Leading(t1 t2 t3)"
+DETAIL: Conflict leading hint.
+LOG: pg_hint_plan:
+used hint:
+Leading(t1 t2 t3)
+not used hint:
+duplication hint:
+Leading(t3 t1 t2)
+Leading(t2 t3 t1)
+error hint:
+
+ QUERY PLAN
+------------------------------------------------
+ Hash Join
+ Hash Cond: (t3.c1 = t1.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(10 rows)
+
+-- No. L-3-4-3
+/*+Leading(t2 t3 t1)Leading()*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1
+ JOIN s1.t2 ON (t1.c1 = t2.c1)
+ JOIN s1.t3 ON (t1.c1 = t3.c1);
+INFO: hint syntax error at or near "Leading()"
+DETAIL: Leading hint requires at least two relations.
+INFO: hint syntax error at or near "Leading(t2 t3 t1)Leading()"
+DETAIL: Conflict leading hint.
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+Leading(t2 t3 t1)
+error hint:
+Leading()
+
+ QUERY PLAN
+------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t3.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t3_i1 on t3
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(9 rows)
+
+-- No. L-3-4-4
+/*+Leading(t3 t1 t2)Leading(t2 t3 t1)Leading()*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1
+ JOIN s1.t2 ON (t1.c1 = t2.c1)
+ JOIN s1.t3 ON (t1.c1 = t3.c1);
+INFO: hint syntax error at or near "Leading()"
+DETAIL: Leading hint requires at least two relations.
+INFO: hint syntax error at or near "Leading(t3 t1 t2)Leading(t2 t3 t1)Leading()"
+DETAIL: Conflict leading hint.
+INFO: hint syntax error at or near "Leading(t2 t3 t1)Leading()"
+DETAIL: Conflict leading hint.
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+Leading(t3 t1 t2)
+Leading(t2 t3 t1)
+error hint:
+Leading()
+
+ QUERY PLAN
+------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t3.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t3_i1 on t3
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(9 rows)
+
+----
+---- No. L-3-5 hint state output
+----
+-- No. L-3-5-1
+/*+Leading()*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1
+ JOIN s1.t2 ON (t1.c1 = t2.c1)
+ JOIN s1.t3 ON (t1.c1 = t3.c1);
+INFO: hint syntax error at or near "Leading()"
+DETAIL: Leading hint requires at least two relations.
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+Leading()
+
+ QUERY PLAN
+------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t3.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t3_i1 on t3
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(9 rows)
+
+-- No. L-3-5-2
+/*+Leading(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1
+ JOIN s1.t2 ON (t1.c1 = t2.c1)
+ JOIN s1.t3 ON (t1.c1 = t3.c1);
+INFO: hint syntax error at or near "Leading(t1)"
+DETAIL: Leading hint requires at least two relations.
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+Leading(t1)
+
+ QUERY PLAN
+------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t3.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t3_i1 on t3
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(9 rows)
+
+-- No. L-3-5-3
+/*+Leading(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1
+ JOIN s1.t2 ON (t1.c1 = t2.c1)
+ JOIN s1.t3 ON (t1.c1 = t3.c1);
+LOG: pg_hint_plan:
+used hint:
+Leading(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+ -> Index Scan using t3_i1 on t3
+ Index Cond: (c1 = t1.c1)
+(9 rows)
+
+-- No. L-3-5-4
+/*+Leading(t1 t2 t3)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1
+ JOIN s1.t2 ON (t1.c1 = t2.c1)
+ JOIN s1.t3 ON (t1.c1 = t3.c1);
+LOG: pg_hint_plan:
+used hint:
+Leading(t1 t2 t3)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------
+ Hash Join
+ Hash Cond: (t3.c1 = t1.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(10 rows)
+
--- /dev/null
+LOAD 'pg_hint_plan';
+SET pg_hint_plan.enable_hint TO on;
+SET pg_hint_plan.debug_print TO on;
+SET client_min_messages TO LOG;
+SET search_path TO public;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+ QUERY PLAN
+------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t4.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t3.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t3_i1 on t3
+ -> Index Scan using t4_i1 on t4
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(12 rows)
+
+----
+---- No. L-1-1 specified pattern of the object name
+----
+-- No. L-1-1-1
+/*+Leading(t4 t2 t3 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t2 t3 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Hash Join
+ Hash Cond: (t3.c1 = t2.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Hash Join
+ Hash Cond: (t4.c1 = t2.c1)
+ -> Seq Scan on t4
+ -> Hash
+ -> Seq Scan on t2
+(14 rows)
+
+-- No. L-1-1-2
+/*+Leading(t4 t2 t3 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 t_1, s1.t2 t_2, s1.t3 t_3, s1.t4 t_4 WHERE t_1.c1 = t_2.c1 AND t_1.c1 = t_3.c1 AND t_1.c1 = t_4.c1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+Leading(t4 t2 t3 t1)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------------
+ Merge Join
+ Merge Cond: (t_1.c1 = t_2.c1)
+ -> Merge Join
+ Merge Cond: (t_1.c1 = t_4.c1)
+ -> Merge Join
+ Merge Cond: (t_1.c1 = t_3.c1)
+ -> Index Scan using t1_i1 on t1 t_1
+ -> Index Scan using t3_i1 on t3 t_3
+ -> Index Scan using t4_i1 on t4 t_4
+ -> Sort
+ Sort Key: t_2.c1
+ -> Seq Scan on t2 t_2
+(12 rows)
+
+-- No. L-1-1-3
+/*+Leading(t_4 t_2 t_3 t_1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 t_1, s1.t2 t_2, s1.t3 t_3, s1.t4 t_4 WHERE t_1.c1 = t_2.c1 AND t_1.c1 = t_3.c1 AND t_1.c1 = t_4.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t_4 t_2 t_3 t_1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------------
+ Merge Join
+ Merge Cond: (t_1.c1 = t_2.c1)
+ -> Index Scan using t1_i1 on t1 t_1
+ -> Sort
+ Sort Key: t_2.c1
+ -> Hash Join
+ Hash Cond: (t_3.c1 = t_2.c1)
+ -> Seq Scan on t3 t_3
+ -> Hash
+ -> Hash Join
+ Hash Cond: (t_4.c1 = t_2.c1)
+ -> Seq Scan on t4 t_4
+ -> Hash
+ -> Seq Scan on t2 t_2
+(14 rows)
+
+----
+---- No. L-1-2 specified schema name in the hint option
+----
+-- No. L-1-2-1
+/*+Leading(t4 t2 t3 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t2 t3 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Hash Join
+ Hash Cond: (t3.c1 = t2.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Hash Join
+ Hash Cond: (t4.c1 = t2.c1)
+ -> Seq Scan on t4
+ -> Hash
+ -> Seq Scan on t2
+(14 rows)
+
+-- No. L-1-2-2
+/*+Leading(s1.t4 s1.t2 s1.t3 s1.t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+Leading(s1.t4 s1.t2 s1.t3 s1.t1)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t4.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t3.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t3_i1 on t3
+ -> Index Scan using t4_i1 on t4
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(12 rows)
+
+----
+---- No. L-1-3 table doesn't exist in the hint option
+----
+-- No. L-1-3-1
+/*+Leading(t4 t2 t3 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t2 t3 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Hash Join
+ Hash Cond: (t3.c1 = t2.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Hash Join
+ Hash Cond: (t4.c1 = t2.c1)
+ -> Seq Scan on t4
+ -> Hash
+ -> Seq Scan on t2
+(14 rows)
+
+-- No. L-1-3-2
+/*+Leading(t5 t2 t3 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t5 t2 t3 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------
+ Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Hash Join
+ Hash Cond: (t3.c1 = t2.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Seq Scan on t2
+ -> Index Scan using t4_i1 on t4
+ Index Cond: (c1 = t3.c1)
+(14 rows)
+
+----
+---- No. L-1-4 conflict table name
+----
+-- No. L-1-4-1
+/*+Leading(t4 t2 t3 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t2 t3 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Hash Join
+ Hash Cond: (t3.c1 = t2.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Hash Join
+ Hash Cond: (t4.c1 = t2.c1)
+ -> Seq Scan on t4
+ -> Hash
+ -> Seq Scan on t2
+(14 rows)
+
+-- No. L-1-4-2
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s2.t1 WHERE s1.t1.c1 = t2.c1 AND s1.t1.c1 = t3.c1 AND s1.t1.c1 = s2.t1.c1;
+ QUERY PLAN
+------------------------------------------------
+ Merge Join
+ Merge Cond: (s1.t1.c1 = s2.t1.c1)
+ -> Merge Join
+ Merge Cond: (s1.t1.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (s1.t1.c1 = t3.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t3_i1 on t3
+ -> Index Scan using t2_i1 on t2
+ -> Sort
+ Sort Key: s2.t1.c1
+ -> Seq Scan on t1
+(12 rows)
+
+/*+Leading(t1 t2 t3 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s2.t1 WHERE s1.t1.c1 = t2.c1 AND s1.t1.c1 = t3.c1 AND s1.t1.c1 = s2.t1.c1;
+INFO: hint syntax error at or near "Leading(t1 t2 t3 t1)"
+DETAIL: Relation name "t1" is ambiguous.
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+Leading(t1 t2 t3 t1)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------
+ Merge Join
+ Merge Cond: (s1.t1.c1 = s2.t1.c1)
+ -> Merge Join
+ Merge Cond: (s1.t1.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (s1.t1.c1 = t3.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t3_i1 on t3
+ -> Index Scan using t2_i1 on t2
+ -> Sort
+ Sort Key: s2.t1.c1
+ -> Seq Scan on t1
+(12 rows)
+
+/*+Leading(s1.t1 t2 t3 s2.t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s2.t1 WHERE s1.t1.c1 = t2.c1 AND s1.t1.c1 = t3.c1 AND s1.t1.c1 = s2.t1.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(s1.t1 t2 t3 s2.t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------
+ Nested Loop
+ Join Filter: (s1.t1.c1 = s2.t1.c1)
+ -> Nested Loop
+ Join Filter: (t2.c1 = s1.t1.c1)
+ -> Merge Join
+ Merge Cond: (t3.c1 = t2.c1)
+ -> Index Scan using t3_i1 on t3
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = t3.c1)
+ -> Index Scan using t1_pkey on t1
+ Index Cond: (c1 = t3.c1)
+(14 rows)
+
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s2.t1 s2t1 WHERE s1.t1.c1 = t2.c1 AND s1.t1.c1 = t3.c1 AND s1.t1.c1 = s2t1.c1;
+ QUERY PLAN
+------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = s2t1.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t3.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t3_i1 on t3
+ -> Index Scan using t2_i1 on t2
+ -> Sort
+ Sort Key: s2t1.c1
+ -> Seq Scan on t1 s2t1
+(12 rows)
+
+/*+Leading(s2t1 t1 t3 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s2.t1 s2t1 WHERE s1.t1.c1 = t2.c1 AND s1.t1.c1 = t3.c1 AND s1.t1.c1 = s2t1.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(s2t1 t1 t3 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Nested Loop
+ -> Merge Join
+ Merge Cond: (t1.c1 = s2t1.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t1_pkey on t1 s2t1
+ -> Index Scan using t3_i1 on t3
+ Index Cond: (c1 = t1.c1)
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(12 rows)
+
+-- No. L-1-4-3
+EXPLAIN (COSTS false) SELECT *, (SELECT max(t1.c1) FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1) FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+ QUERY PLAN
+-------------------------------------------------------------------
+ Merge Join
+ Merge Cond: (s1.t1.c1 = s1.t2.c1)
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (s1.t1.c1 = s1.t2.c1)
+ -> Merge Join
+ Merge Cond: (s1.t1.c1 = s1.t4.c1)
+ -> Merge Join
+ Merge Cond: (s1.t1.c1 = s1.t3.c1)
+ -> Index Only Scan using t1_i1 on t1
+ -> Index Only Scan using t3_i1 on t3
+ -> Index Only Scan using t4_i1 on t4
+ -> Sort
+ Sort Key: s1.t2.c1
+ -> Seq Scan on t2
+ -> Merge Join
+ Merge Cond: (s1.t1.c1 = s1.t4.c1)
+ -> Merge Join
+ Merge Cond: (s1.t1.c1 = s1.t3.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t3_i1 on t3
+ -> Index Scan using t4_i1 on t4
+ -> Sort
+ Sort Key: s1.t2.c1
+ -> Seq Scan on t2
+(26 rows)
+
+/*+Leading(t4 t2 t3 t1)*/
+EXPLAIN (COSTS false) SELECT *, (SELECT max(t1.c1) FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1) FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t2 t3 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------------------------------
+ Merge Join
+ Merge Cond: (s1.t1.c1 = s1.t2.c1)
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (s1.t1.c1 = s1.t2.c1)
+ -> Index Only Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: s1.t2.c1
+ -> Hash Join
+ Hash Cond: (s1.t3.c1 = s1.t2.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Hash Join
+ Hash Cond: (s1.t4.c1 = s1.t2.c1)
+ -> Seq Scan on t4
+ -> Hash
+ -> Seq Scan on t2
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: s1.t2.c1
+ -> Hash Join
+ Hash Cond: (s1.t3.c1 = s1.t2.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Hash Join
+ Hash Cond: (s1.t4.c1 = s1.t2.c1)
+ -> Seq Scan on t4
+ -> Hash
+ -> Seq Scan on t2
+(30 rows)
+
+/*+Leading(st1 st2 st3 st4 t4 t2 t3 t1)*/
+EXPLAIN (COSTS false) SELECT *, (SELECT max(st1.c1) FROM s1.t1 st1, s1.t2 st2, s1.t3 st3, s1.t4 st4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1) FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(st1 st2 st3 st4 t4 t2 t3 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Hash Join
+ Hash Cond: (t3.c1 = t2.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Hash Join
+ Hash Cond: (t4.c1 = t2.c1)
+ -> Seq Scan on t4
+ -> Hash
+ -> Seq Scan on t2
+ SubPlan 1
+ -> Aggregate
+ -> Result
+ One-Time Filter: ((t1.c1 = t2.c1) AND (t1.c1 = t3.c1) AND (t1.c1 = t4.c1))
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ -> Seq Scan on t1 st1
+ -> Materialize
+ -> Seq Scan on t2 st2
+ -> Materialize
+ -> Seq Scan on t3 st3
+ -> Materialize
+ -> Seq Scan on t4 st4
+(28 rows)
+
+----
+---- No. L-1-5 conflict table name
+----
+-- No. L-1-5-1
+/*+Leading(t4 t2 t3 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t2 t3 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Hash Join
+ Hash Cond: (t3.c1 = t2.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Hash Join
+ Hash Cond: (t4.c1 = t2.c1)
+ -> Seq Scan on t4
+ -> Hash
+ -> Seq Scan on t2
+(14 rows)
+
+-- No. L-1-5-2
+/*+Leading(t4 t2 t3 t1 t4)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t2 t3 t1 t4)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Hash Join
+ Hash Cond: (t3.c1 = t2.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Hash Join
+ Hash Cond: (t4.c1 = t2.c1)
+ -> Seq Scan on t4
+ -> Hash
+ -> Seq Scan on t2
+(14 rows)
+
+/*+Leading(t4 t2 t3 t4)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+INFO: hint syntax error at or near "Leading(t4 t2 t3 t4)"
+DETAIL: Relation name "t4" is duplicated.
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+Leading(t4 t2 t3 t4)
+
+ QUERY PLAN
+------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t4.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t3.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t3_i1 on t3
+ -> Index Scan using t4_i1 on t4
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(12 rows)
+
+-- No. L-1-5-3
+/*+Leading(t4 t2 t3 t1 t4 t2 t3 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t2 t3 t1 t4 t2 t3 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Hash Join
+ Hash Cond: (t3.c1 = t2.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Hash Join
+ Hash Cond: (t4.c1 = t2.c1)
+ -> Seq Scan on t4
+ -> Hash
+ -> Seq Scan on t2
+(14 rows)
+
+/*+Leading(t4 t2 t2 t4)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+INFO: hint syntax error at or near "Leading(t4 t2 t2 t4)"
+DETAIL: Relation name "t2" is duplicated.
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+Leading(t4 t2 t2 t4)
+
+ QUERY PLAN
+------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t4.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t3.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t3_i1 on t3
+ -> Index Scan using t4_i1 on t4
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(12 rows)
+
+----
+---- No. L-1-6 object type for the hint
+----
+-- No. L-1-6-1
+/*+Leading(t4 t2 t3 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t2 t3 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Hash Join
+ Hash Cond: (t3.c1 = t2.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Hash Join
+ Hash Cond: (t4.c1 = t2.c1)
+ -> Seq Scan on t4
+ -> Hash
+ -> Seq Scan on t2
+(14 rows)
+
+-- No. L-1-6-2
+EXPLAIN (COSTS false) SELECT * FROM s1.p1 t1, s1.p1 t2, s1.p1 t3, s1.p1 t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+ QUERY PLAN
+---------------------------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t4.c1)
+ -> Hash Join
+ Hash Cond: (t1.c1 = t3.c1)
+ -> Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Append
+ -> Seq Scan on p1 t1
+ -> Seq Scan on p1c1 t1
+ -> Seq Scan on p1c2 t1
+ -> Seq Scan on p1c3 t1
+ -> Hash
+ -> Append
+ -> Seq Scan on p1 t2
+ -> Seq Scan on p1c1 t2
+ -> Seq Scan on p1c2 t2
+ -> Seq Scan on p1c3 t2
+ -> Hash
+ -> Append
+ -> Seq Scan on p1 t3
+ -> Seq Scan on p1c1 t3
+ -> Seq Scan on p1c2 t3
+ -> Seq Scan on p1c3 t3
+ -> Hash
+ -> Append
+ -> Seq Scan on p1 t4
+ -> Seq Scan on p1c1 t4
+ -> Seq Scan on p1c2 t4
+ -> Seq Scan on p1c3 t4
+(29 rows)
+
+/*+Leading(t4 t3 t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.p1 t1, s1.p1 t2, s1.p1 t3, s1.p1 t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t3 t2 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------
+ Hash Join
+ Hash Cond: (t2.c1 = t1.c1)
+ -> Hash Join
+ Hash Cond: (t3.c1 = t2.c1)
+ -> Hash Join
+ Hash Cond: (t3.c1 = t4.c1)
+ -> Append
+ -> Seq Scan on p1 t3
+ -> Seq Scan on p1c1 t3
+ -> Seq Scan on p1c2 t3
+ -> Seq Scan on p1c3 t3
+ -> Hash
+ -> Append
+ -> Seq Scan on p1 t4
+ -> Seq Scan on p1c1 t4
+ -> Seq Scan on p1c2 t4
+ -> Seq Scan on p1c3 t4
+ -> Hash
+ -> Append
+ -> Seq Scan on p1 t2
+ -> Seq Scan on p1c1 t2
+ -> Seq Scan on p1c2 t2
+ -> Seq Scan on p1c3 t2
+ -> Hash
+ -> Append
+ -> Seq Scan on p1 t1
+ -> Seq Scan on p1c1 t1
+ -> Seq Scan on p1c2 t1
+ -> Seq Scan on p1c3 t1
+(29 rows)
+
+-- No. L-1-6-3
+EXPLAIN (COSTS false) SELECT * FROM s1.ul1 t1, s1.ul1 t2, s1.ul1 t3, s1.ul1 t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+ QUERY PLAN
+--------------------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t4.c1)
+ -> Hash Join
+ Hash Cond: (t1.c1 = t3.c1)
+ -> Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on ul1 t1
+ -> Hash
+ -> Seq Scan on ul1 t2
+ -> Hash
+ -> Seq Scan on ul1 t3
+ -> Hash
+ -> Seq Scan on ul1 t4
+(13 rows)
+
+/*+Leading(t4 t3 t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ul1 t1, s1.ul1 t2, s1.ul1 t3, s1.ul1 t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t3 t2 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------
+ Hash Join
+ Hash Cond: (t2.c1 = t1.c1)
+ -> Hash Join
+ Hash Cond: (t3.c1 = t2.c1)
+ -> Hash Join
+ Hash Cond: (t3.c1 = t4.c1)
+ -> Seq Scan on ul1 t3
+ -> Hash
+ -> Seq Scan on ul1 t4
+ -> Hash
+ -> Seq Scan on ul1 t2
+ -> Hash
+ -> Seq Scan on ul1 t1
+(13 rows)
+
+-- No. L-1-6-4
+CREATE TEMP TABLE tm1 (LIKE s1.t1 INCLUDING ALL);
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "tm1_pkey" for table "tm1"
+EXPLAIN (COSTS false) SELECT * FROM tm1 t1, tm1 t2, tm1 t3, tm1 t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+ QUERY PLAN
+--------------------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t4.c1)
+ -> Hash Join
+ Hash Cond: (t1.c1 = t3.c1)
+ -> Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on tm1 t1
+ -> Hash
+ -> Seq Scan on tm1 t2
+ -> Hash
+ -> Seq Scan on tm1 t3
+ -> Hash
+ -> Seq Scan on tm1 t4
+(13 rows)
+
+/*+Leading(t4 t3 t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM tm1 t1, tm1 t2, tm1 t3, tm1 t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t3 t2 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------
+ Hash Join
+ Hash Cond: (t2.c1 = t1.c1)
+ -> Hash Join
+ Hash Cond: (t3.c1 = t2.c1)
+ -> Hash Join
+ Hash Cond: (t3.c1 = t4.c1)
+ -> Seq Scan on tm1 t3
+ -> Hash
+ -> Seq Scan on tm1 t4
+ -> Hash
+ -> Seq Scan on tm1 t2
+ -> Hash
+ -> Seq Scan on tm1 t1
+(13 rows)
+
+-- No. L-1-6-5
+EXPLAIN (COSTS false) SELECT * FROM pg_catalog.pg_class t1, pg_catalog.pg_class t2, pg_catalog.pg_class t3, pg_catalog.pg_class t4 WHERE t1.oid = t2.oid AND t1.oid = t3.oid AND t1.oid = t4.oid;
+ QUERY PLAN
+-------------------------------------------------
+ Hash Join
+ Hash Cond: (t1.oid = t4.oid)
+ -> Hash Join
+ Hash Cond: (t1.oid = t3.oid)
+ -> Hash Join
+ Hash Cond: (t1.oid = t2.oid)
+ -> Seq Scan on pg_class t1
+ -> Hash
+ -> Seq Scan on pg_class t2
+ -> Hash
+ -> Seq Scan on pg_class t3
+ -> Hash
+ -> Seq Scan on pg_class t4
+(13 rows)
+
+/*+Leading(t4 t3 t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM pg_catalog.pg_class t1, pg_catalog.pg_class t2, pg_catalog.pg_class t3, pg_catalog.pg_class t4 WHERE t1.oid = t2.oid AND t1.oid = t3.oid AND t1.oid = t4.oid;
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t3 t2 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------
+ Hash Join
+ Hash Cond: (t2.oid = t1.oid)
+ -> Hash Join
+ Hash Cond: (t3.oid = t2.oid)
+ -> Hash Join
+ Hash Cond: (t3.oid = t4.oid)
+ -> Seq Scan on pg_class t3
+ -> Hash
+ -> Seq Scan on pg_class t4
+ -> Hash
+ -> Seq Scan on pg_class t2
+ -> Hash
+ -> Seq Scan on pg_class t1
+(13 rows)
+
+-- No. L-1-6-6
+-- refer ut-fdw.sql
+-- No. L-1-6-7
+EXPLAIN (COSTS false) SELECT * FROM s1.f1() t1, s1.f1() t2, s1.f1() t3, s1.f1() t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+ QUERY PLAN
+--------------------------------------------
+ Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t2.c1)
+ -> Function Scan on f1 t1
+ -> Function Scan on f1 t2
+ -> Function Scan on f1 t3
+ -> Function Scan on f1 t4
+(10 rows)
+
+/*+Leading(t4 t3 t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.f1() t1, s1.f1() t2, s1.f1() t3, s1.f1() t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t3 t2 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------
+ Nested Loop
+ Join Filter: (t2.c1 = t1.c1)
+ -> Nested Loop
+ Join Filter: (t3.c1 = t2.c1)
+ -> Nested Loop
+ Join Filter: (t3.c1 = t4.c1)
+ -> Function Scan on f1 t3
+ -> Function Scan on f1 t4
+ -> Function Scan on f1 t2
+ -> Function Scan on f1 t1
+(10 rows)
+
+-- No. L-1-6-8
+EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1')) AS t1 (c1, c2, c3, c4), s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+ QUERY PLAN
+-------------------------------------------------------
+ Nested Loop
+ Join Filter: ("*VALUES*".column1 = t4.c1)
+ -> Nested Loop
+ Join Filter: ("*VALUES*".column1 = t3.c1)
+ -> Hash Join
+ Hash Cond: (t2.c1 = "*VALUES*".column1)
+ -> Seq Scan on t2
+ -> Hash
+ -> Values Scan on "*VALUES*"
+ -> Index Scan using t3_i1 on t3
+ Index Cond: (c1 = t2.c1)
+ -> Index Scan using t4_i1 on t4
+ Index Cond: (c1 = t3.c1)
+(13 rows)
+
+/*+Leading(t4 t3 t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1')) AS t1 (c1, c2, c3, c4), s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t3 t2 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------
+ Nested Loop
+ Join Filter: (t2.c1 = "*VALUES*".column1)
+ -> Values Scan on "*VALUES*"
+ -> Hash Join
+ Hash Cond: (t3.c1 = t2.c1)
+ -> Hash Join
+ Hash Cond: (t3.c1 = t4.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Seq Scan on t4
+ -> Hash
+ -> Seq Scan on t2
+(12 rows)
+
+-- No. L-1-6-9
+EXPLAIN (COSTS false) WITH c1(c1) AS (SELECT st1.c1 FROM s1.t1 st1, s1.t1 st2, s1.t1 st3, s1.t1 st4 WHERE st1.c1 = st2.c1 AND st1.c1 = st3.c1 AND st1.c1 = st4.c1) SELECT * FROM c1 ct1, c1 ct2, c1 ct3, c1 ct4 WHERE ct1.c1 = ct2.c1 AND ct1.c1 = ct3.c1 AND ct1.c1 = ct4.c1;
+ QUERY PLAN
+----------------------------------------------------
+ Merge Join
+ Merge Cond: (ct1.c1 = ct3.c1)
+ CTE c1
+ -> Hash Join
+ Hash Cond: (st1.c1 = st4.c1)
+ -> Hash Join
+ Hash Cond: (st1.c1 = st3.c1)
+ -> Hash Join
+ Hash Cond: (st1.c1 = st2.c1)
+ -> Seq Scan on t1 st1
+ -> Hash
+ -> Seq Scan on t1 st2
+ -> Hash
+ -> Seq Scan on t1 st3
+ -> Hash
+ -> Seq Scan on t1 st4
+ -> Merge Join
+ Merge Cond: (ct1.c1 = ct2.c1)
+ -> Sort
+ Sort Key: ct1.c1
+ -> CTE Scan on c1 ct1
+ -> Sort
+ Sort Key: ct2.c1
+ -> CTE Scan on c1 ct2
+ -> Materialize
+ -> Merge Join
+ Merge Cond: (ct3.c1 = ct4.c1)
+ -> Sort
+ Sort Key: ct3.c1
+ -> CTE Scan on c1 ct3
+ -> Sort
+ Sort Key: ct4.c1
+ -> CTE Scan on c1 ct4
+(33 rows)
+
+/*+Leading(ct4 ct3 ct2 ct1 st4 st3 st2 st1)*/
+EXPLAIN (COSTS false) WITH c1(c1) AS (SELECT st1.c1 FROM s1.t1 st1, s1.t1 st2, s1.t1 st3, s1.t1 st4 WHERE st1.c1 = st2.c1 AND st1.c1 = st3.c1 AND st1.c1 = st4.c1) SELECT * FROM c1 ct1, c1 ct2, c1 ct3, c1 ct4 WHERE ct1.c1 = ct2.c1 AND ct1.c1 = ct3.c1 AND ct1.c1 = ct4.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(ct4 ct3 ct2 ct1 st4 st3 st2 st1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------
+ Merge Join
+ Merge Cond: (ct1.c1 = ct2.c1)
+ CTE c1
+ -> Hash Join
+ Hash Cond: (st2.c1 = st1.c1)
+ -> Hash Join
+ Hash Cond: (st3.c1 = st2.c1)
+ -> Hash Join
+ Hash Cond: (st3.c1 = st4.c1)
+ -> Seq Scan on t1 st3
+ -> Hash
+ -> Seq Scan on t1 st4
+ -> Hash
+ -> Seq Scan on t1 st2
+ -> Hash
+ -> Seq Scan on t1 st1
+ -> Sort
+ Sort Key: ct1.c1
+ -> CTE Scan on c1 ct1
+ -> Materialize
+ -> Merge Join
+ Merge Cond: (ct2.c1 = ct3.c1)
+ -> Sort
+ Sort Key: ct2.c1
+ -> CTE Scan on c1 ct2
+ -> Materialize
+ -> Merge Join
+ Merge Cond: (ct3.c1 = ct4.c1)
+ -> Sort
+ Sort Key: ct3.c1
+ -> CTE Scan on c1 ct3
+ -> Sort
+ Sort Key: ct4.c1
+ -> CTE Scan on c1 ct4
+(34 rows)
+
+-- No. L-1-6-10
+EXPLAIN (COSTS false) SELECT * FROM s1.v1 t1, s1.v1 t2, s1.v1 t3, s1.v1 t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+ QUERY PLAN
+----------------------------------------------
+ Hash Join
+ Hash Cond: (v1t1.c1 = v1t1.c1)
+ -> Hash Join
+ Hash Cond: (v1t1.c1 = v1t1.c1)
+ -> Hash Join
+ Hash Cond: (v1t1.c1 = v1t1.c1)
+ -> Seq Scan on t1 v1t1
+ -> Hash
+ -> Seq Scan on t1 v1t1
+ -> Hash
+ -> Seq Scan on t1 v1t1
+ -> Hash
+ -> Seq Scan on t1 v1t1
+(13 rows)
+
+/*+Leading(t4 t3 t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.v1 t1, s1.v1 t2, s1.v1 t3, s1.v1 t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+Leading(t4 t3 t2 t1)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------
+ Hash Join
+ Hash Cond: (v1t1.c1 = v1t1.c1)
+ -> Hash Join
+ Hash Cond: (v1t1.c1 = v1t1.c1)
+ -> Hash Join
+ Hash Cond: (v1t1.c1 = v1t1.c1)
+ -> Seq Scan on t1 v1t1
+ -> Hash
+ -> Seq Scan on t1 v1t1
+ -> Hash
+ -> Seq Scan on t1 v1t1
+ -> Hash
+ -> Seq Scan on t1 v1t1
+(13 rows)
+
+EXPLAIN (COSTS false) SELECT * FROM s1.v1 t1, s1.v1_ t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+ QUERY PLAN
+---------------------------------------------
+ Hash Join
+ Hash Cond: (v1t1.c1 = t4.c1)
+ -> Hash Join
+ Hash Cond: (v1t1.c1 = v1t1_.c1)
+ -> Hash Join
+ Hash Cond: (t3.c1 = v1t1.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Seq Scan on t1 v1t1
+ -> Hash
+ -> Seq Scan on t1 v1t1_
+ -> Hash
+ -> Seq Scan on t4
+(13 rows)
+
+/*+Leading(t4 v1t1_ v1t1 t3)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.v1 t1, s1.v1_ t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 v1t1_ v1t1 t3)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------
+ Hash Join
+ Hash Cond: (v1t1.c1 = t3.c1)
+ -> Hash Join
+ Hash Cond: (v1t1_.c1 = v1t1.c1)
+ -> Hash Join
+ Hash Cond: (t4.c1 = v1t1_.c1)
+ -> Seq Scan on t4
+ -> Hash
+ -> Seq Scan on t1 v1t1_
+ -> Hash
+ -> Seq Scan on t1 v1t1
+ -> Hash
+ -> Seq Scan on t3
+(13 rows)
+
+-- No. L-1-6-11
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, (SELECT t4.c1 FROM s1.t4) st4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = st4.c1;
+ QUERY PLAN
+------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t4.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t3.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t3_i1 on t3
+ -> Index Only Scan using t4_i1 on t4
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(12 rows)
+
+/*+Leading(st4 t2 t3 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, (SELECT t4.c1 FROM s1.t4) st4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = st4.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(st4 t2 t3 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------
+ Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Hash Join
+ Hash Cond: (t3.c1 = t2.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Seq Scan on t2
+ -> Index Only Scan using t4_i1 on t4
+ Index Cond: (c1 = t3.c1)
+(14 rows)
+
+/*+Leading(t4 t2 t3 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, (SELECT t4.c1 FROM s1.t4) st4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = st4.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t2 t3 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Hash Join
+ Hash Cond: (t3.c1 = t2.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Hash Join
+ Hash Cond: (t4.c1 = t2.c1)
+ -> Seq Scan on t4
+ -> Hash
+ -> Seq Scan on t2
+(14 rows)
+
+----
+---- No. L-2-1 complexity query block
+----
+-- No. L-2-1-1
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1), (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+;
+ QUERY PLAN
+-------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(47 rows)
+
+/*+
+Leading(bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2)
+*/
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1), (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+;
+LOG: pg_hint_plan:
+used hint:
+Leading(bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t1.c1)
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t3.c1)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Nested Loop
+ Join Filter: (b2t3.c1 = b2t1.c1)
+ -> Nested Loop
+ Join Filter: (b2t3.c1 = b2t4.c1)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(47 rows)
+
+-- No. L-2-1-2
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1), (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+), (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+;
+ QUERY PLAN
+-------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t4.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t3.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t2.c1)
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(63 rows)
+
+/*+
+Leading(bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2 b3t4 b3t1 b3t2 b3t3)
+*/
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1), (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+), (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+;
+LOG: pg_hint_plan:
+used hint:
+Leading(bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2 b3t4 b3t1 b3t2 b3t3)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t1.c1)
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t3.c1)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Nested Loop
+ Join Filter: (b2t3.c1 = b2t1.c1)
+ -> Nested Loop
+ Join Filter: (b2t3.c1 = b2t4.c1)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t3.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t2.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t4.c1)
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(63 rows)
+
+-- No. L-2-1-3
+EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, (SELECT ctid, * FROM s1.t3 bmt3) sbmt3, (SELECT ctid, * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = sbmt3.c1 AND sbmt3.ctid = '(1,1)' AND bmt1.c1 = sbmt4.c1 AND sbmt4.ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(15 rows)
+
+/*+
+Leading(bmt4 bmt3 bmt2 bmt1)
+*/
+EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, (SELECT ctid, * FROM s1.t3 bmt3) sbmt3, (SELECT ctid, * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = sbmt3.c1 AND sbmt3.ctid = '(1,1)' AND bmt1.c1 = sbmt4.c1 AND sbmt4.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+Leading(bmt4 bmt3 bmt2 bmt1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (bmt2.c1 = bmt1.c1)
+ -> Nested Loop
+ Join Filter: (bmt3.c1 = bmt2.c1)
+ -> Nested Loop
+ Join Filter: (bmt3.c1 = bmt4.c1)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+(15 rows)
+
+-- No. L-2-1-4
+EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, (SELECT ctid, * FROM s1.t2 bmt2) sbmt2, (SELECT ctid, * FROM s1.t3 bmt3) sbmt3, (SELECT ctid, * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = sbmt2.c1 AND sbmt2.ctid = '(1,1)' AND bmt1.c1 = sbmt3.c1 AND sbmt3.ctid = '(1,1)' AND bmt1.c1 = sbmt4.c1 AND sbmt4.ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(15 rows)
+
+/*+
+Leading(bmt4 bmt3 bmt2 bmt1)
+*/
+EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, (SELECT ctid, * FROM s1.t2 bmt2) sbmt2, (SELECT ctid, * FROM s1.t3 bmt3) sbmt3, (SELECT ctid, * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = sbmt2.c1 AND sbmt2.ctid = '(1,1)' AND bmt1.c1 = sbmt3.c1 AND sbmt3.ctid = '(1,1)' AND bmt1.c1 = sbmt4.c1 AND sbmt4.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+Leading(bmt4 bmt3 bmt2 bmt1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (bmt2.c1 = bmt1.c1)
+ -> Nested Loop
+ Join Filter: (bmt3.c1 = bmt2.c1)
+ -> Nested Loop
+ Join Filter: (bmt3.c1 = bmt4.c1)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+(15 rows)
+
+-- No. L-2-1-5
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+ AND bmt1.c1 <> (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+) AND bmt1.c1 <> (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+;
+ QUERY PLAN
+-------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 <> $0) AND (c1 <> $1))
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(48 rows)
+
+/*+
+Leading(bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2)
+*/
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+ AND bmt1.c1 <> (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+) AND bmt1.c1 <> (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+;
+LOG: pg_hint_plan:
+used hint:
+Leading(bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t1.c1)
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t3.c1)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Nested Loop
+ Join Filter: (b2t3.c1 = b2t1.c1)
+ -> Nested Loop
+ Join Filter: (b2t3.c1 = b2t4.c1)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 <> $0) AND (c1 <> $1))
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(48 rows)
+
+-- No. L-2-1-6
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+ AND bmt1.c1 <> (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+) AND bmt1.c1 <> (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+) AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+;
+ QUERY PLAN
+------------------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t4.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t3.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t2.c1)
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 <> $0) AND (c1 <> $1) AND (c1 <> $2))
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(64 rows)
+
+/*+
+Leading(bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2 b3t4 b3t1 b3t2 b3t3)
+*/
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+ AND bmt1.c1 <> (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+) AND bmt1.c1 <> (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+) AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+;
+LOG: pg_hint_plan:
+used hint:
+Leading(bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2 b3t4 b3t1 b3t2 b3t3)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t1.c1)
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t3.c1)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Nested Loop
+ Join Filter: (b2t3.c1 = b2t1.c1)
+ -> Nested Loop
+ Join Filter: (b2t3.c1 = b2t4.c1)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t3.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t2.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t4.c1)
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 <> $0) AND (c1 <> $1) AND (c1 <> $2))
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(64 rows)
+
+-- No. L-2-1-7
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+, c2 (c1) AS (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
+, c1, c2
+ WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 = c2.c1
+;
+ QUERY PLAN
+-----------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ CTE c2
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = c2.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = c1.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> CTE Scan on c1
+ -> CTE Scan on c2
+(53 rows)
+
+/*+
+Leading(c2 c1 bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+, c2 (c1) AS (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
+, c1, c2
+ WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 = c2.c1
+;
+LOG: pg_hint_plan:
+used hint:
+Leading(c2 c1 bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t1.c1)
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t3.c1)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ CTE c2
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Nested Loop
+ Join Filter: (b2t3.c1 = b2t1.c1)
+ -> Nested Loop
+ Join Filter: (b2t3.c1 = b2t4.c1)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Nested Loop
+ Join Filter: (c1.c1 = bmt1.c1)
+ -> Nested Loop
+ Join Filter: (c1.c1 = c2.c1)
+ -> CTE Scan on c1
+ -> CTE Scan on c2
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(53 rows)
+
+-- No. L-2-1-8
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+, c2 (c1) AS (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+, c3 (c1) AS (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
+, c1, c2, c3
+ WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 = c2.c1
+AND bmt1.c1 = c3.c1
+;
+ QUERY PLAN
+-----------------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ CTE c2
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ CTE c3
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t4.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t3.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t2.c1)
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = c3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = c2.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = c1.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> CTE Scan on c1
+ -> CTE Scan on c2
+ -> CTE Scan on c3
+(72 rows)
+
+/*+
+Leading(c3 c2 c1 bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2 b3t4 b3t1 b3t2 b3t3)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+, c2 (c1) AS (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+, c3 (c1) AS (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
+, c1, c2, c3
+ WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 = c2.c1
+AND bmt1.c1 = c3.c1
+;
+LOG: pg_hint_plan:
+used hint:
+Leading(c3 c2 c1 bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2 b3t4 b3t1 b3t2 b3t3)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t1.c1)
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t3.c1)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ CTE c2
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Nested Loop
+ Join Filter: (b2t3.c1 = b2t1.c1)
+ -> Nested Loop
+ Join Filter: (b2t3.c1 = b2t4.c1)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ CTE c3
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t3.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t2.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t4.c1)
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Nested Loop
+ Join Filter: (c1.c1 = bmt1.c1)
+ -> Nested Loop
+ Join Filter: (c2.c1 = c1.c1)
+ -> Nested Loop
+ Join Filter: (c2.c1 = c3.c1)
+ -> CTE Scan on c2
+ -> CTE Scan on c3
+ -> CTE Scan on c1
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(72 rows)
+
+----
+---- No. L-2-2 the number of the tables per quiry block
+----
+-- No. L-2-2-1
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = 1
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = 1
+)
+ FROM s1.t1 bmt1, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = 1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = 1
+)
+;
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Result
+ InitPlan 1 (returns $0)
+ -> Limit
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 4 (returns $3)
+ -> Result
+ InitPlan 3 (returns $2)
+ -> Limit
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 6 (returns $5)
+ -> Result
+ InitPlan 5 (returns $4)
+ -> Limit
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 IS NOT NULL) AND (c1 = 1))
+ -> Nested Loop
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 <> $5) AND (c1 = 1))
+ -> CTE Scan on c1
+(27 rows)
+
+/*+
+Leading(c1 bmt1 b1t1 b2t1 b3t1)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = 1
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = 1
+)
+ FROM s1.t1 bmt1, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = 1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = 1
+)
+;
+LOG: pg_hint_plan:
+used hint:
+Leading(c1 bmt1 b1t1 b2t1 b3t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Result
+ InitPlan 1 (returns $0)
+ -> Limit
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 4 (returns $3)
+ -> Result
+ InitPlan 3 (returns $2)
+ -> Limit
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 6 (returns $5)
+ -> Result
+ InitPlan 5 (returns $4)
+ -> Limit
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 IS NOT NULL) AND (c1 = 1))
+ -> Nested Loop
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 <> $5) AND (c1 = 1))
+ -> CTE Scan on c1
+(27 rows)
+
+-- No. L-2-2-2
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)'
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)'
+)
+;
+ QUERY PLAN
+-------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t2.c1)
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = c1.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 <> $2)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> CTE Scan on c1
+(35 rows)
+
+/*+
+Leading(c1 bmt2 b1t2 b2t2 b3t2 bmt1 b1t1 b2t1 b3t1)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)'
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)'
+)
+;
+LOG: pg_hint_plan:
+used hint:
+Leading(c1 bmt2 b1t2 b2t2 b3t2 bmt1 b1t1 b2t1 b3t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t2.c1)
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt2.c1 = bmt1.c1)
+ -> Nested Loop
+ Join Filter: (bmt2.c1 = c1.c1)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> CTE Scan on c1
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 <> $2)
+(35 rows)
+
+-- No. L-2-2-3
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+;
+ QUERY PLAN
+-------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t4.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t3.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t2.c1)
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = c1.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 <> $2)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> CTE Scan on c1
+(67 rows)
+
+/*+
+Leading(c1 bmt4 b1t4 b2t4 b3t4 bmt3 b1t3 b2t3 b3t3 bmt2 b1t2 b2t2 b3t2 bmt1 b1t1 b2t1 b3t1)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+;
+LOG: pg_hint_plan:
+used hint:
+Leading(c1 bmt4 b1t4 b2t4 b3t4 bmt3 b1t3 b2t3 b3t3 bmt2 b1t2 b2t2 b3t2 bmt1 b1t1 b2t1 b3t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t1.c1)
+ -> Nested Loop
+ Join Filter: (b1t3.c1 = b1t2.c1)
+ -> Nested Loop
+ Join Filter: (b1t3.c1 = b1t4.c1)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t2.c1 = b2t1.c1)
+ -> Nested Loop
+ Join Filter: (b2t3.c1 = b2t2.c1)
+ -> Nested Loop
+ Join Filter: (b2t3.c1 = b2t4.c1)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b3t2.c1 = b3t1.c1)
+ -> Nested Loop
+ Join Filter: (b3t3.c1 = b3t2.c1)
+ -> Nested Loop
+ Join Filter: (b3t3.c1 = b3t4.c1)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt2.c1 = bmt1.c1)
+ -> Nested Loop
+ Join Filter: (bmt3.c1 = bmt2.c1)
+ -> Nested Loop
+ Join Filter: (bmt4.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt4.c1 = c1.c1)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> CTE Scan on c1
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 <> $2)
+(67 rows)
+
+-- No. L-2-2-4
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = 1
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)'
+)
+;
+ QUERY PLAN
+-------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $2)
+ -> Result
+ InitPlan 2 (returns $1)
+ -> Limit
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 4 (returns $3)
+ -> Aggregate
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = c1.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 <> $3)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> CTE Scan on c1
+(46 rows)
+
+/*+
+Leading(c1 bmt4 b1t4 bmt3 b1t3 bmt2 b1t2 bmt1 b1t1 b2t1 b3t1)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = 1
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)'
+)
+;
+LOG: pg_hint_plan:
+used hint:
+Leading(c1 bmt4 b1t4 bmt3 b1t3 bmt2 b1t2 bmt1 b1t1 b2t1 b3t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t1.c1)
+ -> Nested Loop
+ Join Filter: (b1t3.c1 = b1t2.c1)
+ -> Nested Loop
+ Join Filter: (b1t3.c1 = b1t4.c1)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $2)
+ -> Result
+ InitPlan 2 (returns $1)
+ -> Limit
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 4 (returns $3)
+ -> Aggregate
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt2.c1 = bmt1.c1)
+ -> Nested Loop
+ Join Filter: (bmt3.c1 = bmt2.c1)
+ -> Nested Loop
+ Join Filter: (bmt4.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt4.c1 = c1.c1)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> CTE Scan on c1
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 <> $3)
+(46 rows)
+
+----
+---- No. L-2-3 RULE definition table
+----
+-- No. L-2-3-1
+EXPLAIN (COSTS false) UPDATE s1.r1 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(19 rows)
+
+/*+ Leading(t4 t3 t2 t1 r1) */
+EXPLAIN (COSTS false) UPDATE s1.r1 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t3 t2 t1 r1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (t2.c1 = t1.c1)
+ -> Nested Loop
+ Join Filter: (t3.c1 = t2.c1)
+ -> Nested Loop
+ Join Filter: (t3.c1 = t4.c1)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(19 rows)
+
+EXPLAIN (COSTS false) UPDATE s1.r1_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r1_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(19 rows)
+
+/*+ Leading(b1t1 b1t2 b1t3 b1t4 r1_) */
+EXPLAIN (COSTS false) UPDATE s1.r1_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+Leading(b1t1 b1t2 b1t3 b1t4 r1_)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r1_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(19 rows)
+
+-- No. L-2-3-2
+EXPLAIN (COSTS false) UPDATE s1.r2 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r2
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r2
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(39 rows)
+
+/*+ Leading(t4 t3 t2 t1 r2) */
+EXPLAIN (COSTS false) UPDATE s1.r2 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t3 t2 t1 r2)
+not used hint:
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t3 t2 t1 r2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (t2.c1 = t1.c1)
+ -> Nested Loop
+ Join Filter: (t3.c1 = t2.c1)
+ -> Nested Loop
+ Join Filter: (t3.c1 = t4.c1)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r2
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (t2.c1 = t1.c1)
+ -> Nested Loop
+ Join Filter: (t3.c1 = t2.c1)
+ -> Nested Loop
+ Join Filter: (t3.c1 = t4.c1)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r2
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(39 rows)
+
+EXPLAIN (COSTS false) UPDATE s1.r2_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r2_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r2_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(39 rows)
+
+/*+Leading(
+b1t1 b1t2 b1t3 b1t4
+b2t1 b2t2 b2t3 b2t4 r2_
+) */
+EXPLAIN (COSTS false) UPDATE s1.r2_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+Leading(b1t1 b1t2 b1t3 b1t4 b2t1 b2t2 b2t3 b2t4 r2_)
+not used hint:
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+Leading(b1t1 b1t2 b1t3 b1t4 b2t1 b2t2 b2t3 b2t4 r2_)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r2_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r2_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(39 rows)
+
+-- No. L-2-3-3
+EXPLAIN (COSTS false) UPDATE s1.r3 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r3
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r3
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r3
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(59 rows)
+
+/*+ Leading(t4 t3 t2 t1 r3) */
+EXPLAIN (COSTS false) UPDATE s1.r3 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t3 t2 t1 r3)
+not used hint:
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t3 t2 t1 r3)
+not used hint:
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t3 t2 t1 r3)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (t2.c1 = t1.c1)
+ -> Nested Loop
+ Join Filter: (t3.c1 = t2.c1)
+ -> Nested Loop
+ Join Filter: (t3.c1 = t4.c1)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r3
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (t2.c1 = t1.c1)
+ -> Nested Loop
+ Join Filter: (t3.c1 = t2.c1)
+ -> Nested Loop
+ Join Filter: (t3.c1 = t4.c1)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r3
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (t2.c1 = t1.c1)
+ -> Nested Loop
+ Join Filter: (t3.c1 = t2.c1)
+ -> Nested Loop
+ Join Filter: (t3.c1 = t4.c1)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r3
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(59 rows)
+
+EXPLAIN (COSTS false) UPDATE s1.r3_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r3_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r3_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t4.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t3.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r3_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(59 rows)
+
+/*+Leading(
+b1t1 b1t2 b1t3 b1t4
+b2t1 b2t2 b2t3 b2t4
+b3t1 b3t2 b3t3 b3t4 r3_
+) */
+EXPLAIN (COSTS false) UPDATE s1.r3_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+Leading(b1t1 b1t2 b1t3 b1t4 b2t1 b2t2 b2t3 b2t4 b3t1 b3t2 b3t3 b3t4 r3_)
+not used hint:
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+Leading(b1t1 b1t2 b1t3 b1t4 b2t1 b2t2 b2t3 b2t4 b3t1 b3t2 b3t3 b3t4 r3_)
+not used hint:
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+Leading(b1t1 b1t2 b1t3 b1t4 b2t1 b2t2 b2t3 b2t4 b3t1 b3t2 b3t3 b3t4 r3_)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r3_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r3_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t4.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t3.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t2.c1)
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on r3_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(59 rows)
+
+----
+---- No. L-2-4 VALUES clause
+----
+-- No. L-2-4-1
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+ QUERY PLAN
+-------------------------------------------------
+ Nested Loop
+ -> Hash Join
+ Hash Cond: (t2.c1 = "*VALUES*".column1)
+ -> Seq Scan on t2
+ -> Hash
+ -> Values Scan on "*VALUES*"
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = t2.c1)
+(8 rows)
+
+/*+ Leading(t3 t1 t2) */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t3 t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------
+ Nested Loop
+ Join Filter: (t1.c1 = "*VALUES*".column1)
+ -> Values Scan on "*VALUES*"
+ -> Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(9 rows)
+
+/*+ Leading(*VALUES* t1 t2) */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(*VALUES* t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------
+ Nested Loop
+ -> Nested Loop
+ -> Values Scan on "*VALUES*"
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = "*VALUES*".column1)
+ -> Index Scan using t2_i1 on t2
+ Index Cond: (c1 = t1.c1)
+(7 rows)
+
+-- No. L-2-4-2
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4), (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t4 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+ QUERY PLAN
+-------------------------------------------------------
+ Nested Loop
+ Join Filter: (t1.c1 = "*VALUES*".column1)
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (t2.c1 = "*VALUES*".column1)
+ -> Seq Scan on t2
+ -> Hash
+ -> Values Scan on "*VALUES*"
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = t2.c1)
+ -> Values Scan on "*VALUES*"
+(11 rows)
+
+/*+ Leading(t4 t3 t2 t1) */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4), (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t4 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t4 t3 t2 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------
+ Nested Loop
+ Join Filter: (t1.c1 = "*VALUES*".column1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = "*VALUES*".column1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+ -> Values Scan on "*VALUES*"
+ -> Values Scan on "*VALUES*"
+(12 rows)
+
+/*+ Leading(*VALUES* t3 t2 t1) */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4), (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t4 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+INFO: hint syntax error at or near "Leading(*VALUES* t3 t2 t1) "
+DETAIL: Relation name "*VALUES*" is ambiguous.
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+Leading(*VALUES* t3 t2 t1)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------
+ Nested Loop
+ Join Filter: (t1.c1 = "*VALUES*".column1)
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (t2.c1 = "*VALUES*".column1)
+ -> Seq Scan on t2
+ -> Hash
+ -> Values Scan on "*VALUES*"
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = t2.c1)
+ -> Values Scan on "*VALUES*"
+(11 rows)
+
+----
+---- No. L-3-1 leading the order of table joins
+----
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+ QUERY PLAN
+------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t3.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t3_i1 on t3
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(9 rows)
+
+-- No. L-3-1-1
+/*+Leading(t3 t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t3 t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t3.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t3_i1 on t3
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(9 rows)
+
+-- No. L-3-1-2
+/*+Leading(t1 t2 t3)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t1 t2 t3)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------
+ Hash Join
+ Hash Cond: (t3.c1 = t1.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(10 rows)
+
+----
+---- No. L-3-2 GUC parameter to disable hints
+----
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+ QUERY PLAN
+------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t3.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t3_i1 on t3
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(9 rows)
+
+-- No. L-3-2-1
+Set geqo_threshold = 3;
+Set geqo_seed = 0;
+/*+Leading(t1 t2 t3)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+Leading(t1 t2 t3)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t3.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t3_i1 on t3
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(9 rows)
+
+Reset geqo_threshold;
+-- No. L-3-2-2
+Set geqo_threshold = 4;
+Set geqo_seed = 0;
+/*+Leading(t1 t2 t3)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t1 t2 t3)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------
+ Hash Join
+ Hash Cond: (t3.c1 = t1.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(10 rows)
+
+Reset geqo_threshold;
+-- No. L-3-2-3
+Set from_collapse_limit = 2;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.v2 WHERE t1.c1 = v2.c1;
+ QUERY PLAN
+-----------------------------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = v2t1.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Merge Join
+ Merge Cond: (v2t1.c1 = v2t2.c1)
+ -> Index Scan using t1_i1 on t1 v2t1
+ -> Sort
+ Sort Key: v2t2.c1
+ -> Seq Scan on t2 v2t2
+(10 rows)
+
+/*+Leading(t1 v2t1 v2t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.v2 WHERE t1.c1 = v2.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(t1 v2t1 v2t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = v2t1.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Merge Join
+ Merge Cond: (v2t1.c1 = v2t2.c1)
+ -> Index Scan using t1_i1 on t1 v2t1
+ -> Sort
+ Sort Key: v2t2.c1
+ -> Seq Scan on t2 v2t2
+(10 rows)
+
+Reset from_collapse_limit;
+-- No. L-3-2-4
+Set from_collapse_limit = 3;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.v2 WHERE t1.c1 = v2.c1;
+ QUERY PLAN
+-----------------------------------------------
+ Merge Join
+ Merge Cond: (v2t1.c1 = v2t2.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = v2t1.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t1_i1 on t1 v2t1
+ -> Sort
+ Sort Key: v2t2.c1
+ -> Seq Scan on t2 v2t2
+(9 rows)
+
+/*+Leading(v2t1 v2t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.v2 WHERE t1.c1 = v2.c1;
+LOG: pg_hint_plan:
+used hint:
+Leading(v2t1 v2t2 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = v2t1.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Merge Join
+ Merge Cond: (v2t1.c1 = v2t2.c1)
+ -> Index Scan using t1_i1 on t1 v2t1
+ -> Sort
+ Sort Key: v2t2.c1
+ -> Seq Scan on t2 v2t2
+(10 rows)
+
+Reset from_collapse_limit;
+-- No. L-3-2-5
+Set join_collapse_limit = 2;
+EXPLAIN (COSTS false) SELECT * FROM s1.t3
+ JOIN s1.t2 ON (t3.c1 = t2.c1)
+ JOIN s1.t1 ON (t1.c1 = t3.c1);
+ QUERY PLAN
+------------------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t3.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Hash Join
+ Hash Cond: (t3.c1 = t2.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Seq Scan on t2
+(9 rows)
+
+/*+Leading(t1 t2 t3)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t3
+ JOIN s1.t2 ON (t3.c1 = t2.c1)
+ JOIN s1.t1 ON (t1.c1 = t3.c1);
+LOG: pg_hint_plan:
+used hint:
+Leading(t1 t2 t3)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t3.c1)
+ -> Seq Scan on t1
+ -> Hash
+ -> Hash Join
+ Hash Cond: (t3.c1 = t2.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Seq Scan on t2
+(9 rows)
+
+Reset join_collapse_limit;
+-- No. L-3-2-6
+Set join_collapse_limit = 3;
+EXPLAIN (COSTS false) SELECT * FROM s1.t3
+ JOIN s1.t2 ON (t3.c1 = t2.c1)
+ JOIN s1.t1 ON (t1.c1 = t3.c1);
+ QUERY PLAN
+------------------------------------------------
+ Hash Join
+ Hash Cond: (t3.c1 = t2.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(10 rows)
+
+/*+Leading(t1 t2 t3)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t3
+ JOIN s1.t2 ON (t3.c1 = t2.c1)
+ JOIN s1.t1 ON (t1.c1 = t3.c1);
+LOG: pg_hint_plan:
+used hint:
+Leading(t1 t2 t3)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------
+ Hash Join
+ Hash Cond: (t3.c1 = t2.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(10 rows)
+
+Reset join_collapse_limit;
+----
+---- No. L-3-3 join between parents or between children
+----
+-- No. L-3-3-1
+/*+Leading(t1 t2 t3)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.p2c1 t1
+ JOIN s1.p2c2 t2 ON (t1.c1 = t2.c1)
+ JOIN s1.p2c3 t3 ON (t1.c1 = t3.c1);
+LOG: pg_hint_plan:
+used hint:
+Leading(t1 t2 t3)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t3.c1)
+ -> Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Append
+ -> Seq Scan on p2c1 t1
+ -> Seq Scan on p2c1c1 t1
+ -> Seq Scan on p2c1c2 t1
+ -> Hash
+ -> Append
+ -> Seq Scan on p2c2 t2
+ -> Seq Scan on p2c2c1 t2
+ -> Seq Scan on p2c2c2 t2
+ -> Hash
+ -> Append
+ -> Seq Scan on p2c3 t3
+ -> Seq Scan on p2c3c1 t3
+ -> Seq Scan on p2c3c2 t3
+(18 rows)
+
+-- No. L-3-3-2
+/*+Leading(p2c1c1 p2c2c1 p2c3c1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.p2c1 t1
+ JOIN s1.p2c2 t2 ON (t1.c1 = t2.c1)
+ JOIN s1.p2c3 t3 ON (t1.c1 = t3.c1);
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+Leading(p2c1c1 p2c2c1 p2c3c1)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t3.c1)
+ -> Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Append
+ -> Seq Scan on p2c1 t1
+ -> Seq Scan on p2c1c1 t1
+ -> Seq Scan on p2c1c2 t1
+ -> Hash
+ -> Append
+ -> Seq Scan on p2c2 t2
+ -> Seq Scan on p2c2c1 t2
+ -> Seq Scan on p2c2c2 t2
+ -> Hash
+ -> Append
+ -> Seq Scan on p2c3 t3
+ -> Seq Scan on p2c3c1 t3
+ -> Seq Scan on p2c3c2 t3
+(18 rows)
+
+----
+---- No. L-3-4 conflict leading hint
+----
+-- No. L-3-4-1
+EXPLAIN (COSTS false) SELECT * FROM s1.t1
+ JOIN s1.t2 ON (t1.c1 = t2.c1)
+ JOIN s1.t3 ON (t1.c1 = t3.c1);
+ QUERY PLAN
+------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t3.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t3_i1 on t3
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(9 rows)
+
+/*+Leading(t2 t3 t1)Leading(t1 t2 t3)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1
+ JOIN s1.t2 ON (t1.c1 = t2.c1)
+ JOIN s1.t3 ON (t1.c1 = t3.c1);
+INFO: hint syntax error at or near "Leading(t2 t3 t1)Leading(t1 t2 t3)"
+DETAIL: Conflict leading hint.
+LOG: pg_hint_plan:
+used hint:
+Leading(t1 t2 t3)
+not used hint:
+duplication hint:
+Leading(t2 t3 t1)
+error hint:
+
+ QUERY PLAN
+------------------------------------------------
+ Hash Join
+ Hash Cond: (t3.c1 = t1.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(10 rows)
+
+-- No. L-3-4-2
+/*+Leading(t3 t1 t2)Leading(t2 t3 t1)Leading(t1 t2 t3)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1
+ JOIN s1.t2 ON (t1.c1 = t2.c1)
+ JOIN s1.t3 ON (t1.c1 = t3.c1);
+INFO: hint syntax error at or near "Leading(t3 t1 t2)Leading(t2 t3 t1)Leading(t1 t2 t3)"
+DETAIL: Conflict leading hint.
+INFO: hint syntax error at or near "Leading(t2 t3 t1)Leading(t1 t2 t3)"
+DETAIL: Conflict leading hint.
+LOG: pg_hint_plan:
+used hint:
+Leading(t1 t2 t3)
+not used hint:
+duplication hint:
+Leading(t3 t1 t2)
+Leading(t2 t3 t1)
+error hint:
+
+ QUERY PLAN
+------------------------------------------------
+ Hash Join
+ Hash Cond: (t3.c1 = t1.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(10 rows)
+
+-- No. L-3-4-3
+/*+Leading(t2 t3 t1)Leading()*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1
+ JOIN s1.t2 ON (t1.c1 = t2.c1)
+ JOIN s1.t3 ON (t1.c1 = t3.c1);
+INFO: hint syntax error at or near "Leading()"
+DETAIL: Leading hint requires at least two relations.
+INFO: hint syntax error at or near "Leading(t2 t3 t1)Leading()"
+DETAIL: Conflict leading hint.
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+Leading(t2 t3 t1)
+error hint:
+Leading()
+
+ QUERY PLAN
+------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t3.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t3_i1 on t3
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(9 rows)
+
+-- No. L-3-4-4
+/*+Leading(t3 t1 t2)Leading(t2 t3 t1)Leading()*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1
+ JOIN s1.t2 ON (t1.c1 = t2.c1)
+ JOIN s1.t3 ON (t1.c1 = t3.c1);
+INFO: hint syntax error at or near "Leading()"
+DETAIL: Leading hint requires at least two relations.
+INFO: hint syntax error at or near "Leading(t3 t1 t2)Leading(t2 t3 t1)Leading()"
+DETAIL: Conflict leading hint.
+INFO: hint syntax error at or near "Leading(t2 t3 t1)Leading()"
+DETAIL: Conflict leading hint.
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+Leading(t3 t1 t2)
+Leading(t2 t3 t1)
+error hint:
+Leading()
+
+ QUERY PLAN
+------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t3.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t3_i1 on t3
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(9 rows)
+
+----
+---- No. L-3-5 hint state output
+----
+-- No. L-3-5-1
+/*+Leading()*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1
+ JOIN s1.t2 ON (t1.c1 = t2.c1)
+ JOIN s1.t3 ON (t1.c1 = t3.c1);
+INFO: hint syntax error at or near "Leading()"
+DETAIL: Leading hint requires at least two relations.
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+Leading()
+
+ QUERY PLAN
+------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t3.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t3_i1 on t3
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(9 rows)
+
+-- No. L-3-5-2
+/*+Leading(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1
+ JOIN s1.t2 ON (t1.c1 = t2.c1)
+ JOIN s1.t3 ON (t1.c1 = t3.c1);
+INFO: hint syntax error at or near "Leading(t1)"
+DETAIL: Leading hint requires at least two relations.
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+Leading(t1)
+
+ QUERY PLAN
+------------------------------------------
+ Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Merge Join
+ Merge Cond: (t1.c1 = t3.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Index Scan using t3_i1 on t3
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(9 rows)
+
+-- No. L-3-5-3
+/*+Leading(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1
+ JOIN s1.t2 ON (t1.c1 = t2.c1)
+ JOIN s1.t3 ON (t1.c1 = t3.c1);
+LOG: pg_hint_plan:
+used hint:
+Leading(t1 t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+ -> Index Scan using t3_i1 on t3
+ Index Cond: (c1 = t1.c1)
+(9 rows)
+
+-- No. L-3-5-4
+/*+Leading(t1 t2 t3)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1
+ JOIN s1.t2 ON (t1.c1 = t2.c1)
+ JOIN s1.t3 ON (t1.c1 = t3.c1);
+LOG: pg_hint_plan:
+used hint:
+Leading(t1 t2 t3)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------
+ Hash Join
+ Hash Cond: (t3.c1 = t1.c1)
+ -> Seq Scan on t3
+ -> Hash
+ -> Merge Join
+ Merge Cond: (t1.c1 = t2.c1)
+ -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t2.c1
+ -> Seq Scan on t2
+(10 rows)
+
--- /dev/null
+LOAD 'pg_hint_plan';
+SET pg_hint_plan.enable_hint TO on;
+SET pg_hint_plan.debug_print TO on;
+SET client_min_messages TO LOG;
+SET search_path TO public;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 >= 1;
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c1 >= 1)
+(2 rows)
+
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c3 < 10;
+ QUERY PLAN
+---------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c3 < 10)
+ -> Bitmap Index Scan on t1_i
+ Index Cond: (c3 < 10)
+(4 rows)
+
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(3 rows)
+
+----
+---- No. S-1-1 specified pattern of the object name
+----
+-- No. S-1-1-1
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. S-1-1-2
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 t_1 WHERE t_1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+SeqScan(t1)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Index Scan using t1_i1 on t1 t_1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. S-1-1-3
+/*+SeqScan(t_1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 t_1 WHERE t_1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t_1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1 t_1
+ Filter: (c1 = 1)
+(2 rows)
+
+----
+---- No. S-1-2 specified schema name in the hint option
+----
+-- No. S-1-2-1
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. S-1-2-2
+/*+SeqScan(s1.t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+SeqScan(s1.t1)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+----
+---- No. S-1-3 table doesn't exist in the hint option
+----
+-- No. S-1-3-1
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. S-1-3-2
+/*+SeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+SeqScan(t2)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+----
+---- No. S-1-4 conflict table name
+----
+-- No. S-1-4-1
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = 1 AND t1.c1 = t2.c1;
+ QUERY PLAN
+------------------------------------
+ Nested Loop
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+ -> Seq Scan on t2
+ Filter: (c1 = 1)
+(5 rows)
+
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = 1 AND t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------
+ Nested Loop
+ -> Seq Scan on t1
+ Filter: (c1 = 1)
+ -> Seq Scan on t2
+ Filter: (c1 = 1)
+(5 rows)
+
+-- No. S-1-4-2
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s2.t1 WHERE s1.t1.c1 = 1 AND s1.t1.c1 = s2.t1.c1;
+ QUERY PLAN
+------------------------------------
+ Nested Loop
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+ -> Seq Scan on t1
+ Filter: (c1 = 1)
+(5 rows)
+
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s2.t1 WHERE s1.t1.c1 = 1 AND s1.t1.c1 = s2.t1.c1;
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Bitmap Heap Scan on t1
+ Recheck Cond: (c1 = 1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 = 1)
+ -> Bitmap Heap Scan on t1
+ Recheck Cond: (c1 = 1)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: (c1 = 1)
+(9 rows)
+
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s2.t1 s2t1 WHERE s1.t1.c1 = 1 AND s1.t1.c1 = s2t1.c1;
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------
+ Nested Loop
+ -> Bitmap Heap Scan on t1
+ Recheck Cond: (c1 = 1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 = 1)
+ -> Seq Scan on t1 s2t1
+ Filter: (c1 = 1)
+(7 rows)
+
+/*+BitmapScan(s2t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s2.t1 s2t1 WHERE s1.t1.c1 = 1 AND s1.t1.c1 = s2t1.c1;
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(s2t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+ -> Bitmap Heap Scan on t1 s2t1
+ Recheck Cond: (c1 = 1)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: (c1 = 1)
+(7 rows)
+
+-- No. S-1-4-3
+EXPLAIN (COSTS false) SELECT (SELECT max(c1) FROM s1.t1 WHERE s1.t1.c1 = 1) FROM s1.t1 WHERE s1.t1.c1 = 1;
+ QUERY PLAN
+---------------------------------------------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+ InitPlan 2 (returns $1)
+ -> Result
+ InitPlan 1 (returns $0)
+ -> Limit
+ -> Index Scan using t1_i1 on t1
+ Index Cond: ((c1 IS NOT NULL) AND (c1 = 1))
+(8 rows)
+
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) SELECT (SELECT max(c1) FROM s1.t1 WHERE s1.t1.c1 = 1) FROM s1.t1 WHERE s1.t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 = 1)
+ InitPlan 2 (returns $1)
+ -> Result
+ InitPlan 1 (returns $0)
+ -> Limit
+ -> Bitmap Heap Scan on t1
+ Recheck Cond: ((c1 IS NOT NULL) AND (c1 = 1))
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: ((c1 IS NOT NULL) AND (c1 = 1))
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 = 1)
+(12 rows)
+
+/*+BitmapScan(t11)*/
+EXPLAIN (COSTS false) SELECT (SELECT max(c1) FROM s1.t1 t11 WHERE t11.c1 = 1) FROM s1.t1 t12 WHERE t12.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t11)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------------------
+ Index Scan using t1_i1 on t1 t12
+ Index Cond: (c1 = 1)
+ InitPlan 2 (returns $1)
+ -> Result
+ InitPlan 1 (returns $0)
+ -> Limit
+ -> Bitmap Heap Scan on t1 t11
+ Recheck Cond: ((c1 IS NOT NULL) AND (c1 = 1))
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: ((c1 IS NOT NULL) AND (c1 = 1))
+(10 rows)
+
+/*+BitmapScan(t12)*/
+EXPLAIN (COSTS false) SELECT (SELECT max(c1) FROM s1.t1 t11 WHERE t11.c1 = 1) FROM s1.t1 t12 WHERE t12.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t12)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------------
+ Bitmap Heap Scan on t1 t12
+ Recheck Cond: (c1 = 1)
+ InitPlan 2 (returns $1)
+ -> Result
+ InitPlan 1 (returns $0)
+ -> Limit
+ -> Index Scan using t1_i1 on t1 t11
+ Index Cond: ((c1 IS NOT NULL) AND (c1 = 1))
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 = 1)
+(10 rows)
+
+----
+---- No. S-1-5 object type for the hint
+----
+-- No. S-1-5-1
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. S-1-5-2
+EXPLAIN (COSTS false) SELECT * FROM s1.p1 WHERE p1.c1 = 1;
+ QUERY PLAN
+---------------------------------
+ Result
+ -> Append
+ -> Seq Scan on p1
+ Filter: (c1 = 1)
+ -> Seq Scan on p1c1 p1
+ Filter: (c1 = 1)
+(6 rows)
+
+/*+IndexScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.p1 WHERE p1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+IndexScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------
+ Result
+ -> Append
+ -> Index Scan using p1_i on p1
+ Index Cond: (c1 = 1)
+ -> Index Scan using p1c1_i on p1c1 p1
+ Index Cond: (c1 = 1)
+(6 rows)
+
+-- No. S-1-5-3
+EXPLAIN (COSTS false) SELECT * FROM s1.ul1 WHERE ul1.c1 = 1;
+ QUERY PLAN
+----------------------------------
+ Index Scan using ul1_pkey on ul1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+/*+SeqScan(ul1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ul1 WHERE ul1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(ul1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on ul1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. S-1-5-4
+CREATE TEMP TABLE tm1 (LIKE s1.t1 INCLUDING ALL);
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "tm1_pkey" for table "tm1"
+EXPLAIN (COSTS false) SELECT * FROM tm1 WHERE tm1.c1 = 1;
+ QUERY PLAN
+----------------------------------
+ Index Scan using tm1_pkey on tm1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+/*+SeqScan(tm1)*/
+EXPLAIN (COSTS false) SELECT * FROM tm1 WHERE tm1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(tm1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on tm1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. S-1-5-5
+EXPLAIN (COSTS false) SELECT * FROM pg_catalog.pg_class WHERE oid = 1;
+ QUERY PLAN
+-------------------------------------------------
+ Index Scan using pg_class_oid_index on pg_class
+ Index Cond: (oid = 1::oid)
+(2 rows)
+
+/*+SeqScan(pg_class)*/
+EXPLAIN (COSTS false) SELECT * FROM pg_catalog.pg_class WHERE oid = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(pg_class)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------
+ Seq Scan on pg_class
+ Filter: (oid = 1::oid)
+(2 rows)
+
+-- No. S-1-5-6
+-- refer ut-fdw.sql
+-- No. S-1-5-7
+EXPLAIN (COSTS false) SELECT * FROM s1.f1() AS ft1 WHERE ft1.c1 = 1;
+ QUERY PLAN
+-------------------------
+ Function Scan on f1 ft1
+ Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan(ft1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.f1() AS ft1 WHERE ft1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+SeqScan(ft1)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------
+ Function Scan on f1 ft1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. S-1-5-8
+EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1'), (2,2,2,'2'), (3,3,3,'3')) AS val1 (c1, c2, c3, c4) WHERE val1.c1 = 1;
+ QUERY PLAN
+---------------------------
+ Values Scan on "*VALUES*"
+ Filter: (column1 = 1)
+(2 rows)
+
+/*+SeqScan(val1)*/
+EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1'), (2,2,2,'2'), (3,3,3,'3')) AS val1 (c1, c2, c3, c4) WHERE val1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+SeqScan(val1)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------
+ Values Scan on "*VALUES*"
+ Filter: (column1 = 1)
+(2 rows)
+
+/*+SeqScan(*VALUES*)*/
+EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1'), (2,2,2,'2'), (3,3,3,'3')) AS val1 (c1, c2, c3, c4) WHERE val1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+SeqScan(*VALUES*)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------
+ Values Scan on "*VALUES*"
+ Filter: (column1 = 1)
+(2 rows)
+
+-- No. S-1-5-9
+EXPLAIN (COSTS false) WITH c1(c1) AS (SELECT max(c1) FROM s1.t1 WHERE t1.c1 = 1)
+SELECT * FROM s1.t1, c1 WHERE t1.c1 = 1 AND t1.c1 = c1.c1;
+ QUERY PLAN
+---------------------------------------------------------------------
+ Nested Loop
+ CTE c1
+ -> Result
+ InitPlan 1 (returns $0)
+ -> Limit
+ -> Index Scan using t1_i1 on t1
+ Index Cond: ((c1 IS NOT NULL) AND (c1 = 1))
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+ -> CTE Scan on c1
+ Filter: (c1 = 1)
+(11 rows)
+
+/*+SeqScan(c1)*/
+EXPLAIN (COSTS false) WITH c1(c1) AS (SELECT max(c1) FROM s1.t1 WHERE t1.c1 = 1)
+SELECT * FROM s1.t1, c1 WHERE t1.c1 = 1 AND t1.c1 = c1.c1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+SeqScan(c1)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------------
+ Nested Loop
+ CTE c1
+ -> Result
+ InitPlan 1 (returns $0)
+ -> Limit
+ -> Index Scan using t1_i1 on t1
+ Index Cond: ((c1 IS NOT NULL) AND (c1 = 1))
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+ -> CTE Scan on c1
+ Filter: (c1 = 1)
+(11 rows)
+
+-- No. S-1-5-10
+EXPLAIN (COSTS false) SELECT * FROM s1.v1 WHERE v1.c1 = 1;
+ QUERY PLAN
+-----------------------------------
+ Index Scan using t1_i1 on t1 v1t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+/*+SeqScan(v1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.v1 WHERE v1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+SeqScan(v1)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------
+ Index Scan using t1_i1 on t1 v1t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. S-1-5-11
+EXPLAIN (COSTS false) SELECT * FROM (SELECT * FROM s1.t1 WHERE t1.c1 = 1) AS s1 WHERE s1.c1 = 1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+/*+SeqScan(s1)*/
+EXPLAIN (COSTS false) SELECT * FROM (SELECT * FROM s1.t1 WHERE t1.c1 = 1) AS s1 WHERE s1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+SeqScan(s1)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+----
+---- No. S-2-1 complexity query block
+----
+-- No. S-2-1-1
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1), (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
+;
+ QUERY PLAN
+-------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t2.c1)
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t4.c1)
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t3.c1)
+ -> Index Scan using t1_i1 on t1 b1t1
+ -> Index Scan using t3_i1 on t3 b1t3
+ -> Index Scan using t4_i1 on t4 b1t4
+ -> Sort
+ Sort Key: b1t2.c1
+ -> Seq Scan on t2 b1t2
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt2.c1)
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt4.c1)
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt3.c1)
+ -> Index Scan using t1_i1 on t1 bmt1
+ -> Index Scan using t3_i1 on t3 bmt3
+ -> Index Scan using t4_i1 on t4 bmt4
+ -> Sort
+ Sort Key: bmt2.c1
+ -> Seq Scan on t2 bmt2
+(27 rows)
+
+/*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4)
+TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey)
+*/
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1), (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
+;
+LOG: pg_hint_plan:
+used hint:
+TidScan(b1t1)
+SeqScan(b1t2)
+IndexScan(b1t3 t3_pkey)
+BitmapScan(b1t4 t4_pkey)
+SeqScan(bmt1)
+IndexScan(bmt2 t2_pkey)
+BitmapScan(bmt3 t3_pkey)
+TidScan(bmt4)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $1)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t2.c1)
+ -> Nested Loop
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t3.c1)
+ -> Sort
+ Sort Key: b1t1.c1
+ -> Seq Scan on t1 b1t1
+ -> Index Scan using t3_pkey on t3 b1t3
+ -> Bitmap Heap Scan on t4 b1t4
+ Recheck Cond: (c1 = b1t1.c1)
+ -> Bitmap Index Scan on t4_pkey
+ Index Cond: (c1 = b1t1.c1)
+ -> Sort
+ Sort Key: b1t2.c1
+ -> Seq Scan on t2 b1t2
+ -> Hash Join
+ Hash Cond: (bmt4.c1 = bmt1.c1)
+ -> Seq Scan on t4 bmt4
+ -> Hash
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (bmt1.c1 = bmt2.c1)
+ -> Seq Scan on t1 bmt1
+ -> Hash
+ -> Index Scan using t2_pkey on t2 bmt2
+ -> Bitmap Heap Scan on t3 bmt3
+ Recheck Cond: (c1 = bmt1.c1)
+ -> Bitmap Index Scan on t3_pkey
+ Index Cond: (c1 = bmt1.c1)
+(33 rows)
+
+-- No. S-2-1-2
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1), (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
+), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.c1 = b2t2.c1 AND b2t1.c1 = b2t3.c1 AND b2t1.c1 = b2t4.c1
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
+;
+ QUERY PLAN
+-------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t2.c1)
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t4.c1)
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t3.c1)
+ -> Index Scan using t1_i1 on t1 b1t1
+ -> Index Scan using t3_i1 on t3 b1t3
+ -> Index Scan using t4_i1 on t4 b1t4
+ -> Sort
+ Sort Key: b1t2.c1
+ -> Seq Scan on t2 b1t2
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (b2t1.c1 = b2t2.c1)
+ -> Merge Join
+ Merge Cond: (b2t1.c1 = b2t4.c1)
+ -> Merge Join
+ Merge Cond: (b2t1.c1 = b2t3.c1)
+ -> Index Scan using t1_i1 on t1 b2t1
+ -> Index Scan using t3_i1 on t3 b2t3
+ -> Index Scan using t4_i1 on t4 b2t4
+ -> Sort
+ Sort Key: b2t2.c1
+ -> Seq Scan on t2 b2t2
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt2.c1)
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt4.c1)
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt3.c1)
+ -> Index Scan using t1_i1 on t1 bmt1
+ -> Index Scan using t3_i1 on t3 bmt3
+ -> Index Scan using t4_i1 on t4 bmt4
+ -> Sort
+ Sort Key: bmt2.c1
+ -> Seq Scan on t2 bmt2
+(41 rows)
+
+/*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4)
+TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey)
+BitmapScan(b2t1 t1_pkey)TidScan(b2t2)SeqScan(b2t3)IndexScan(b2t4 t4_pkey)
+*/
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1), (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
+), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.c1 = b2t2.c1 AND b2t1.c1 = b2t3.c1 AND b2t1.c1 = b2t4.c1
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
+;
+LOG: pg_hint_plan:
+used hint:
+TidScan(b1t1)
+SeqScan(b1t2)
+IndexScan(b1t3 t3_pkey)
+BitmapScan(b1t4 t4_pkey)
+BitmapScan(b2t1 t1_pkey)
+TidScan(b2t2)
+SeqScan(b2t3)
+IndexScan(b2t4 t4_pkey)
+SeqScan(bmt1)
+IndexScan(bmt2 t2_pkey)
+BitmapScan(bmt3 t3_pkey)
+TidScan(bmt4)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $1)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t2.c1)
+ -> Nested Loop
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t3.c1)
+ -> Sort
+ Sort Key: b1t1.c1
+ -> Seq Scan on t1 b1t1
+ -> Index Scan using t3_pkey on t3 b1t3
+ -> Bitmap Heap Scan on t4 b1t4
+ Recheck Cond: (c1 = b1t1.c1)
+ -> Bitmap Index Scan on t4_pkey
+ Index Cond: (c1 = b1t1.c1)
+ -> Sort
+ Sort Key: b1t2.c1
+ -> Seq Scan on t2 b1t2
+ InitPlan 2 (returns $3)
+ -> Aggregate
+ -> Hash Join
+ Hash Cond: (b2t3.c1 = b2t1.c1)
+ -> Seq Scan on t3 b2t3
+ -> Hash
+ -> Merge Join
+ Merge Cond: (b2t1.c1 = b2t2.c1)
+ -> Nested Loop
+ -> Index Scan using t4_pkey on t4 b2t4
+ -> Bitmap Heap Scan on t1 b2t1
+ Recheck Cond: (c1 = b2t4.c1)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: (c1 = b2t4.c1)
+ -> Sort
+ Sort Key: b2t2.c1
+ -> Seq Scan on t2 b2t2
+ -> Hash Join
+ Hash Cond: (bmt4.c1 = bmt1.c1)
+ -> Seq Scan on t4 bmt4
+ -> Hash
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (bmt1.c1 = bmt2.c1)
+ -> Seq Scan on t1 bmt1
+ -> Hash
+ -> Index Scan using t2_pkey on t2 bmt2
+ -> Bitmap Heap Scan on t3 bmt3
+ Recheck Cond: (c1 = bmt1.c1)
+ -> Bitmap Index Scan on t3_pkey
+ Index Cond: (c1 = bmt1.c1)
+(50 rows)
+
+-- No. S-2-1-3
+EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, (SELECT * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = sbmt4.c1;
+ QUERY PLAN
+-----------------------------------------------------------
+ Aggregate
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt2.c1)
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt4.c1)
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt3.c1)
+ -> Index Scan using t1_i1 on t1 bmt1
+ -> Index Scan using t3_i1 on t3 bmt3
+ -> Index Scan using t4_i1 on t4 bmt4
+ -> Sort
+ Sort Key: bmt2.c1
+ -> Seq Scan on t2 bmt2
+(13 rows)
+
+/*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4)
+*/
+EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, (SELECT * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = sbmt4.c1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(bmt1)
+IndexScan(bmt2 t2_pkey)
+BitmapScan(bmt3 t3_pkey)
+TidScan(bmt4)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------------------------
+ Aggregate
+ -> Hash Join
+ Hash Cond: (bmt4.c1 = bmt1.c1)
+ -> Seq Scan on t4 bmt4
+ -> Hash
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (bmt1.c1 = bmt2.c1)
+ -> Seq Scan on t1 bmt1
+ -> Hash
+ -> Index Scan using t2_pkey on t2 bmt2
+ -> Bitmap Heap Scan on t3 bmt3
+ Recheck Cond: (c1 = bmt1.c1)
+ -> Bitmap Index Scan on t3_pkey
+ Index Cond: (c1 = bmt1.c1)
+(15 rows)
+
+-- No. S-2-1-4
+EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, (SELECT * FROM s1.t3 bmt3) sbmt3, (SELECT * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = sbmt3.c1 AND bmt1.c1 = sbmt4.c1;
+ QUERY PLAN
+-----------------------------------------------------------
+ Aggregate
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt2.c1)
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt4.c1)
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt3.c1)
+ -> Index Scan using t1_i1 on t1 bmt1
+ -> Index Scan using t3_i1 on t3 bmt3
+ -> Index Scan using t4_i1 on t4 bmt4
+ -> Sort
+ Sort Key: bmt2.c1
+ -> Seq Scan on t2 bmt2
+(13 rows)
+
+/*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4)
+*/
+EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, (SELECT * FROM s1.t3 bmt3) sbmt3, (SELECT * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = sbmt3.c1 AND bmt1.c1 = sbmt4.c1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(bmt1)
+IndexScan(bmt2 t2_pkey)
+BitmapScan(bmt3 t3_pkey)
+TidScan(bmt4)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------------------------
+ Aggregate
+ -> Hash Join
+ Hash Cond: (bmt4.c1 = bmt1.c1)
+ -> Seq Scan on t4 bmt4
+ -> Hash
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (bmt1.c1 = bmt2.c1)
+ -> Seq Scan on t1 bmt1
+ -> Hash
+ -> Index Scan using t2_pkey on t2 bmt2
+ -> Bitmap Heap Scan on t3 bmt3
+ Recheck Cond: (c1 = bmt1.c1)
+ -> Bitmap Index Scan on t3_pkey
+ Index Cond: (c1 = bmt1.c1)
+(15 rows)
+
+-- No. S-2-1-5
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
+ AND bmt1.c1 <> (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
+)
+;
+ QUERY PLAN
+-------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t2.c1)
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t4.c1)
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t3.c1)
+ -> Index Scan using t1_i1 on t1 b1t1
+ -> Index Scan using t3_i1 on t3 b1t3
+ -> Index Scan using t4_i1 on t4 b1t4
+ -> Sort
+ Sort Key: b1t2.c1
+ -> Seq Scan on t2 b1t2
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt2.c1)
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt4.c1)
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt3.c1)
+ -> Index Scan using t1_i1 on t1 bmt1
+ Filter: (c1 <> $0)
+ -> Index Scan using t3_i1 on t3 bmt3
+ -> Index Scan using t4_i1 on t4 bmt4
+ -> Sort
+ Sort Key: bmt2.c1
+ -> Seq Scan on t2 bmt2
+(28 rows)
+
+/*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4)
+TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey)
+*/
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
+ AND bmt1.c1 <> (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
+)
+;
+LOG: pg_hint_plan:
+used hint:
+TidScan(b1t1)
+SeqScan(b1t2)
+IndexScan(b1t3 t3_pkey)
+BitmapScan(b1t4 t4_pkey)
+SeqScan(bmt1)
+IndexScan(bmt2 t2_pkey)
+BitmapScan(bmt3 t3_pkey)
+TidScan(bmt4)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $1)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t2.c1)
+ -> Nested Loop
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t3.c1)
+ -> Sort
+ Sort Key: b1t1.c1
+ -> Seq Scan on t1 b1t1
+ -> Index Scan using t3_pkey on t3 b1t3
+ -> Bitmap Heap Scan on t4 b1t4
+ Recheck Cond: (c1 = b1t1.c1)
+ -> Bitmap Index Scan on t4_pkey
+ Index Cond: (c1 = b1t1.c1)
+ -> Sort
+ Sort Key: b1t2.c1
+ -> Seq Scan on t2 b1t2
+ -> Hash Join
+ Hash Cond: (bmt4.c1 = bmt1.c1)
+ -> Seq Scan on t4 bmt4
+ -> Hash
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (bmt1.c1 = bmt2.c1)
+ -> Seq Scan on t1 bmt1
+ Filter: (c1 <> $1)
+ -> Hash
+ -> Index Scan using t2_pkey on t2 bmt2
+ -> Bitmap Heap Scan on t3 bmt3
+ Recheck Cond: (c1 = bmt1.c1)
+ -> Bitmap Index Scan on t3_pkey
+ Index Cond: (c1 = bmt1.c1)
+(34 rows)
+
+-- No. S-2-1-6
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
+ AND bmt1.c1 <> (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
+) AND bmt1.c1 <> (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.c1 = b2t2.c1 AND b2t1.c1 = b2t3.c1 AND b2t1.c1 = b2t4.c1
+)
+;
+ QUERY PLAN
+-------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t2.c1)
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t4.c1)
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t3.c1)
+ -> Index Scan using t1_i1 on t1 b1t1
+ -> Index Scan using t3_i1 on t3 b1t3
+ -> Index Scan using t4_i1 on t4 b1t4
+ -> Sort
+ Sort Key: b1t2.c1
+ -> Seq Scan on t2 b1t2
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (b2t1.c1 = b2t2.c1)
+ -> Merge Join
+ Merge Cond: (b2t1.c1 = b2t4.c1)
+ -> Merge Join
+ Merge Cond: (b2t1.c1 = b2t3.c1)
+ -> Index Scan using t1_i1 on t1 b2t1
+ -> Index Scan using t3_i1 on t3 b2t3
+ -> Index Scan using t4_i1 on t4 b2t4
+ -> Sort
+ Sort Key: b2t2.c1
+ -> Seq Scan on t2 b2t2
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt2.c1)
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt4.c1)
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt3.c1)
+ -> Index Scan using t1_i1 on t1 bmt1
+ Filter: ((c1 <> $0) AND (c1 <> $1))
+ -> Index Scan using t3_i1 on t3 bmt3
+ -> Index Scan using t4_i1 on t4 bmt4
+ -> Sort
+ Sort Key: bmt2.c1
+ -> Seq Scan on t2 bmt2
+(42 rows)
+
+/*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4)
+TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey)
+BitmapScan(b2t1 t1_pkey)TidScan(b2t2)SeqScan(b2t3)IndexScan(b2t4 t4_pkey)
+*/
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
+ AND bmt1.c1 <> (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
+) AND bmt1.c1 <> (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.c1 = b2t2.c1 AND b2t1.c1 = b2t3.c1 AND b2t1.c1 = b2t4.c1
+)
+;
+LOG: pg_hint_plan:
+used hint:
+TidScan(b1t1)
+SeqScan(b1t2)
+IndexScan(b1t3 t3_pkey)
+BitmapScan(b1t4 t4_pkey)
+BitmapScan(b2t1 t1_pkey)
+TidScan(b2t2)
+SeqScan(b2t3)
+IndexScan(b2t4 t4_pkey)
+SeqScan(bmt1)
+IndexScan(bmt2 t2_pkey)
+BitmapScan(bmt3 t3_pkey)
+TidScan(bmt4)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $1)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t2.c1)
+ -> Nested Loop
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t3.c1)
+ -> Sort
+ Sort Key: b1t1.c1
+ -> Seq Scan on t1 b1t1
+ -> Index Scan using t3_pkey on t3 b1t3
+ -> Bitmap Heap Scan on t4 b1t4
+ Recheck Cond: (c1 = b1t1.c1)
+ -> Bitmap Index Scan on t4_pkey
+ Index Cond: (c1 = b1t1.c1)
+ -> Sort
+ Sort Key: b1t2.c1
+ -> Seq Scan on t2 b1t2
+ InitPlan 2 (returns $3)
+ -> Aggregate
+ -> Hash Join
+ Hash Cond: (b2t3.c1 = b2t1.c1)
+ -> Seq Scan on t3 b2t3
+ -> Hash
+ -> Merge Join
+ Merge Cond: (b2t1.c1 = b2t2.c1)
+ -> Nested Loop
+ -> Index Scan using t4_pkey on t4 b2t4
+ -> Bitmap Heap Scan on t1 b2t1
+ Recheck Cond: (c1 = b2t4.c1)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: (c1 = b2t4.c1)
+ -> Sort
+ Sort Key: b2t2.c1
+ -> Seq Scan on t2 b2t2
+ -> Hash Join
+ Hash Cond: (bmt4.c1 = bmt1.c1)
+ -> Seq Scan on t4 bmt4
+ -> Hash
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (bmt1.c1 = bmt2.c1)
+ -> Seq Scan on t1 bmt1
+ Filter: ((c1 <> $1) AND (c1 <> $3))
+ -> Hash
+ -> Index Scan using t2_pkey on t2 bmt2
+ -> Bitmap Heap Scan on t3 bmt3
+ Recheck Cond: (c1 = bmt1.c1)
+ -> Bitmap Index Scan on t3_pkey
+ Index Cond: (c1 = bmt1.c1)
+(51 rows)
+
+-- No. S-2-1-7
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
+)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
+, c1
+ WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
+AND bmt1.c1 = c1.c1
+;
+ QUERY PLAN
+-------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t2.c1)
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t4.c1)
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t3.c1)
+ -> Index Scan using t1_i1 on t1 b1t1
+ -> Index Scan using t3_i1 on t3 b1t3
+ -> Index Scan using t4_i1 on t4 b1t4
+ -> Sort
+ Sort Key: b1t2.c1
+ -> Seq Scan on t2 b1t2
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt2.c1)
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt4.c1)
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt3.c1)
+ -> Index Scan using t1_i1 on t1 bmt1
+ -> Index Scan using t3_i1 on t3 bmt3
+ -> Index Scan using t4_i1 on t4 bmt4
+ -> Sort
+ Sort Key: bmt2.c1
+ -> Hash Join
+ Hash Cond: (bmt2.c1 = c1.c1)
+ -> Seq Scan on t2 bmt2
+ -> Hash
+ -> CTE Scan on c1
+(31 rows)
+
+/*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4)
+TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
+)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
+, c1
+ WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
+AND bmt1.c1 = c1.c1
+;
+LOG: pg_hint_plan:
+used hint:
+TidScan(b1t1)
+SeqScan(b1t2)
+IndexScan(b1t3 t3_pkey)
+BitmapScan(b1t4 t4_pkey)
+SeqScan(bmt1)
+IndexScan(bmt2 t2_pkey)
+BitmapScan(bmt3 t3_pkey)
+TidScan(bmt4)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t2.c1)
+ -> Nested Loop
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t3.c1)
+ -> Sort
+ Sort Key: b1t1.c1
+ -> Seq Scan on t1 b1t1
+ -> Index Scan using t3_pkey on t3 b1t3
+ -> Bitmap Heap Scan on t4 b1t4
+ Recheck Cond: (c1 = b1t1.c1)
+ -> Bitmap Index Scan on t4_pkey
+ Index Cond: (c1 = b1t1.c1)
+ -> Sort
+ Sort Key: b1t2.c1
+ -> Seq Scan on t2 b1t2
+ -> Hash Join
+ Hash Cond: (bmt4.c1 = bmt1.c1)
+ -> Seq Scan on t4 bmt4
+ -> Hash
+ -> Nested Loop
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (bmt1.c1 = c1.c1)
+ -> Seq Scan on t1 bmt1
+ -> Hash
+ -> CTE Scan on c1
+ -> Index Scan using t2_pkey on t2 bmt2
+ Index Cond: (c1 = bmt1.c1)
+ -> Bitmap Heap Scan on t3 bmt3
+ Recheck Cond: (c1 = bmt1.c1)
+ -> Bitmap Index Scan on t3_pkey
+ Index Cond: (c1 = bmt1.c1)
+(36 rows)
+
+-- No. S-2-1-8
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
+)
+, c2 (c1) AS (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.c1 = b2t2.c1 AND b2t1.c1 = b2t3.c1 AND b2t1.c1 = b2t4.c1
+)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
+, c1, c2
+ WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 = c2.c1
+;
+ QUERY PLAN
+-------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t2.c1)
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t4.c1)
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t3.c1)
+ -> Index Scan using t1_i1 on t1 b1t1
+ -> Index Scan using t3_i1 on t3 b1t3
+ -> Index Scan using t4_i1 on t4 b1t4
+ -> Sort
+ Sort Key: b1t2.c1
+ -> Seq Scan on t2 b1t2
+ CTE c2
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (b2t1.c1 = b2t2.c1)
+ -> Merge Join
+ Merge Cond: (b2t1.c1 = b2t4.c1)
+ -> Merge Join
+ Merge Cond: (b2t1.c1 = b2t3.c1)
+ -> Index Scan using t1_i1 on t1 b2t1
+ -> Index Scan using t3_i1 on t3 b2t3
+ -> Index Scan using t4_i1 on t4 b2t4
+ -> Sort
+ Sort Key: b2t2.c1
+ -> Seq Scan on t2 b2t2
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = c2.c1)
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt2.c1)
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt4.c1)
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt3.c1)
+ -> Index Scan using t1_i1 on t1 bmt1
+ -> Index Scan using t3_i1 on t3 bmt3
+ -> Index Scan using t4_i1 on t4 bmt4
+ -> Sort
+ Sort Key: bmt2.c1
+ -> Hash Join
+ Hash Cond: (bmt2.c1 = c1.c1)
+ -> Seq Scan on t2 bmt2
+ -> Hash
+ -> CTE Scan on c1
+ -> CTE Scan on c2
+(48 rows)
+
+/*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4)
+TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey)
+BitmapScan(b2t1 t1_pkey)TidScan(b2t2)SeqScan(b2t3)IndexScan(b2t4 t4_pkey)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
+)
+, c2 (c1) AS (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.c1 = b2t2.c1 AND b2t1.c1 = b2t3.c1 AND b2t1.c1 = b2t4.c1
+)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
+, c1, c2
+ WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 = c2.c1
+;
+LOG: pg_hint_plan:
+used hint:
+TidScan(b1t1)
+SeqScan(b1t2)
+IndexScan(b1t3 t3_pkey)
+BitmapScan(b1t4 t4_pkey)
+BitmapScan(b2t1 t1_pkey)
+TidScan(b2t2)
+SeqScan(b2t3)
+IndexScan(b2t4 t4_pkey)
+SeqScan(bmt1)
+IndexScan(bmt2 t2_pkey)
+BitmapScan(bmt3 t3_pkey)
+TidScan(bmt4)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t2.c1)
+ -> Nested Loop
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t3.c1)
+ -> Sort
+ Sort Key: b1t1.c1
+ -> Seq Scan on t1 b1t1
+ -> Index Scan using t3_pkey on t3 b1t3
+ -> Bitmap Heap Scan on t4 b1t4
+ Recheck Cond: (c1 = b1t1.c1)
+ -> Bitmap Index Scan on t4_pkey
+ Index Cond: (c1 = b1t1.c1)
+ -> Sort
+ Sort Key: b1t2.c1
+ -> Seq Scan on t2 b1t2
+ CTE c2
+ -> Aggregate
+ -> Hash Join
+ Hash Cond: (b2t3.c1 = b2t1.c1)
+ -> Seq Scan on t3 b2t3
+ -> Hash
+ -> Merge Join
+ Merge Cond: (b2t1.c1 = b2t2.c1)
+ -> Nested Loop
+ -> Index Scan using t4_pkey on t4 b2t4
+ -> Bitmap Heap Scan on t1 b2t1
+ Recheck Cond: (c1 = b2t4.c1)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: (c1 = b2t4.c1)
+ -> Sort
+ Sort Key: b2t2.c1
+ -> Seq Scan on t2 b2t2
+ -> Hash Join
+ Hash Cond: (bmt4.c1 = bmt1.c1)
+ -> Seq Scan on t4 bmt4
+ -> Hash
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = c2.c1)
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (bmt1.c1 = c1.c1)
+ -> Seq Scan on t1 bmt1
+ -> Hash
+ -> CTE Scan on c1
+ -> Index Scan using t2_pkey on t2 bmt2
+ Index Cond: (c1 = bmt1.c1)
+ -> CTE Scan on c2
+ -> Bitmap Heap Scan on t3 bmt3
+ Recheck Cond: (c1 = bmt1.c1)
+ -> Bitmap Index Scan on t3_pkey
+ Index Cond: (c1 = bmt1.c1)
+(56 rows)
+
+----
+---- No. S-2-2 the number of the tables per quiry block
+----
+-- No. S-2-2-1
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = 1
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = 1
+)
+ FROM s1.t1 bmt1, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = 1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = 1
+)
+;
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Result
+ InitPlan 1 (returns $0)
+ -> Limit
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 4 (returns $3)
+ -> Result
+ InitPlan 3 (returns $2)
+ -> Limit
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 6 (returns $5)
+ -> Result
+ InitPlan 5 (returns $4)
+ -> Limit
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 IS NOT NULL) AND (c1 = 1))
+ -> Nested Loop
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 <> $5) AND (c1 = 1))
+ -> CTE Scan on c1
+(27 rows)
+
+/*+SeqScan(bmt1)
+TidScan(b1t1)
+BitmapScan(b2t1 t1_pkey)
+IndexScan(b3t1 t1_pkey)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = 1
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = 1
+)
+ FROM s1.t1 bmt1, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = 1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = 1
+)
+;
+LOG: pg_hint_plan:
+used hint:
+TidScan(b1t1)
+BitmapScan(b2t1 t1_pkey)
+IndexScan(b3t1 t1_pkey)
+SeqScan(bmt1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Result
+ InitPlan 1 (returns $0)
+ -> Limit
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 4 (returns $3)
+ -> Result
+ InitPlan 3 (returns $2)
+ -> Limit
+ -> Bitmap Heap Scan on t1 b2t1
+ Recheck Cond: ((c1 IS NOT NULL) AND (c1 = 1))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 6 (returns $5)
+ -> Result
+ InitPlan 5 (returns $4)
+ -> Limit
+ -> Index Scan using t1_pkey on t1 b3t1
+ Index Cond: ((c1 IS NOT NULL) AND (c1 = 1))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ -> Seq Scan on t1 bmt1
+ Filter: ((c1 <> $5) AND (ctid = '(1,1)'::tid) AND (c1 = 1))
+ -> CTE Scan on c1
+(28 rows)
+
+-- No. S-2-2-2
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)'
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)'
+)
+;
+ QUERY PLAN
+-------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t2.c1)
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 <> $2)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> CTE Scan on c1
+(34 rows)
+
+/*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)
+TidScan(b1t1)SeqScan(b1t2)
+BitmapScan(b2t1 t1_pkey)TidScan(b2t2)
+IndexScan(b3t1 t1_pkey)BitmapScan(b3t2 t2_pkey)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)'
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)'
+)
+;
+LOG: pg_hint_plan:
+used hint:
+TidScan(b1t1)
+SeqScan(b1t2)
+BitmapScan(b2t1 t1_pkey)
+TidScan(b2t2)
+IndexScan(b3t1 t1_pkey)
+BitmapScan(b3t2 t2_pkey)
+SeqScan(bmt1)
+IndexScan(bmt2 t2_pkey)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $2)
+ -> Aggregate
+ -> Nested Loop
+ -> Tid Scan on t2 b2t2
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t1 b2t1
+ Recheck Cond: (c1 = b2t2.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: (c1 = b2t2.c1)
+ InitPlan 3 (returns $4)
+ -> Aggregate
+ -> Nested Loop
+ -> Index Scan using t1_pkey on t1 b3t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t2 b3t2
+ Recheck Cond: (c1 = b3t1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t2_pkey
+ Index Cond: (c1 = b3t1.c1)
+ -> Nested Loop
+ -> Nested Loop
+ -> Seq Scan on t1 bmt1
+ Filter: ((c1 <> $4) AND (ctid = '(1,1)'::tid))
+ -> Index Scan using t2_pkey on t2 bmt2
+ Index Cond: (c1 = bmt1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> CTE Scan on c1
+(37 rows)
+
+-- No. S-2-2-3
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+;
+ QUERY PLAN
+-------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t4.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t3.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t2.c1)
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = c1.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Nested Loop
+ Join Filter: (bmt3.c1 = bmt1.c1)
+ -> Nested Loop
+ Join Filter: (bmt3.c1 = bmt4.c1)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 <> $2)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> CTE Scan on c1
+(67 rows)
+
+/*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4)
+TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey)
+BitmapScan(b2t1 t1_pkey)TidScan(b2t2)SeqScan(b2t3)IndexScan(b2t4 t4_pkey)
+IndexScan(b3t1 t1_pkey)BitmapScan(b3t2 t2_pkey)TidScan(b3t3)SeqScan(b3t4)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+;
+LOG: pg_hint_plan:
+used hint:
+TidScan(b1t1)
+SeqScan(b1t2)
+IndexScan(b1t3 t3_pkey)
+BitmapScan(b1t4 t4_pkey)
+BitmapScan(b2t1 t1_pkey)
+TidScan(b2t2)
+SeqScan(b2t3)
+IndexScan(b2t4 t4_pkey)
+IndexScan(b3t1 t1_pkey)
+BitmapScan(b3t2 t2_pkey)
+TidScan(b3t3)
+SeqScan(b3t4)
+SeqScan(bmt1)
+IndexScan(bmt2 t2_pkey)
+BitmapScan(bmt3 t3_pkey)
+TidScan(bmt4)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t3_pkey on t3 b1t3
+ Index Cond: (c1 = b1t1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t4 b1t4
+ Recheck Cond: (c1 = b1t1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t4_pkey
+ Index Cond: (c1 = b1t1.c1)
+ InitPlan 2 (returns $3)
+ -> Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ -> Tid Scan on t2 b2t2
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t1 b2t1
+ Recheck Cond: (c1 = b2t2.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: (c1 = b2t2.c1)
+ -> Seq Scan on t3 b2t3
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t4_pkey on t4 b2t4
+ Index Cond: (c1 = b2t1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $5)
+ -> Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (b3t3.c1 = b3t4.c1)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t4 b3t4
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t2 b3t2
+ Recheck Cond: (c1 = b3t3.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t2_pkey
+ Index Cond: (c1 = b3t3.c1)
+ -> Index Scan using t1_pkey on t1 b3t1
+ Index Cond: (c1 = b3t2.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = c1.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ -> Seq Scan on t1 bmt1
+ Filter: ((c1 <> $5) AND (ctid = '(1,1)'::tid))
+ -> Bitmap Heap Scan on t3 bmt3
+ Recheck Cond: (c1 = bmt1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t3_pkey
+ Index Cond: (c1 = bmt1.c1)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> CTE Scan on c1
+ -> Index Scan using t2_pkey on t2 bmt2
+ Index Cond: (c1 = bmt1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+(74 rows)
+
+-- No. S-2-2-4
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = 1
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)'
+)
+;
+ QUERY PLAN
+-------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $2)
+ -> Result
+ InitPlan 2 (returns $1)
+ -> Limit
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 4 (returns $3)
+ -> Aggregate
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = c1.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Nested Loop
+ Join Filter: (bmt3.c1 = bmt1.c1)
+ -> Nested Loop
+ Join Filter: (bmt3.c1 = bmt4.c1)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 <> $3)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> CTE Scan on c1
+(46 rows)
+
+/*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4)
+TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey)
+BitmapScan(b2t1 t1_pkey)
+IndexScan(b3t1 t1_pkey)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = 1
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)'
+)
+;
+LOG: pg_hint_plan:
+used hint:
+TidScan(b1t1)
+SeqScan(b1t2)
+IndexScan(b1t3 t3_pkey)
+BitmapScan(b1t4 t4_pkey)
+BitmapScan(b2t1 t1_pkey)
+IndexScan(b3t1 t1_pkey)
+SeqScan(bmt1)
+IndexScan(bmt2 t2_pkey)
+BitmapScan(bmt3 t3_pkey)
+TidScan(bmt4)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t3_pkey on t3 b1t3
+ Index Cond: (c1 = b1t1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t4 b1t4
+ Recheck Cond: (c1 = b1t1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t4_pkey
+ Index Cond: (c1 = b1t1.c1)
+ InitPlan 3 (returns $3)
+ -> Result
+ InitPlan 2 (returns $2)
+ -> Limit
+ -> Bitmap Heap Scan on t1 b2t1
+ Recheck Cond: ((c1 IS NOT NULL) AND (c1 = 1))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 5 (returns $5)
+ -> Result
+ InitPlan 4 (returns $4)
+ -> Limit
+ -> Index Scan Backward using t1_pkey on t1 b3t1
+ Index Cond: (c1 IS NOT NULL)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = c1.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ -> Seq Scan on t1 bmt1
+ Filter: ((c1 <> $5) AND (ctid = '(1,1)'::tid))
+ -> Bitmap Heap Scan on t3 bmt3
+ Recheck Cond: (c1 = bmt1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t3_pkey
+ Index Cond: (c1 = bmt1.c1)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> CTE Scan on c1
+ -> Index Scan using t2_pkey on t2 bmt2
+ Index Cond: (c1 = bmt1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+(54 rows)
+
+----
+---- No. S-2-3 RULE definition table
+----
+-- No. S-2-3-1
+EXPLAIN (COSTS false) UPDATE s1.r1 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t2.c1 = t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(19 rows)
+
+/*+TidScan(t1)SeqScan(t2)IndexScan(t3 t3_pkey)BitmapScan(t4 t4_pkey)
+SeqScan(r1)*/
+EXPLAIN (COSTS false) UPDATE s1.r1 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+SeqScan(r1)
+TidScan(t1)
+SeqScan(t2)
+IndexScan(t3 t3_pkey)
+BitmapScan(t4 t4_pkey)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (t2.c1 = t1.c1)
+ -> Nested Loop
+ -> Nested Loop
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t3_pkey on t3
+ Index Cond: (c1 = t2.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on r1
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t4
+ Recheck Cond: (c1 = t1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t4_pkey
+ Index Cond: (c1 = t1.c1)
+(20 rows)
+
+EXPLAIN (COSTS false) UPDATE s1.r1_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r1_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(19 rows)
+
+/*+TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey)
+SeqScan(r1_)*/
+EXPLAIN (COSTS false) UPDATE s1.r1_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+TidScan(b1t1)
+SeqScan(b1t2)
+IndexScan(b1t3 t3_pkey)
+BitmapScan(b1t4 t4_pkey)
+SeqScan(r1_)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t1.c1)
+ -> Nested Loop
+ -> Nested Loop
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t3_pkey on t3 b1t3
+ Index Cond: (c1 = b1t2.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on r1_
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t4 b1t4
+ Recheck Cond: (c1 = b1t1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t4_pkey
+ Index Cond: (c1 = b1t1.c1)
+(20 rows)
+
+-- No. S-2-3-2
+EXPLAIN (COSTS false) UPDATE s1.r2 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t2.c1 = t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r2
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t2.c1 = t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r2
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(39 rows)
+
+/*+TidScan(t1)SeqScan(t2)IndexScan(t3 t3_pkey)BitmapScan(t4 t4_pkey)
+SeqScan(r2)*/
+EXPLAIN (COSTS false) UPDATE s1.r2 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+SeqScan(r2)
+TidScan(t1)
+SeqScan(t2)
+IndexScan(t3 t3_pkey)
+BitmapScan(t4 t4_pkey)
+not used hint:
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+SeqScan(r2)
+TidScan(t1)
+SeqScan(t2)
+IndexScan(t3 t3_pkey)
+BitmapScan(t4 t4_pkey)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (t2.c1 = t1.c1)
+ -> Nested Loop
+ -> Nested Loop
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t3_pkey on t3
+ Index Cond: (c1 = t2.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on r2
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t4
+ Recheck Cond: (c1 = t1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t4_pkey
+ Index Cond: (c1 = t1.c1)
+
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (t2.c1 = t1.c1)
+ -> Nested Loop
+ -> Nested Loop
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t3_pkey on t3
+ Index Cond: (c1 = t2.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on r2
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t4
+ Recheck Cond: (c1 = t1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t4_pkey
+ Index Cond: (c1 = t1.c1)
+(41 rows)
+
+EXPLAIN (COSTS false) UPDATE s1.r2_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r2_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t2.c1 = b2t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r2_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(39 rows)
+
+/*+TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey)
+BitmapScan(b2t1 t1_pkey)TidScan(b2t2)SeqScan(b2t3)IndexScan(b2t4 t4_pkey)
+SeqScan(r2_)*/
+EXPLAIN (COSTS false) UPDATE s1.r2_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+TidScan(b1t1)
+SeqScan(b1t2)
+IndexScan(b1t3 t3_pkey)
+BitmapScan(b1t4 t4_pkey)
+SeqScan(r2_)
+not used hint:
+BitmapScan(b2t1 t1_pkey)
+TidScan(b2t2)
+SeqScan(b2t3)
+IndexScan(b2t4 t4_pkey)
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(b2t1 t1_pkey)
+TidScan(b2t2)
+SeqScan(b2t3)
+IndexScan(b2t4 t4_pkey)
+SeqScan(r2_)
+not used hint:
+TidScan(b1t1)
+SeqScan(b1t2)
+IndexScan(b1t3 t3_pkey)
+BitmapScan(b1t4 t4_pkey)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t1.c1)
+ -> Nested Loop
+ -> Nested Loop
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t3_pkey on t3 b1t3
+ Index Cond: (c1 = b1t2.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on r2_
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t4 b1t4
+ Recheck Cond: (c1 = b1t1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t4_pkey
+ Index Cond: (c1 = b1t1.c1)
+
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (b2t2.c1 = b2t3.c1)
+ -> Tid Scan on t2 b2t2
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t3 b2t3
+ Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on r2_
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+ -> Bitmap Heap Scan on t1 b2t1
+ Recheck Cond: (c1 = b2t2.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: (c1 = b2t2.c1)
+ -> Index Scan using t4_pkey on t4 b2t4
+ Index Cond: (c1 = b2t1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+(41 rows)
+
+-- No. S-2-3-3
+EXPLAIN (COSTS false) UPDATE s1.r3 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t2.c1 = t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r3
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t2.c1 = t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r3
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t2.c1 = t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r3
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(59 rows)
+
+/*+TidScan(t1)SeqScan(t2)IndexScan(t3 t3_pkey)BitmapScan(t4 t4_pkey)
+SeqScan(r3)*/
+EXPLAIN (COSTS false) UPDATE s1.r3 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+SeqScan(r3)
+TidScan(t1)
+SeqScan(t2)
+IndexScan(t3 t3_pkey)
+BitmapScan(t4 t4_pkey)
+not used hint:
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+SeqScan(r3)
+TidScan(t1)
+SeqScan(t2)
+IndexScan(t3 t3_pkey)
+BitmapScan(t4 t4_pkey)
+not used hint:
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+SeqScan(r3)
+TidScan(t1)
+SeqScan(t2)
+IndexScan(t3 t3_pkey)
+BitmapScan(t4 t4_pkey)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (t2.c1 = t1.c1)
+ -> Nested Loop
+ -> Nested Loop
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t3_pkey on t3
+ Index Cond: (c1 = t2.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on r3
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t4
+ Recheck Cond: (c1 = t1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t4_pkey
+ Index Cond: (c1 = t1.c1)
+
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (t2.c1 = t1.c1)
+ -> Nested Loop
+ -> Nested Loop
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t3_pkey on t3
+ Index Cond: (c1 = t2.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on r3
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t4
+ Recheck Cond: (c1 = t1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t4_pkey
+ Index Cond: (c1 = t1.c1)
+
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (t2.c1 = t1.c1)
+ -> Nested Loop
+ -> Nested Loop
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t3_pkey on t3
+ Index Cond: (c1 = t2.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on r3
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t4
+ Recheck Cond: (c1 = t1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t4_pkey
+ Index Cond: (c1 = t1.c1)
+(62 rows)
+
+EXPLAIN (COSTS false) UPDATE s1.r3_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r3_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t2.c1 = b2t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r3_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t4.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t3.c1)
+ -> Nested Loop
+ Join Filter: (b3t2.c1 = b3t1.c1)
+ -> Nested Loop
+ -> Tid Scan on r3_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(59 rows)
+
+/*+TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey)
+BitmapScan(b2t1 t1_pkey)TidScan(b2t2)SeqScan(b2t3)IndexScan(b2t4 t4_pkey)
+IndexScan(b3t1 t1_pkey)BitmapScan(b3t2 t2_pkey)TidScan(b3t3)SeqScan(b3t4)
+SeqScan(r3_)*/
+EXPLAIN (COSTS false) UPDATE s1.r3_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+TidScan(b1t1)
+SeqScan(b1t2)
+IndexScan(b1t3 t3_pkey)
+BitmapScan(b1t4 t4_pkey)
+SeqScan(r3_)
+not used hint:
+BitmapScan(b2t1 t1_pkey)
+TidScan(b2t2)
+SeqScan(b2t3)
+IndexScan(b2t4 t4_pkey)
+IndexScan(b3t1 t1_pkey)
+BitmapScan(b3t2 t2_pkey)
+TidScan(b3t3)
+SeqScan(b3t4)
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(b2t1 t1_pkey)
+TidScan(b2t2)
+SeqScan(b2t3)
+IndexScan(b2t4 t4_pkey)
+SeqScan(r3_)
+not used hint:
+TidScan(b1t1)
+SeqScan(b1t2)
+IndexScan(b1t3 t3_pkey)
+BitmapScan(b1t4 t4_pkey)
+IndexScan(b3t1 t1_pkey)
+BitmapScan(b3t2 t2_pkey)
+TidScan(b3t3)
+SeqScan(b3t4)
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+IndexScan(b3t1 t1_pkey)
+BitmapScan(b3t2 t2_pkey)
+TidScan(b3t3)
+SeqScan(b3t4)
+SeqScan(r3_)
+not used hint:
+TidScan(b1t1)
+SeqScan(b1t2)
+IndexScan(b1t3 t3_pkey)
+BitmapScan(b1t4 t4_pkey)
+BitmapScan(b2t1 t1_pkey)
+TidScan(b2t2)
+SeqScan(b2t3)
+IndexScan(b2t4 t4_pkey)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t1.c1)
+ -> Nested Loop
+ -> Nested Loop
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t3_pkey on t3 b1t3
+ Index Cond: (c1 = b1t2.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on r3_
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t4 b1t4
+ Recheck Cond: (c1 = b1t1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t4_pkey
+ Index Cond: (c1 = b1t1.c1)
+
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (b2t2.c1 = b2t3.c1)
+ -> Tid Scan on t2 b2t2
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t3 b2t3
+ Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on r3_
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+ -> Bitmap Heap Scan on t1 b2t1
+ Recheck Cond: (c1 = b2t2.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: (c1 = b2t2.c1)
+ -> Index Scan using t4_pkey on t4 b2t4
+ Index Cond: (c1 = b2t1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t4.c1)
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t2 b3t2
+ Recheck Cond: (c1 = b3t3.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t2_pkey
+ Index Cond: (c1 = b3t3.c1)
+ -> Seq Scan on r3_
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+ -> Index Scan using t1_pkey on t1 b3t1
+ Index Cond: (c1 = b3t2.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t4 b3t4
+ Filter: (ctid = '(1,1)'::tid)
+(62 rows)
+
+----
+---- No. S-2-4 VALUES clause
+----
+-- No. S-2-4-1
+EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1')) AS t1 (c1) WHERE t1.c1 = 1;
+ QUERY PLAN
+---------------------------
+ Values Scan on "*VALUES*"
+ Filter: (column1 = 1)
+(2 rows)
+
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1')) AS t1 (c1) WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+SeqScan(t1)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------
+ Values Scan on "*VALUES*"
+ Filter: (column1 = 1)
+(2 rows)
+
+/*+SeqScan(*VALUES*)*/
+EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1')) AS t1 (c1) WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+SeqScan(*VALUES*)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------
+ Values Scan on "*VALUES*"
+ Filter: (column1 = 1)
+(2 rows)
+
+-- No. S-2-4-2
+EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1')) AS t1 (c1, c2, c3, c4), (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t2 (c1, c2) WHERE t1.c1 = t2.c1;
+ QUERY PLAN
+----------------------------------------------------------
+ Nested Loop
+ Join Filter: ("*VALUES*".column1 = "*VALUES*".column1)
+ -> Values Scan on "*VALUES*"
+ -> Values Scan on "*VALUES*"
+(4 rows)
+
+/*+SeqScan(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1')) AS t1 (c1, c2, c3, c4), (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t2 (c1, c2) WHERE t1.c1 = t2.c1;
+INFO: hint syntax error at or near "t2)"
+DETAIL: Closing parenthesis is necessary.
+ QUERY PLAN
+----------------------------------------------------------
+ Nested Loop
+ Join Filter: ("*VALUES*".column1 = "*VALUES*".column1)
+ -> Values Scan on "*VALUES*"
+ -> Values Scan on "*VALUES*"
+(4 rows)
+
+/*+SeqScan(*VALUES*)*/
+EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1')) AS t1 (c1, c2, c3, c4), (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t2 (c1, c2) WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+SeqScan(*VALUES*)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------------------
+ Nested Loop
+ Join Filter: ("*VALUES*".column1 = "*VALUES*".column1)
+ -> Values Scan on "*VALUES*"
+ -> Values Scan on "*VALUES*"
+(4 rows)
+
+----
+---- No. S-3-1 scan method hint
+----
+-- No. S-3-1-1
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 >= 1;
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c1 >= 1)
+(2 rows)
+
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 >= 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c1 >= 1)
+(2 rows)
+
+-- No. S-3-1-2
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. S-3-1-3
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+/*+IndexScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+IndexScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. S-3-1-4
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 >= 1;
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c1 >= 1)
+(2 rows)
+
+/*+IndexScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 >= 1;
+LOG: pg_hint_plan:
+used hint:
+IndexScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 >= 1)
+(2 rows)
+
+-- No. S-3-1-5
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c3 < 10;
+ QUERY PLAN
+---------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c3 < 10)
+ -> Bitmap Index Scan on t1_i
+ Index Cond: (c3 < 10)
+(4 rows)
+
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c3 < 10;
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c3 < 10)
+ -> Bitmap Index Scan on t1_i
+ Index Cond: (c3 < 10)
+(4 rows)
+
+-- No. S-3-1-6
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 = 1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 = 1)
+(4 rows)
+
+-- No. S-3-1-7
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(3 rows)
+
+/*+TidScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+TidScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(3 rows)
+
+-- No. S-3-1-8
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid IN ('(1,1)', '(2,2)', '(3,3)');
+ QUERY PLAN
+-------------------------------------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+ Filter: (ctid = ANY ('{"(1,1)","(2,2)","(3,3)"}'::tid[]))
+(3 rows)
+
+/*+TidScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid IN ('(1,1)', '(2,2)', '(3,3)');
+LOG: pg_hint_plan:
+used hint:
+TidScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------
+ Tid Scan on t1
+ TID Cond: (ctid = ANY ('{"(1,1)","(2,2)","(3,3)"}'::tid[]))
+ Filter: (c1 = 1)
+(3 rows)
+
+-- No. S-3-1-9
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 >= 1;
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c1 >= 1)
+(2 rows)
+
+/*+NoSeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 >= 1;
+LOG: pg_hint_plan:
+used hint:
+NoSeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 >= 1)
+(2 rows)
+
+-- No. S-3-1-10
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+/*+NoSeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+NoSeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. S-3-1-11
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+/*+NoIndexScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+NoIndexScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 = 1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 = 1)
+(4 rows)
+
+-- No. S-3-1-12
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 >= 1;
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c1 >= 1)
+(2 rows)
+
+/*+NoIndexScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 >= 1;
+LOG: pg_hint_plan:
+used hint:
+NoIndexScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c1 >= 1)
+(2 rows)
+
+-- No. S-3-1-13
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c3 < 10;
+ QUERY PLAN
+---------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c3 < 10)
+ -> Bitmap Index Scan on t1_i
+ Index Cond: (c3 < 10)
+(4 rows)
+
+/*+NoBitmapScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c3 < 10;
+LOG: pg_hint_plan:
+used hint:
+NoBitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c3 < 10)
+(2 rows)
+
+-- No. S-3-1-14
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+/*+NoBitmapScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+NoBitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. S-3-1-15
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(3 rows)
+
+/*+NoTidScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoTidScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+ Filter: (ctid = '(1,1)'::tid)
+(3 rows)
+
+-- No. S-3-1-16
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+/*+NoTidScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+NoTidScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. S-3-1-17
+EXPLAIN (COSTS false) SELECT c1 FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+/*+IndexOnlyScan(t1)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.t1 WHERE t1.c1 = 1;
+INFO: hint syntax error at or near "IndexOnlyScan(t1)"
+DETAIL: Unrecognized hint keyword "IndexOnlyScan".
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. S-3-1-18
+EXPLAIN (COSTS false) SELECT c1 FROM s1.t1 WHERE t1.c1 >= 1;
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c1 >= 1)
+(2 rows)
+
+/*+IndexOnlyScan(t1)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.t1 WHERE t1.c1 >= 1;
+INFO: hint syntax error at or near "IndexOnlyScan(t1)"
+DETAIL: Unrecognized hint keyword "IndexOnlyScan".
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c1 >= 1)
+(2 rows)
+
+-- No. S-3-1-19
+EXPLAIN (COSTS false) SELECT c1 FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+/*+NoIndexOnlyScan(t1)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.t1 WHERE t1.c1 = 1;
+INFO: hint syntax error at or near "NoIndexOnlyScan(t1)"
+DETAIL: Unrecognized hint keyword "NoIndexOnlyScan".
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. S-3-1-20
+EXPLAIN (COSTS false) SELECT c1 FROM s1.t1 WHERE t1.c1 >= 1;
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c1 >= 1)
+(2 rows)
+
+/*+NoIndexOnlyScan(t1)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.t1 WHERE t1.c1 >= 1;
+INFO: hint syntax error at or near "NoIndexOnlyScan(t1)"
+DETAIL: Unrecognized hint keyword "NoIndexOnlyScan".
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c1 >= 1)
+(2 rows)
+
+----
+---- No. S-3-3 index name specified
+----
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE ti1.c2 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on ti1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c2 = 1)
+(3 rows)
+
+SET enable_tidscan TO off;
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE ti1.c2 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+---------------------------------
+ Index Scan using ti1_i2 on ti1
+ Index Cond: (c2 = 1)
+ Filter: (ctid = '(1,1)'::tid)
+(3 rows)
+
+SET enable_indexscan TO off;
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE ti1.c2 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------
+ Bitmap Heap Scan on ti1
+ Recheck Cond: (c2 = 1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on ti1_i2
+ Index Cond: (c2 = 1)
+(5 rows)
+
+RESET enable_tidscan;
+RESET enable_indexscan;
+EXPLAIN (COSTS false) SELECT c2 FROM s1.ti1 WHERE ti1.c2 >= 1;
+ QUERY PLAN
+---------------------
+ Seq Scan on ti1
+ Filter: (c2 >= 1)
+(2 rows)
+
+-- No. S-3-3-1
+/*+IndexScan(ti1 ti1_i3)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE ti1.c2 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(ti1 ti1_i3)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------
+ Index Scan using ti1_i3 on ti1
+ Index Cond: (c2 = 1)
+ Filter: (ctid = '(1,1)'::tid)
+(3 rows)
+
+-- No. S-3-3-2
+/*+IndexScan(ti1 ti1_i3 ti1_i2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE ti1.c2 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(ti1 ti1_i3 ti1_i2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------
+ Index Scan using ti1_i2 on ti1
+ Index Cond: (c2 = 1)
+ Filter: (ctid = '(1,1)'::tid)
+(3 rows)
+
+-- No. S-3-3-3
+/*+IndexScan(ti1 ti1_i4 ti1_i3 ti1_i2 ti1_i1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE ti1.c2 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(ti1 ti1_i4 ti1_i3 ti1_i2 ti1_i1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------
+ Index Scan using ti1_i2 on ti1
+ Index Cond: (c2 = 1)
+ Filter: (ctid = '(1,1)'::tid)
+(3 rows)
+
+-- No. S-3-3-4
+/*+BitmapScan(ti1 ti1_i3)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE ti1.c2 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(ti1 ti1_i3)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------
+ Bitmap Heap Scan on ti1
+ Recheck Cond: (c2 = 1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on ti1_i3
+ Index Cond: (c2 = 1)
+(5 rows)
+
+-- No. S-3-3-5
+/*+BitmapScan(ti1 ti1_i3 ti1_i2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE ti1.c2 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(ti1 ti1_i3 ti1_i2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------
+ Bitmap Heap Scan on ti1
+ Recheck Cond: (c2 = 1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on ti1_i2
+ Index Cond: (c2 = 1)
+(5 rows)
+
+-- No. S-3-3-6
+/*+BitmapScan(ti1 ti1_i4 ti1_i3 ti1_i2 ti1_i1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE ti1.c2 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(ti1 ti1_i4 ti1_i3 ti1_i2 ti1_i1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------
+ Bitmap Heap Scan on ti1
+ Recheck Cond: (c2 = 1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on ti1_i2
+ Index Cond: (c2 = 1)
+(5 rows)
+
+-- No. S-3-3-7
+/*+IndexOnlyScan(ti1 ti1_i3)*/
+EXPLAIN (COSTS false) SELECT c2 FROM s1.ti1 WHERE ti1.c2 >= 1;
+INFO: hint syntax error at or near "IndexOnlyScan(ti1 ti1_i3)"
+DETAIL: Unrecognized hint keyword "IndexOnlyScan".
+ QUERY PLAN
+---------------------
+ Seq Scan on ti1
+ Filter: (c2 >= 1)
+(2 rows)
+
+-- No. S-3-3-8
+/*+IndexOnlyScan(ti1 ti1_i3 ti1_i2)*/
+EXPLAIN (COSTS false) SELECT c2 FROM s1.ti1 WHERE ti1.c2 >= 1;
+INFO: hint syntax error at or near "IndexOnlyScan(ti1 ti1_i3 ti1_i2)"
+DETAIL: Unrecognized hint keyword "IndexOnlyScan".
+ QUERY PLAN
+---------------------
+ Seq Scan on ti1
+ Filter: (c2 >= 1)
+(2 rows)
+
+-- No. S-3-3-9
+/*+IndexOnlyScan(ti1 ti1_i4 ti1_i3 ti1_i2 ti1_i1)*/
+EXPLAIN (COSTS false) SELECT c2 FROM s1.ti1 WHERE ti1.c2 >= 1;
+INFO: hint syntax error at or near "IndexOnlyScan(ti1 ti1_i4 ti1_i3 ti1_i2 ti1_i1)"
+DETAIL: Unrecognized hint keyword "IndexOnlyScan".
+ QUERY PLAN
+---------------------
+ Seq Scan on ti1
+ Filter: (c2 >= 1)
+(2 rows)
+
+----
+---- No. S-3-4 index type
+----
+\d s1.ti1
+ Table "s1.ti1"
+ Column | Type | Modifiers
+--------+---------+-----------
+ c1 | integer | not null
+ c2 | integer |
+ c3 | integer |
+ c4 | text |
+Indexes:
+ "ti1_pkey" PRIMARY KEY, btree (c1)
+ "ti1_c2_key" UNIQUE CONSTRAINT, btree (c2)
+ "ti1_uniq" UNIQUE, btree (c1)
+ "ti1_btree" btree (c1)
+ "ti1_expr" btree ((c1 < 100))
+ "ti1_gin" gin (c1)
+ "ti1_gist" gist (c1)
+ "ti1_hash" hash (c1)
+ "ti1_i1" btree (c2)
+ "ti1_i2" btree (c2, c4)
+ "ti1_i3" btree (c2, c4, c4)
+ "ti1_i4" btree (c2, c4, c4, c4)
+ "ti1_multi" btree (c1, c2, c3, c4)
+ "ti1_pred" btree (lower(c4))
+ "ti1_ts" gin (to_tsvector('english'::regconfig, c4))
+
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------------------------------------------------------------------------------
+ Tid Scan on ti1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 < 100) AND (c2 = 1) AND (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery) AND (lower(c4) = '1'::text))
+(3 rows)
+
+-- No. S-3-4-1
+/*+IndexScan(ti1 ti1_btree)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(ti1 ti1_btree)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------------------------------------------------------------------------------------------------------------
+ Index Scan using ti1_btree on ti1
+ Index Cond: (c1 < 100)
+ Filter: ((c2 = 1) AND (ctid = '(1,1)'::tid) AND (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery) AND (lower(c4) = '1'::text))
+(3 rows)
+
+-- No. S-3-4-2
+/*+IndexScan(ti1 ti1_hash)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(ti1 ti1_hash)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------------------------------------------------------------------------------------------------------------
+ Index Scan using ti1_hash on ti1
+ Index Cond: (c1 = 100)
+ Filter: ((c2 = 1) AND (ctid = '(1,1)'::tid) AND (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery) AND (lower(c4) = '1'::text))
+(3 rows)
+
+-- No. S-3-4-3
+/*+IndexScan(ti1 ti1_gist)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(ti1 ti1_gist)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------------------------------------------------------------------------------------------------------------
+ Index Scan using ti1_gist on ti1
+ Index Cond: (c1 < 100)
+ Filter: ((c2 = 1) AND (ctid = '(1,1)'::tid) AND (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery) AND (lower(c4) = '1'::text))
+(3 rows)
+
+-- No. S-3-4-4
+/*+IndexScan(ti1 ti1_gin)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(ti1 ti1_gin)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------------------------------------------------------------------
+ Tid Scan on ti1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 < 100) AND (c2 = 1) AND (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery) AND (lower(c4) = '1'::text))
+(3 rows)
+
+-- No. S-3-4-5
+/*+IndexScan(ti1 ti1_expr)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(ti1 ti1_expr)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------
+ Index Scan using ti1_expr on ti1
+ Index Cond: ((c1 < 100) = true)
+ Filter: ((c1 < 100) AND (c2 = 1) AND (ctid = '(1,1)'::tid) AND (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery) AND (lower(c4) = '1'::text))
+(3 rows)
+
+-- No. S-3-4-6
+/*+IndexScan(ti1 ti1_pred)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(ti1 ti1_pred)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------------------------------------------------------------------------------
+ Index Scan using ti1_pred on ti1
+ Index Cond: (lower(c4) = '1'::text)
+ Filter: ((c1 < 100) AND (c2 = 1) AND (ctid = '(1,1)'::tid) AND (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery))
+(3 rows)
+
+-- No. S-3-4-7
+/*+IndexScan(ti1 ti1_uniq)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(ti1 ti1_uniq)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------------------------------------------------------------------------------------------------------------
+ Index Scan using ti1_uniq on ti1
+ Index Cond: (c1 < 100)
+ Filter: ((c2 = 1) AND (ctid = '(1,1)'::tid) AND (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery) AND (lower(c4) = '1'::text))
+(3 rows)
+
+-- No. S-3-4-8
+/*+IndexScan(ti1 ti1_multi)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(ti1 ti1_multi)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------------------------------------------------------------------------------
+ Index Scan using ti1_multi on ti1
+ Index Cond: ((c1 < 100) AND (c2 = 1))
+ Filter: ((ctid = '(1,1)'::tid) AND (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery) AND (lower(c4) = '1'::text))
+(3 rows)
+
+-- No. S-3-4-9
+/*+IndexScan(ti1 ti1_ts)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(ti1 ti1_ts)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------------------------------------------------------------------
+ Tid Scan on ti1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 < 100) AND (c2 = 1) AND (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery) AND (lower(c4) = '1'::text))
+(3 rows)
+
+-- No. S-3-4-10
+/*+IndexScan(ti1 ti1_pkey)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(ti1 ti1_pkey)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------------------------------------------------------------------------------------------------------------
+ Index Scan using ti1_pkey on ti1
+ Index Cond: (c1 < 100)
+ Filter: ((c2 = 1) AND (ctid = '(1,1)'::tid) AND (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery) AND (lower(c4) = '1'::text))
+(3 rows)
+
+-- No. S-3-4-11
+/*+IndexScan(ti1 ti1_c2_key)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(ti1 ti1_c2_key)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------------------------------------------------------------------------------------------------------
+ Index Scan using ti1_c2_key on ti1
+ Index Cond: (c2 = 1)
+ Filter: ((c1 < 100) AND (ctid = '(1,1)'::tid) AND (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery) AND (lower(c4) = '1'::text))
+(3 rows)
+
+-- No. S-3-4-12
+/*+BitmapScan(ti1 ti1_btree)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(ti1 ti1_btree)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------------------------------------------------------------------------------------------------------------
+ Bitmap Heap Scan on ti1
+ Recheck Cond: (c1 < 100)
+ Filter: ((c2 = 1) AND (ctid = '(1,1)'::tid) AND (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery) AND (lower(c4) = '1'::text))
+ -> Bitmap Index Scan on ti1_btree
+ Index Cond: (c1 < 100)
+(5 rows)
+
+-- No. S-3-4-13
+/*+BitmapScan(ti1 ti1_hash)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(ti1 ti1_hash)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------------------------------------------------------------------------------------------------------------
+ Bitmap Heap Scan on ti1
+ Recheck Cond: (c1 = 100)
+ Filter: ((c2 = 1) AND (ctid = '(1,1)'::tid) AND (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery) AND (lower(c4) = '1'::text))
+ -> Bitmap Index Scan on ti1_hash
+ Index Cond: (c1 = 100)
+(5 rows)
+
+-- No. S-3-4-14
+/*+BitmapScan(ti1 ti1_gist)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(ti1 ti1_gist)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------------------------------------------------------------------------------------------------------------
+ Bitmap Heap Scan on ti1
+ Recheck Cond: (c1 < 100)
+ Filter: ((c2 = 1) AND (ctid = '(1,1)'::tid) AND (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery) AND (lower(c4) = '1'::text))
+ -> Bitmap Index Scan on ti1_gist
+ Index Cond: (c1 < 100)
+(5 rows)
+
+-- No. S-3-4-15
+/*+BitmapScan(ti1 ti1_gin)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(ti1 ti1_gin)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------------------------------------------------------------------------------------------------------------
+ Bitmap Heap Scan on ti1
+ Recheck Cond: (c1 < 100)
+ Filter: ((c2 = 1) AND (ctid = '(1,1)'::tid) AND (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery) AND (lower(c4) = '1'::text))
+ -> Bitmap Index Scan on ti1_gin
+ Index Cond: (c1 < 100)
+(5 rows)
+
+-- No. S-3-4-16
+/*+BitmapScan(ti1 ti1_expr)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(ti1 ti1_expr)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------
+ Bitmap Heap Scan on ti1
+ Filter: ((c1 < 100) AND (c2 = 1) AND (ctid = '(1,1)'::tid) AND (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery) AND (lower(c4) = '1'::text))
+ -> Bitmap Index Scan on ti1_expr
+ Index Cond: ((c1 < 100) = true)
+(4 rows)
+
+-- No. S-3-4-17
+/*+BitmapScan(ti1 ti1_pred)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(ti1 ti1_pred)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------------------------------------------------------------------------------
+ Bitmap Heap Scan on ti1
+ Recheck Cond: (lower(c4) = '1'::text)
+ Filter: ((c1 < 100) AND (c2 = 1) AND (ctid = '(1,1)'::tid) AND (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery))
+ -> Bitmap Index Scan on ti1_pred
+ Index Cond: (lower(c4) = '1'::text)
+(5 rows)
+
+-- No. S-3-4-18
+/*+BitmapScan(ti1 ti1_uniq)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(ti1 ti1_uniq)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------------------------------------------------------------------------------------------------------------
+ Bitmap Heap Scan on ti1
+ Recheck Cond: (c1 < 100)
+ Filter: ((c2 = 1) AND (ctid = '(1,1)'::tid) AND (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery) AND (lower(c4) = '1'::text))
+ -> Bitmap Index Scan on ti1_uniq
+ Index Cond: (c1 < 100)
+(5 rows)
+
+-- No. S-3-4-19
+/*+BitmapScan(ti1 ti1_multi)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(ti1 ti1_multi)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------------------------------------------------------------------------------
+ Bitmap Heap Scan on ti1
+ Recheck Cond: ((c1 < 100) AND (c2 = 1))
+ Filter: ((ctid = '(1,1)'::tid) AND (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery) AND (lower(c4) = '1'::text))
+ -> Bitmap Index Scan on ti1_multi
+ Index Cond: ((c1 < 100) AND (c2 = 1))
+(5 rows)
+
+-- No. S-3-4-20
+/*+BitmapScan(ti1 ti1_ts)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(ti1 ti1_ts)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------------------------------------------
+ Bitmap Heap Scan on ti1
+ Recheck Cond: (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery)
+ Filter: ((c1 < 100) AND (c2 = 1) AND (ctid = '(1,1)'::tid) AND (lower(c4) = '1'::text))
+ -> Bitmap Index Scan on ti1_ts
+ Index Cond: (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery)
+(5 rows)
+
+-- No. S-3-4-10
+/*+BitmapScan(ti1 ti1_pkey)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(ti1 ti1_pkey)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------------------------------------------------------------------------------------------------------------
+ Bitmap Heap Scan on ti1
+ Recheck Cond: (c1 < 100)
+ Filter: ((c2 = 1) AND (ctid = '(1,1)'::tid) AND (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery) AND (lower(c4) = '1'::text))
+ -> Bitmap Index Scan on ti1_pkey
+ Index Cond: (c1 < 100)
+(5 rows)
+
+-- No. S-3-4-11
+/*+BitmapScan(ti1 ti1_c2_key)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(ti1 ti1_c2_key)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------------------------------------------------------------------------------------------------------
+ Bitmap Heap Scan on ti1
+ Recheck Cond: (c2 = 1)
+ Filter: ((c1 < 100) AND (ctid = '(1,1)'::tid) AND (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery) AND (lower(c4) = '1'::text))
+ -> Bitmap Index Scan on ti1_c2_key
+ Index Cond: (c2 = 1)
+(5 rows)
+
+-- No. S-3-4-23
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 >= 1;
+ QUERY PLAN
+---------------------
+ Seq Scan on ti1
+ Filter: (c1 >= 1)
+(2 rows)
+
+/*+IndexOnlyScan(ti1 ti1_btree)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 >= 1;
+INFO: hint syntax error at or near "IndexOnlyScan(ti1 ti1_btree)"
+DETAIL: Unrecognized hint keyword "IndexOnlyScan".
+ QUERY PLAN
+---------------------
+ Seq Scan on ti1
+ Filter: (c1 >= 1)
+(2 rows)
+
+-- No. S-3-4-24
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 = 1;
+ QUERY PLAN
+----------------------------------
+ Index Scan using ti1_uniq on ti1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+/*+IndexOnlyScan(ti1 ti1_hash)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 = 1;
+INFO: hint syntax error at or near "IndexOnlyScan(ti1 ti1_hash)"
+DETAIL: Unrecognized hint keyword "IndexOnlyScan".
+ QUERY PLAN
+----------------------------------
+ Index Scan using ti1_uniq on ti1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. S-3-4-25
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 < 1;
+ QUERY PLAN
+----------------------------------
+ Index Scan using ti1_uniq on ti1
+ Index Cond: (c1 < 1)
+(2 rows)
+
+/*+IndexOnlyScan(ti1 ti1_gist)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 < 1;
+INFO: hint syntax error at or near "IndexOnlyScan(ti1 ti1_gist)"
+DETAIL: Unrecognized hint keyword "IndexOnlyScan".
+ QUERY PLAN
+----------------------------------
+ Index Scan using ti1_uniq on ti1
+ Index Cond: (c1 < 1)
+(2 rows)
+
+-- No. S-3-4-26
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 = 1;
+ QUERY PLAN
+----------------------------------
+ Index Scan using ti1_uniq on ti1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+/*+IndexOnlyScan(ti1 ti1_gin)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 = 1;
+INFO: hint syntax error at or near "IndexOnlyScan(ti1 ti1_gin)"
+DETAIL: Unrecognized hint keyword "IndexOnlyScan".
+ QUERY PLAN
+----------------------------------
+ Index Scan using ti1_uniq on ti1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. S-3-4-27
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 < 100;
+ QUERY PLAN
+----------------------------------
+ Index Scan using ti1_uniq on ti1
+ Index Cond: (c1 < 100)
+(2 rows)
+
+/*+IndexOnlyScan(ti1 ti1_expr)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 < 100;
+INFO: hint syntax error at or near "IndexOnlyScan(ti1 ti1_expr)"
+DETAIL: Unrecognized hint keyword "IndexOnlyScan".
+ QUERY PLAN
+----------------------------------
+ Index Scan using ti1_uniq on ti1
+ Index Cond: (c1 < 100)
+(2 rows)
+
+-- No. S-3-4-28
+EXPLAIN (COSTS false) SELECT c4 FROM s1.ti1 WHERE lower(c4) >= '1';
+ QUERY PLAN
+------------------------------------
+ Seq Scan on ti1
+ Filter: (lower(c4) >= '1'::text)
+(2 rows)
+
+/*+IndexOnlyScan(ti1 ti1_pred)*/
+EXPLAIN (COSTS false) SELECT c4 FROM s1.ti1 WHERE lower(c4) >= '1';
+INFO: hint syntax error at or near "IndexOnlyScan(ti1 ti1_pred)"
+DETAIL: Unrecognized hint keyword "IndexOnlyScan".
+ QUERY PLAN
+------------------------------------
+ Seq Scan on ti1
+ Filter: (lower(c4) >= '1'::text)
+(2 rows)
+
+-- No. S-3-4-29
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 >= 1;
+ QUERY PLAN
+---------------------
+ Seq Scan on ti1
+ Filter: (c1 >= 1)
+(2 rows)
+
+/*+IndexOnlyScan(ti1 ti1_uniq)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 >= 1;
+INFO: hint syntax error at or near "IndexOnlyScan(ti1 ti1_uniq)"
+DETAIL: Unrecognized hint keyword "IndexOnlyScan".
+ QUERY PLAN
+---------------------
+ Seq Scan on ti1
+ Filter: (c1 >= 1)
+(2 rows)
+
+-- No. S-3-4-30
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 >= 1;
+ QUERY PLAN
+---------------------
+ Seq Scan on ti1
+ Filter: (c1 >= 1)
+(2 rows)
+
+/*+IndexOnlyScan(ti1 ti1_multi)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 >= 1;
+INFO: hint syntax error at or near "IndexOnlyScan(ti1 ti1_multi)"
+DETAIL: Unrecognized hint keyword "IndexOnlyScan".
+ QUERY PLAN
+---------------------
+ Seq Scan on ti1
+ Filter: (c1 >= 1)
+(2 rows)
+
+-- No. S-3-4-31
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE to_tsvector('english', c4) @@ 'a & b';
+ QUERY PLAN
+-----------------------------------------------------------------------------------------
+ Bitmap Heap Scan on ti1
+ Recheck Cond: (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery)
+ -> Bitmap Index Scan on ti1_ts
+ Index Cond: (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery)
+(4 rows)
+
+/*+IndexOnlyScan(ti1 ti1_ts)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE to_tsvector('english', c4) @@ 'a & b';
+INFO: hint syntax error at or near "IndexOnlyScan(ti1 ti1_ts)"
+DETAIL: Unrecognized hint keyword "IndexOnlyScan".
+ QUERY PLAN
+-----------------------------------------------------------------------------------------
+ Bitmap Heap Scan on ti1
+ Recheck Cond: (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery)
+ -> Bitmap Index Scan on ti1_ts
+ Index Cond: (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery)
+(4 rows)
+
+-- No. S-3-4-32
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 >= 1;
+ QUERY PLAN
+---------------------
+ Seq Scan on ti1
+ Filter: (c1 >= 1)
+(2 rows)
+
+/*+IndexOnlyScan(ti1 ti1_pkey)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 >= 1;
+INFO: hint syntax error at or near "IndexOnlyScan(ti1 ti1_pkey)"
+DETAIL: Unrecognized hint keyword "IndexOnlyScan".
+ QUERY PLAN
+---------------------
+ Seq Scan on ti1
+ Filter: (c1 >= 1)
+(2 rows)
+
+-- No. S-3-4-33
+EXPLAIN (COSTS false) SELECT c2 FROM s1.ti1 WHERE c2 >= 1;
+ QUERY PLAN
+---------------------
+ Seq Scan on ti1
+ Filter: (c2 >= 1)
+(2 rows)
+
+/*+IndexOnlyScan(ti1 ti1_c2_key)*/
+EXPLAIN (COSTS false) SELECT c2 FROM s1.ti1 WHERE c2 >= 1;
+INFO: hint syntax error at or near "IndexOnlyScan(ti1 ti1_c2_key)"
+DETAIL: Unrecognized hint keyword "IndexOnlyScan".
+ QUERY PLAN
+---------------------
+ Seq Scan on ti1
+ Filter: (c2 >= 1)
+(2 rows)
+
+----
+---- No. S-3-5 not used index
+----
+-- No. S-3-5-1
+/*+IndexScan(ti1 ti1_pred)*/
+EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100;
+LOG: pg_hint_plan:
+used hint:
+IndexScan(ti1 ti1_pred)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------------------------
+ Seq Scan on ti1 (cost=10000000000.00..10000000018.50 rows=1 width=15)
+ Filter: (c1 = 100)
+(2 rows)
+
+-- No. S-3-5-2
+/*+BitmapScan(ti1 ti1_pred)*/
+EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100;
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(ti1 ti1_pred)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------------------------
+ Seq Scan on ti1 (cost=10000000000.00..10000000018.50 rows=1 width=15)
+ Filter: (c1 = 100)
+(2 rows)
+
+-- No. S-3-5-3
+/*+IndexOnlyScan(ti1 ti1_pred)*/
+EXPLAIN (COSTS true) SELECT c1 FROM s1.ti1 WHERE c1 = 100;
+INFO: hint syntax error at or near "IndexOnlyScan(ti1 ti1_pred)"
+DETAIL: Unrecognized hint keyword "IndexOnlyScan".
+ QUERY PLAN
+--------------------------------------------------------------------
+ Index Scan using ti1_uniq on ti1 (cost=0.00..8.27 rows=1 width=4)
+ Index Cond: (c1 = 100)
+(2 rows)
+
+----
+---- No. S-3-6 not exist index
+----
+-- No. S-3-6-1
+/*+IndexScan(ti1 not_exist)*/
+EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100;
+LOG: pg_hint_plan:
+used hint:
+IndexScan(ti1 not_exist)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------------------------
+ Seq Scan on ti1 (cost=10000000000.00..10000000018.50 rows=1 width=15)
+ Filter: (c1 = 100)
+(2 rows)
+
+-- No. S-3-6-2
+/*+BitmapScan(ti1 not_exist)*/
+EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100;
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(ti1 not_exist)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------------------------
+ Seq Scan on ti1 (cost=10000000000.00..10000000018.50 rows=1 width=15)
+ Filter: (c1 = 100)
+(2 rows)
+
+-- No. S-3-6-3
+/*+IndexOnlyScan(ti1 not_exist)*/
+EXPLAIN (COSTS true) SELECT c1 FROM s1.ti1 WHERE c1 = 100;
+INFO: hint syntax error at or near "IndexOnlyScan(ti1 not_exist)"
+DETAIL: Unrecognized hint keyword "IndexOnlyScan".
+ QUERY PLAN
+--------------------------------------------------------------------
+ Index Scan using ti1_uniq on ti1 (cost=0.00..8.27 rows=1 width=4)
+ Index Cond: (c1 = 100)
+(2 rows)
+
+----
+---- No. S-3-7 query structure
+----
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1 AND t1.ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------
+ Hash Join
+ Hash Cond: (t2.c1 = t1.c1)
+ -> Seq Scan on t2
+ -> Hash
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+-- No. S-3-7-1
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE c1 = 100;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------
+ Seq Scan on t1
+ Filter: (c1 = 100)
+(2 rows)
+
+-- No. S-3-7-2
+/*+SeqScan(t1)BitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1 AND t1.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+BitmapScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------
+ Nested Loop
+ -> Seq Scan on t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t2
+ Recheck Cond: (c1 = t1.c1)
+ -> Bitmap Index Scan on t2_i1
+ Index Cond: (c1 = t1.c1)
+(7 rows)
+
+-- No. S-3-7-3
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1 AND t1.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------
+ Hash Join
+ Hash Cond: (t2.c1 = t1.c1)
+ -> Seq Scan on t2
+ -> Hash
+ -> Seq Scan on t1
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+----
+---- No. S-3-8 query structure
+----
+-- No. S-3-8-1
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1 WHERE b1t1.c1 = 1)
+SELECT max(b3t1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.c1 = 1
+ ) FROM s1.t1 b3t1 WHERE b3t1.c1 = (
+SELECT max(b4t1.c1) FROM s1.t1 b4t1 WHERE b4t1.c1 = 1);
+ QUERY PLAN
+---------------------------------------------------------------------
+ Result
+ InitPlan 2 (returns $1)
+ -> Result
+ InitPlan 1 (returns $0)
+ -> Limit
+ -> Index Scan using t1_i1 on t1 b2t1
+ Index Cond: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 4 (returns $3)
+ -> Result
+ InitPlan 3 (returns $2)
+ -> Limit
+ -> Index Scan using t1_i1 on t1 b4t1
+ Index Cond: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 5 (returns $4)
+ -> Limit
+ -> Index Scan using t1_i1 on t1 b3t1
+ Index Cond: ((c1 IS NOT NULL) AND (c1 = $3))
+(17 rows)
+
+/*+SeqScan(b1t1)IndexScan(b2t1 t1_pkey)BitmapScan(b3t1 t1_pkey)TidScan(b4t1)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1 WHERE b1t1.c1 = 1)
+SELECT max(b3t1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.c1 = 1
+ ) FROM s1.t1 b3t1 WHERE b3t1.c1 = (
+SELECT max(b4t1.c1) FROM s1.t1 b4t1 WHERE b4t1.c1 = 1);
+LOG: pg_hint_plan:
+used hint:
+IndexScan(b2t1 t1_pkey)
+BitmapScan(b3t1 t1_pkey)
+TidScan(b4t1)
+not used hint:
+SeqScan(b1t1)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------------
+ Result
+ InitPlan 2 (returns $1)
+ -> Result
+ InitPlan 1 (returns $0)
+ -> Limit
+ -> Index Scan using t1_pkey on t1 b2t1
+ Index Cond: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 4 (returns $3)
+ -> Result
+ InitPlan 3 (returns $2)
+ -> Limit
+ -> Seq Scan on t1 b4t1
+ Filter: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 5 (returns $4)
+ -> Limit
+ -> Bitmap Heap Scan on t1 b3t1
+ Recheck Cond: ((c1 IS NOT NULL) AND (c1 = $3))
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: ((c1 IS NOT NULL) AND (c1 = $3))
+(19 rows)
+
+-- No. S-3-8-2
+EXPLAIN (COSTS false)
+WITH cte1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1 JOIN s1.t2 b1t2 ON(b1t1.c1 = b1t2.c1) WHERE b1t1.c1 = 1)
+SELECT max(b3t1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 JOIN s1.t2 b2t2 ON(b2t1.c1 = b2t2.c1) WHERE b2t1.c1 = 1
+ ) FROM s1.t1 b3t1 JOIN s1.t2 b3t2 ON(b3t1.c1 = b3t2.c1) JOIN cte1 ON(b3t1.c1 = cte1.c1) WHERE b3t1.c1 = (
+SELECT max(b4t1.c1) FROM s1.t1 b4t1 JOIN s1.t2 b4t2 ON(b4t1.c1 = b4t2.c1) WHERE b4t1.c1 = 1);
+ QUERY PLAN
+-------------------------------------------------------
+ Aggregate
+ CTE cte1
+ -> Aggregate
+ -> Nested Loop
+ -> Index Scan using t1_i1 on t1 b1t1
+ Index Cond: (c1 = 1)
+ -> Seq Scan on t2 b1t2
+ Filter: (c1 = 1)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ -> Index Scan using t1_i1 on t1 b2t1
+ Index Cond: (c1 = 1)
+ -> Seq Scan on t2 b2t2
+ Filter: (c1 = 1)
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Nested Loop
+ -> Index Scan using t1_i1 on t1 b4t1
+ Index Cond: (c1 = 1)
+ -> Seq Scan on t2 b4t2
+ Filter: (c1 = 1)
+ -> Nested Loop
+ -> Nested Loop
+ -> Index Scan using t1_i1 on t1 b3t1
+ Index Cond: (c1 = $2)
+ -> Seq Scan on t2 b3t2
+ Filter: (c1 = $2)
+ -> CTE Scan on cte1
+ Filter: (c1 = $2)
+(30 rows)
+
+/*+SeqScan(b1t1)IndexScan(b2t1 t1_pkey)BitmapScan(b3t1 t1_pkey)TidScan(b4t1)
+TidScan(b1t2)SeqScan(b2t2)IndexScan(b3t2 t2_pkey)BitmapScan(b4t2 t2_pkey)
+*/
+EXPLAIN (COSTS false)
+WITH cte1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1 JOIN s1.t2 b1t2 ON(b1t1.c1 = b1t2.c1) WHERE b1t1.c1 = 1)
+SELECT max(b3t1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 JOIN s1.t2 b2t2 ON(b2t1.c1 = b2t2.c1) WHERE b2t1.c1 = 1
+ ) FROM s1.t1 b3t1 JOIN s1.t2 b3t2 ON(b3t1.c1 = b3t2.c1) JOIN cte1 ON(b3t1.c1 = cte1.c1) WHERE b3t1.c1 = (
+SELECT max(b4t1.c1) FROM s1.t1 b4t1 JOIN s1.t2 b4t2 ON(b4t1.c1 = b4t2.c1) WHERE b4t1.c1 = 1);
+LOG: pg_hint_plan:
+used hint:
+SeqScan(b1t1)
+TidScan(b1t2)
+IndexScan(b2t1 t1_pkey)
+SeqScan(b2t2)
+BitmapScan(b3t1 t1_pkey)
+IndexScan(b3t2 t2_pkey)
+TidScan(b4t1)
+BitmapScan(b4t2 t2_pkey)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------
+ Aggregate
+ CTE cte1
+ -> Aggregate
+ -> Nested Loop
+ -> Seq Scan on t1 b1t1
+ Filter: (c1 = 1)
+ -> Seq Scan on t2 b1t2
+ Filter: (c1 = 1)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ -> Index Scan using t1_pkey on t1 b2t1
+ Index Cond: (c1 = 1)
+ -> Seq Scan on t2 b2t2
+ Filter: (c1 = 1)
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Nested Loop
+ -> Seq Scan on t1 b4t1
+ Filter: (c1 = 1)
+ -> Bitmap Heap Scan on t2 b4t2
+ Recheck Cond: (c1 = 1)
+ -> Bitmap Index Scan on t2_pkey
+ Index Cond: (c1 = 1)
+ -> Nested Loop
+ -> Nested Loop
+ -> Bitmap Heap Scan on t1 b3t1
+ Recheck Cond: (c1 = $2)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: (c1 = $2)
+ -> CTE Scan on cte1
+ Filter: (c1 = $2)
+ -> Index Scan using t2_pkey on t2 b3t2
+ Index Cond: (c1 = $2)
+(34 rows)
+
+-- No. S-3-8-3
+EXPLAIN (COSTS false)
+WITH cte1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1 JOIN s1.t2 b1t2 ON(b1t1.c1 = b1t2.c1) WHERE b1t1.c1 = 1)
+SELECT max(b3t1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.c1 = 1
+ ) FROM s1.t1 b3t1 JOIN s1.t2 b3t2 ON(b3t1.c1 = b3t2.c1) JOIN cte1 ON(b3t1.c1 = cte1.c1) WHERE b3t1.c1 = (
+SELECT max(b4t1.c1) FROM s1.t1 b4t1 WHERE b4t1.c1 = 1);
+ QUERY PLAN
+---------------------------------------------------------------------
+ Aggregate
+ CTE cte1
+ -> Aggregate
+ -> Nested Loop
+ -> Index Scan using t1_i1 on t1 b1t1
+ Index Cond: (c1 = 1)
+ -> Seq Scan on t2 b1t2
+ Filter: (c1 = 1)
+ InitPlan 3 (returns $2)
+ -> Result
+ InitPlan 2 (returns $1)
+ -> Limit
+ -> Index Scan using t1_i1 on t1 b2t1
+ Index Cond: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 5 (returns $4)
+ -> Result
+ InitPlan 4 (returns $3)
+ -> Limit
+ -> Index Scan using t1_i1 on t1 b4t1
+ Index Cond: ((c1 IS NOT NULL) AND (c1 = 1))
+ -> Nested Loop
+ -> Nested Loop
+ -> Index Scan using t1_i1 on t1 b3t1
+ Index Cond: (c1 = $4)
+ -> Seq Scan on t2 b3t2
+ Filter: (c1 = $4)
+ -> CTE Scan on cte1
+ Filter: (c1 = $4)
+(28 rows)
+
+/*+SeqScan(b1t1)IndexScan(b2t1 t1_pkey)BitmapScan(b3t1 t1_pkey)TidScan(b4t1)
+TidScan(b1t2)IndexScan(b3t2 t2_pkey)
+*/
+EXPLAIN (COSTS false)
+WITH cte1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1 JOIN s1.t2 b1t2 ON(b1t1.c1 = b1t2.c1) WHERE b1t1.c1 = 1)
+SELECT max(b3t1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.c1 = 1
+ ) FROM s1.t1 b3t1 JOIN s1.t2 b3t2 ON(b3t1.c1 = b3t2.c1) JOIN cte1 ON(b3t1.c1 = cte1.c1) WHERE b3t1.c1 = (
+SELECT max(b4t1.c1) FROM s1.t1 b4t1 WHERE b4t1.c1 = 1);
+LOG: pg_hint_plan:
+used hint:
+SeqScan(b1t1)
+TidScan(b1t2)
+IndexScan(b2t1 t1_pkey)
+BitmapScan(b3t1 t1_pkey)
+IndexScan(b3t2 t2_pkey)
+TidScan(b4t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------------
+ Aggregate
+ CTE cte1
+ -> Aggregate
+ -> Nested Loop
+ -> Seq Scan on t1 b1t1
+ Filter: (c1 = 1)
+ -> Seq Scan on t2 b1t2
+ Filter: (c1 = 1)
+ InitPlan 3 (returns $2)
+ -> Result
+ InitPlan 2 (returns $1)
+ -> Limit
+ -> Index Scan using t1_pkey on t1 b2t1
+ Index Cond: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 5 (returns $4)
+ -> Result
+ InitPlan 4 (returns $3)
+ -> Limit
+ -> Seq Scan on t1 b4t1
+ Filter: ((c1 IS NOT NULL) AND (c1 = 1))
+ -> Nested Loop
+ -> Nested Loop
+ -> Bitmap Heap Scan on t1 b3t1
+ Recheck Cond: (c1 = $4)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: (c1 = $4)
+ -> CTE Scan on cte1
+ Filter: (c1 = $4)
+ -> Index Scan using t2_pkey on t2 b3t2
+ Index Cond: (c1 = $4)
+(30 rows)
+
+----
+---- No. S-3-9 inheritance table select type
+----
+-- No. S-3-9-1
+EXPLAIN (COSTS false) SELECT * FROM ONLY s1.p1 WHERE c1 = 1;
+ QUERY PLAN
+--------------------
+ Seq Scan on p1
+ Filter: (c1 = 1)
+(2 rows)
+
+/*+IndexScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY s1.p1 WHERE c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+IndexScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------
+ Index Scan using p1_i on p1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. S-3-9-2
+EXPLAIN (COSTS false) SELECT * FROM s1.p1 WHERE c1 = 1;
+ QUERY PLAN
+---------------------------------
+ Result
+ -> Append
+ -> Seq Scan on p1
+ Filter: (c1 = 1)
+ -> Seq Scan on p1c1 p1
+ Filter: (c1 = 1)
+(6 rows)
+
+/*+IndexScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.p1 WHERE c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+IndexScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------
+ Result
+ -> Append
+ -> Index Scan using p1_i on p1
+ Index Cond: (c1 = 1)
+ -> Index Scan using p1c1_i on p1c1 p1
+ Index Cond: (c1 = 1)
+(6 rows)
+
+----
+---- No. S-3-10 inheritance table number
+----
+-- No. S-3-10-1
+EXPLAIN (COSTS false) SELECT * FROM s1.p1 WHERE c1 = 1;
+ QUERY PLAN
+---------------------------------
+ Result
+ -> Append
+ -> Seq Scan on p1
+ Filter: (c1 = 1)
+ -> Seq Scan on p1c1 p1
+ Filter: (c1 = 1)
+(6 rows)
+
+/*+IndexScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.p1 WHERE c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+IndexScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------
+ Result
+ -> Append
+ -> Index Scan using p1_i on p1
+ Index Cond: (c1 = 1)
+ -> Index Scan using p1c1_i on p1c1 p1
+ Index Cond: (c1 = 1)
+(6 rows)
+
+-- No. S-3-10-2
+EXPLAIN (COSTS false) SELECT * FROM s1.p2 WHERE c1 = 1;
+ QUERY PLAN
+-----------------------------------
+ Result
+ -> Append
+ -> Seq Scan on p2
+ Filter: (c1 = 1)
+ -> Seq Scan on p2c1 p2
+ Filter: (c1 = 1)
+ -> Seq Scan on p2c1c1 p2
+ Filter: (c1 = 1)
+(8 rows)
+
+/*+IndexScan(p2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.p2 WHERE c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+IndexScan(p2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------------
+ Result
+ -> Append
+ -> Index Scan using p2_i on p2
+ Index Cond: (c1 = 1)
+ -> Index Scan using p2c1_i on p2c1 p2
+ Index Cond: (c1 = 1)
+ -> Index Scan using p2c1c1_i on p2c1c1 p2
+ Index Cond: (c1 = 1)
+(8 rows)
+
+----
+---- No. S-3-11 inheritance table specified table
+----
+EXPLAIN (COSTS false) SELECT * FROM s1.p2 WHERE c1 = 1;
+ QUERY PLAN
+-----------------------------------
+ Result
+ -> Append
+ -> Seq Scan on p2
+ Filter: (c1 = 1)
+ -> Seq Scan on p2c1 p2
+ Filter: (c1 = 1)
+ -> Seq Scan on p2c1c1 p2
+ Filter: (c1 = 1)
+(8 rows)
+
+-- No. S-3-11-1
+/*+IndexScan(p2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.p2 WHERE c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+IndexScan(p2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------------
+ Result
+ -> Append
+ -> Index Scan using p2_i on p2
+ Index Cond: (c1 = 1)
+ -> Index Scan using p2c1_i on p2c1 p2
+ Index Cond: (c1 = 1)
+ -> Index Scan using p2c1c1_i on p2c1c1 p2
+ Index Cond: (c1 = 1)
+(8 rows)
+
+-- No. S-3-11-2
+/*+IndexScan(p2c1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.p2 WHERE c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+IndexScan(p2c1)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------
+ Result
+ -> Append
+ -> Seq Scan on p2
+ Filter: (c1 = 1)
+ -> Seq Scan on p2c1 p2
+ Filter: (c1 = 1)
+ -> Seq Scan on p2c1c1 p2
+ Filter: (c1 = 1)
+(8 rows)
+
+-- No. S-3-11-3
+/*+IndexScan(p2 p2_pkey p2c1_pkey p2c1c1_pkey)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.p2 WHERE c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+IndexScan(p2 p2_pkey p2c1_pkey p2c1c1_pkey)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------
+ Result
+ -> Append
+ -> Index Scan using p2_pkey on p2
+ Index Cond: (c1 = 1)
+ -> Index Scan using p2c1_pkey on p2c1 p2
+ Index Cond: (c1 = 1)
+ -> Index Scan using p2c1c1_pkey on p2c1c1 p2
+ Index Cond: (c1 = 1)
+(8 rows)
+
+-- No. S-3-11-4
+/*+IndexScan(p2 p2c1_pkey)*/
+EXPLAIN (COSTS true) SELECT * FROM s1.p2 WHERE c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+IndexScan(p2 p2c1_pkey)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------------------------------------------
+ Result (cost=10000000000.00..20000000009.89 rows=3 width=34)
+ -> Append (cost=10000000000.00..20000000009.89 rows=3 width=34)
+ -> Seq Scan on p2 (cost=10000000000.00..10000000000.00 rows=1 width=44)
+ Filter: (c1 = 1)
+ -> Index Scan using p2c1_pkey on p2c1 p2 (cost=0.00..8.27 rows=1 width=44)
+ Index Cond: (c1 = 1)
+ -> Seq Scan on p2c1c1 p2 (cost=10000000000.00..10000000001.62 rows=1 width=14)
+ Filter: (c1 = 1)
+(8 rows)
+
+----
+---- No. S-3-12 specified same table
+----
+-- No. S-3-12-1
+/*+IndexScan(ti1) BitmapScan(ti1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+INFO: hint syntax error at or near "IndexScan(ti1) BitmapScan(ti1)"
+DETAIL: Conflict scan method hint.
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(ti1)
+not used hint:
+duplication hint:
+IndexScan(ti1)
+error hint:
+
+ QUERY PLAN
+-------------------------------------
+ Bitmap Heap Scan on ti1
+ Recheck Cond: (c1 = 1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on ti1_uniq
+ Index Cond: (c1 = 1)
+(5 rows)
+
+-- No. S-3-12-2
+/*+IndexScan(ti1 ti1_pkey) BitmapScan(ti1 ti1_btree)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+INFO: hint syntax error at or near "IndexScan(ti1 ti1_pkey) BitmapScan(ti1 ti1_btree)"
+DETAIL: Conflict scan method hint.
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(ti1 ti1_btree)
+not used hint:
+duplication hint:
+IndexScan(ti1 ti1_pkey)
+error hint:
+
+ QUERY PLAN
+--------------------------------------
+ Bitmap Heap Scan on ti1
+ Recheck Cond: (c1 = 1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on ti1_btree
+ Index Cond: (c1 = 1)
+(5 rows)
+
+-- No. S-3-12-3
+/*+BitmapScan(ti1) IndexScan(ti1) BitmapScan(ti1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+INFO: hint syntax error at or near "BitmapScan(ti1) IndexScan(ti1) BitmapScan(ti1)"
+DETAIL: Conflict scan method hint.
+INFO: hint syntax error at or near "IndexScan(ti1) BitmapScan(ti1)"
+DETAIL: Conflict scan method hint.
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(ti1)
+not used hint:
+duplication hint:
+BitmapScan(ti1)
+IndexScan(ti1)
+error hint:
+
+ QUERY PLAN
+-------------------------------------
+ Bitmap Heap Scan on ti1
+ Recheck Cond: (c1 = 1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on ti1_uniq
+ Index Cond: (c1 = 1)
+(5 rows)
+
+-- No. S-3-12-4
+/*+BitmapScan(ti1 ti1_hash) IndexScan(ti1 ti1_pkey) BitmapScan(ti1 ti1_btree)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+INFO: hint syntax error at or near "BitmapScan(ti1 ti1_hash) IndexScan(ti1 ti1_pkey) BitmapScan(ti1 ti1_btree)"
+DETAIL: Conflict scan method hint.
+INFO: hint syntax error at or near "IndexScan(ti1 ti1_pkey) BitmapScan(ti1 ti1_btree)"
+DETAIL: Conflict scan method hint.
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(ti1 ti1_btree)
+not used hint:
+duplication hint:
+BitmapScan(ti1 ti1_hash)
+IndexScan(ti1 ti1_pkey)
+error hint:
+
+ QUERY PLAN
+--------------------------------------
+ Bitmap Heap Scan on ti1
+ Recheck Cond: (c1 = 1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on ti1_btree
+ Index Cond: (c1 = 1)
+(5 rows)
+
+----
+---- No. S-3-13 message output
+----
+-- No. S-3-13-1
+/*+SeqScan(ti1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+SeqScan(ti1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------
+ Seq Scan on ti1
+ Filter: ((c1 = 1) AND (ctid = '(1,1)'::tid))
+(2 rows)
+
+-- No. S-3-13-2
+/*+SeqScan(ti1 ti1_pkey)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+INFO: hint syntax error at or near "ti1_pkey)"
+DETAIL: Closing parenthesis is necessary.
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on ti1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(3 rows)
+
+-- No. S-3-13-3
+/*+SeqScan(ti1 ti1_pkey ti1_btree)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+INFO: hint syntax error at or near "ti1_pkey ti1_btree)"
+DETAIL: Closing parenthesis is necessary.
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on ti1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(3 rows)
+
+-- No. S-3-13-4
+/*+IndexScan(ti1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(ti1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Index Scan using ti1_uniq on ti1
+ Index Cond: (c1 = 1)
+ Filter: (ctid = '(1,1)'::tid)
+(3 rows)
+
+-- No. S-3-13-5
+/*+IndexScan(ti1 ti1_pkey)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(ti1 ti1_pkey)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Index Scan using ti1_pkey on ti1
+ Index Cond: (c1 = 1)
+ Filter: (ctid = '(1,1)'::tid)
+(3 rows)
+
+-- No. S-3-13-6
+/*+IndexScan(ti1 ti1_pkey ti1_btree)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(ti1 ti1_pkey ti1_btree)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------
+ Index Scan using ti1_btree on ti1
+ Index Cond: (c1 = 1)
+ Filter: (ctid = '(1,1)'::tid)
+(3 rows)
+
+-- No. S-3-13-7
+/*+BitmapScan(ti1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(ti1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------
+ Bitmap Heap Scan on ti1
+ Recheck Cond: (c1 = 1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on ti1_uniq
+ Index Cond: (c1 = 1)
+(5 rows)
+
+-- No. S-3-13-8
+/*+BitmapScan(ti1 ti1_pkey)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(ti1 ti1_pkey)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------
+ Bitmap Heap Scan on ti1
+ Recheck Cond: (c1 = 1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on ti1_pkey
+ Index Cond: (c1 = 1)
+(5 rows)
+
+-- No. S-3-13-9
+/*+BitmapScan(ti1 ti1_pkey ti1_btree)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(ti1 ti1_pkey ti1_btree)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------
+ Bitmap Heap Scan on ti1
+ Recheck Cond: (c1 = 1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on ti1_btree
+ Index Cond: (c1 = 1)
+(5 rows)
+
+-- No. S-3-13-10
+/*+TidScan(ti1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+TidScan(ti1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on ti1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(3 rows)
+
+-- No. S-3-13-11
+/*+TidScan(ti1 ti1_pkey)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+INFO: hint syntax error at or near "ti1_pkey)"
+DETAIL: Closing parenthesis is necessary.
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on ti1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(3 rows)
+
+-- No. S-3-13-12
+/*+TidScan(ti1 ti1_pkey ti1_btree)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+INFO: hint syntax error at or near "ti1_pkey ti1_btree)"
+DETAIL: Closing parenthesis is necessary.
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on ti1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(3 rows)
+
+-- No. S-3-13-13
+/*+NoSeqScan(ti1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoSeqScan(ti1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on ti1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(3 rows)
+
+-- No. S-3-13-14
+/*+NoSeqScan(ti1 ti1_pkey)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+INFO: hint syntax error at or near "ti1_pkey)"
+DETAIL: Closing parenthesis is necessary.
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on ti1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(3 rows)
+
+-- No. S-3-13-15
+/*+NoSeqScan(ti1 ti1_pkey ti1_btree)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+INFO: hint syntax error at or near "ti1_pkey ti1_btree)"
+DETAIL: Closing parenthesis is necessary.
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on ti1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(3 rows)
+
+-- No. S-3-13-16
+/*+NoIndexScan(ti1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoIndexScan(ti1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on ti1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(3 rows)
+
+-- No. S-3-13-17
+/*+NoIndexScan(ti1 ti1_pkey)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+INFO: hint syntax error at or near "ti1_pkey)"
+DETAIL: Closing parenthesis is necessary.
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on ti1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(3 rows)
+
+-- No. S-3-13-18
+/*+NoIndexScan(ti1 ti1_pkey ti1_btree)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+INFO: hint syntax error at or near "ti1_pkey ti1_btree)"
+DETAIL: Closing parenthesis is necessary.
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on ti1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(3 rows)
+
+-- No. S-3-13-19
+/*+NoBitmapScan(ti1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoBitmapScan(ti1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on ti1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(3 rows)
+
+-- No. S-3-13-20
+/*+NoBitmapScan(ti1 ti1_pkey)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+INFO: hint syntax error at or near "ti1_pkey)"
+DETAIL: Closing parenthesis is necessary.
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on ti1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(3 rows)
+
+-- No. S-3-13-21
+/*+NoBitmapScan(ti1 ti1_pkey ti1_btree)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+INFO: hint syntax error at or near "ti1_pkey ti1_btree)"
+DETAIL: Closing parenthesis is necessary.
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on ti1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(3 rows)
+
+-- No. S-3-13-22
+/*+NoTidScan(ti1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoTidScan(ti1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Index Scan using ti1_uniq on ti1
+ Index Cond: (c1 = 1)
+ Filter: (ctid = '(1,1)'::tid)
+(3 rows)
+
+-- No. S-3-13-23
+/*+NoTidScan(ti1 ti1_pkey)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+INFO: hint syntax error at or near "ti1_pkey)"
+DETAIL: Closing parenthesis is necessary.
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on ti1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(3 rows)
+
+-- No. S-3-13-24
+/*+NoTidScan(ti1 ti1_pkey ti1_btree)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+INFO: hint syntax error at or near "ti1_pkey ti1_btree)"
+DETAIL: Closing parenthesis is necessary.
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on ti1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(3 rows)
+
+-- No. S-3-13-25
+/*+IndexOnlyScan(ti1)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 >= 1;
+INFO: hint syntax error at or near "IndexOnlyScan(ti1)"
+DETAIL: Unrecognized hint keyword "IndexOnlyScan".
+ QUERY PLAN
+---------------------
+ Seq Scan on ti1
+ Filter: (c1 >= 1)
+(2 rows)
+
+-- No. S-3-13-26
+/*+IndexOnlyScan(ti1 ti1_pkey)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 >= 1;
+INFO: hint syntax error at or near "IndexOnlyScan(ti1 ti1_pkey)"
+DETAIL: Unrecognized hint keyword "IndexOnlyScan".
+ QUERY PLAN
+---------------------
+ Seq Scan on ti1
+ Filter: (c1 >= 1)
+(2 rows)
+
+-- No. S-3-13-27
+/*+IndexOnlyScan(ti1 ti1_pkey ti1_btree)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 >= 1;
+INFO: hint syntax error at or near "IndexOnlyScan(ti1 ti1_pkey ti1_btree)"
+DETAIL: Unrecognized hint keyword "IndexOnlyScan".
+ QUERY PLAN
+---------------------
+ Seq Scan on ti1
+ Filter: (c1 >= 1)
+(2 rows)
+
+-- No. S-3-13-28
+/*+NoIndexOnlyScan(ti1)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 = 1;
+INFO: hint syntax error at or near "NoIndexOnlyScan(ti1)"
+DETAIL: Unrecognized hint keyword "NoIndexOnlyScan".
+ QUERY PLAN
+----------------------------------
+ Index Scan using ti1_uniq on ti1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. S-3-13-29
+/*+NoIndexOnlyScan(ti1 ti1_pkey)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 = 1;
+INFO: hint syntax error at or near "NoIndexOnlyScan(ti1 ti1_pkey)"
+DETAIL: Unrecognized hint keyword "NoIndexOnlyScan".
+ QUERY PLAN
+----------------------------------
+ Index Scan using ti1_uniq on ti1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. S-3-13-30
+/*+NoIndexOnlyScan(ti1 ti1_pkey ti1_btree)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 = 1;
+INFO: hint syntax error at or near "NoIndexOnlyScan(ti1 ti1_pkey ti1_btree)"
+DETAIL: Unrecognized hint keyword "NoIndexOnlyScan".
+ QUERY PLAN
+----------------------------------
+ Index Scan using ti1_uniq on ti1
+ Index Cond: (c1 = 1)
+(2 rows)
+
--- /dev/null
+LOAD 'pg_hint_plan';
+SET pg_hint_plan.enable_hint TO on;
+SET pg_hint_plan.debug_print TO on;
+SET client_min_messages TO LOG;
+SET search_path TO public;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 >= 1;
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c1 >= 1)
+(2 rows)
+
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c3 < 10;
+ QUERY PLAN
+---------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c3 < 10)
+ -> Bitmap Index Scan on t1_i
+ Index Cond: (c3 < 10)
+(4 rows)
+
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(3 rows)
+
+----
+---- No. S-1-1 specified pattern of the object name
+----
+-- No. S-1-1-1
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. S-1-1-2
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 t_1 WHERE t_1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+SeqScan(t1)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Index Scan using t1_i1 on t1 t_1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. S-1-1-3
+/*+SeqScan(t_1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 t_1 WHERE t_1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t_1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1 t_1
+ Filter: (c1 = 1)
+(2 rows)
+
+----
+---- No. S-1-2 specified schema name in the hint option
+----
+-- No. S-1-2-1
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. S-1-2-2
+/*+SeqScan(s1.t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+SeqScan(s1.t1)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+----
+---- No. S-1-3 table doesn't exist in the hint option
+----
+-- No. S-1-3-1
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. S-1-3-2
+/*+SeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+SeqScan(t2)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+----
+---- No. S-1-4 conflict table name
+----
+-- No. S-1-4-1
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = 1 AND t1.c1 = t2.c1;
+ QUERY PLAN
+------------------------------------
+ Nested Loop
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+ -> Seq Scan on t2
+ Filter: (c1 = 1)
+(5 rows)
+
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = 1 AND t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------
+ Nested Loop
+ -> Seq Scan on t1
+ Filter: (c1 = 1)
+ -> Seq Scan on t2
+ Filter: (c1 = 1)
+(5 rows)
+
+-- No. S-1-4-2
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s2.t1 WHERE s1.t1.c1 = 1 AND s1.t1.c1 = s2.t1.c1;
+ QUERY PLAN
+------------------------------------
+ Nested Loop
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+ -> Seq Scan on t1
+ Filter: (c1 = 1)
+(5 rows)
+
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s2.t1 WHERE s1.t1.c1 = 1 AND s1.t1.c1 = s2.t1.c1;
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Bitmap Heap Scan on t1
+ Recheck Cond: (c1 = 1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 = 1)
+ -> Bitmap Heap Scan on t1
+ Recheck Cond: (c1 = 1)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: (c1 = 1)
+(9 rows)
+
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s2.t1 s2t1 WHERE s1.t1.c1 = 1 AND s1.t1.c1 = s2t1.c1;
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------
+ Nested Loop
+ -> Bitmap Heap Scan on t1
+ Recheck Cond: (c1 = 1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 = 1)
+ -> Seq Scan on t1 s2t1
+ Filter: (c1 = 1)
+(7 rows)
+
+/*+BitmapScan(s2t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s2.t1 s2t1 WHERE s1.t1.c1 = 1 AND s1.t1.c1 = s2t1.c1;
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(s2t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------
+ Nested Loop
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+ -> Bitmap Heap Scan on t1 s2t1
+ Recheck Cond: (c1 = 1)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: (c1 = 1)
+(7 rows)
+
+-- No. S-1-4-3
+EXPLAIN (COSTS false) SELECT (SELECT max(c1) FROM s1.t1 WHERE s1.t1.c1 = 1) FROM s1.t1 WHERE s1.t1.c1 = 1;
+ QUERY PLAN
+---------------------------------------------------------------------
+ Index Only Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+ InitPlan 2 (returns $1)
+ -> Result
+ InitPlan 1 (returns $0)
+ -> Limit
+ -> Index Only Scan using t1_i1 on t1
+ Index Cond: ((c1 IS NOT NULL) AND (c1 = 1))
+(8 rows)
+
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) SELECT (SELECT max(c1) FROM s1.t1 WHERE s1.t1.c1 = 1) FROM s1.t1 WHERE s1.t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 = 1)
+ InitPlan 2 (returns $1)
+ -> Result
+ InitPlan 1 (returns $0)
+ -> Limit
+ -> Bitmap Heap Scan on t1
+ Recheck Cond: ((c1 IS NOT NULL) AND (c1 = 1))
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: ((c1 IS NOT NULL) AND (c1 = 1))
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 = 1)
+(12 rows)
+
+/*+BitmapScan(t11)*/
+EXPLAIN (COSTS false) SELECT (SELECT max(c1) FROM s1.t1 t11 WHERE t11.c1 = 1) FROM s1.t1 t12 WHERE t12.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t11)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------------------
+ Index Only Scan using t1_i1 on t1 t12
+ Index Cond: (c1 = 1)
+ InitPlan 2 (returns $1)
+ -> Result
+ InitPlan 1 (returns $0)
+ -> Limit
+ -> Bitmap Heap Scan on t1 t11
+ Recheck Cond: ((c1 IS NOT NULL) AND (c1 = 1))
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: ((c1 IS NOT NULL) AND (c1 = 1))
+(10 rows)
+
+/*+BitmapScan(t12)*/
+EXPLAIN (COSTS false) SELECT (SELECT max(c1) FROM s1.t1 t11 WHERE t11.c1 = 1) FROM s1.t1 t12 WHERE t12.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t12)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------------
+ Bitmap Heap Scan on t1 t12
+ Recheck Cond: (c1 = 1)
+ InitPlan 2 (returns $1)
+ -> Result
+ InitPlan 1 (returns $0)
+ -> Limit
+ -> Index Only Scan using t1_i1 on t1 t11
+ Index Cond: ((c1 IS NOT NULL) AND (c1 = 1))
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 = 1)
+(10 rows)
+
+----
+---- No. S-1-5 object type for the hint
+----
+-- No. S-1-5-1
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. S-1-5-2
+EXPLAIN (COSTS false) SELECT * FROM s1.p1 WHERE p1.c1 = 1;
+ QUERY PLAN
+---------------------------------
+ Result
+ -> Append
+ -> Seq Scan on p1
+ Filter: (c1 = 1)
+ -> Seq Scan on p1c1 p1
+ Filter: (c1 = 1)
+(6 rows)
+
+/*+IndexScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.p1 WHERE p1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+IndexScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------
+ Result
+ -> Append
+ -> Index Scan using p1_i on p1
+ Index Cond: (c1 = 1)
+ -> Index Scan using p1c1_i on p1c1 p1
+ Index Cond: (c1 = 1)
+(6 rows)
+
+-- No. S-1-5-3
+EXPLAIN (COSTS false) SELECT * FROM s1.ul1 WHERE ul1.c1 = 1;
+ QUERY PLAN
+----------------------------------
+ Index Scan using ul1_pkey on ul1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+/*+SeqScan(ul1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ul1 WHERE ul1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(ul1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on ul1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. S-1-5-4
+CREATE TEMP TABLE tm1 (LIKE s1.t1 INCLUDING ALL);
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "tm1_pkey" for table "tm1"
+EXPLAIN (COSTS false) SELECT * FROM tm1 WHERE tm1.c1 = 1;
+ QUERY PLAN
+----------------------------------
+ Index Scan using tm1_pkey on tm1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+/*+SeqScan(tm1)*/
+EXPLAIN (COSTS false) SELECT * FROM tm1 WHERE tm1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(tm1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on tm1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. S-1-5-5
+EXPLAIN (COSTS false) SELECT * FROM pg_catalog.pg_class WHERE oid = 1;
+ QUERY PLAN
+-------------------------------------------------
+ Index Scan using pg_class_oid_index on pg_class
+ Index Cond: (oid = 1::oid)
+(2 rows)
+
+/*+SeqScan(pg_class)*/
+EXPLAIN (COSTS false) SELECT * FROM pg_catalog.pg_class WHERE oid = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(pg_class)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------
+ Seq Scan on pg_class
+ Filter: (oid = 1::oid)
+(2 rows)
+
+-- No. S-1-5-6
+-- refer ut-fdw.sql
+-- No. S-1-5-7
+EXPLAIN (COSTS false) SELECT * FROM s1.f1() AS ft1 WHERE ft1.c1 = 1;
+ QUERY PLAN
+-------------------------
+ Function Scan on f1 ft1
+ Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan(ft1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.f1() AS ft1 WHERE ft1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+SeqScan(ft1)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------
+ Function Scan on f1 ft1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. S-1-5-8
+EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1'), (2,2,2,'2'), (3,3,3,'3')) AS val1 (c1, c2, c3, c4) WHERE val1.c1 = 1;
+ QUERY PLAN
+---------------------------
+ Values Scan on "*VALUES*"
+ Filter: (column1 = 1)
+(2 rows)
+
+/*+SeqScan(val1)*/
+EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1'), (2,2,2,'2'), (3,3,3,'3')) AS val1 (c1, c2, c3, c4) WHERE val1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+SeqScan(val1)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------
+ Values Scan on "*VALUES*"
+ Filter: (column1 = 1)
+(2 rows)
+
+/*+SeqScan(*VALUES*)*/
+EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1'), (2,2,2,'2'), (3,3,3,'3')) AS val1 (c1, c2, c3, c4) WHERE val1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+SeqScan(*VALUES*)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------
+ Values Scan on "*VALUES*"
+ Filter: (column1 = 1)
+(2 rows)
+
+-- No. S-1-5-9
+EXPLAIN (COSTS false) WITH c1(c1) AS (SELECT max(c1) FROM s1.t1 WHERE t1.c1 = 1)
+SELECT * FROM s1.t1, c1 WHERE t1.c1 = 1 AND t1.c1 = c1.c1;
+ QUERY PLAN
+---------------------------------------------------------------------
+ Nested Loop
+ CTE c1
+ -> Result
+ InitPlan 1 (returns $0)
+ -> Limit
+ -> Index Only Scan using t1_i1 on t1
+ Index Cond: ((c1 IS NOT NULL) AND (c1 = 1))
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+ -> CTE Scan on c1
+ Filter: (c1 = 1)
+(11 rows)
+
+/*+SeqScan(c1)*/
+EXPLAIN (COSTS false) WITH c1(c1) AS (SELECT max(c1) FROM s1.t1 WHERE t1.c1 = 1)
+SELECT * FROM s1.t1, c1 WHERE t1.c1 = 1 AND t1.c1 = c1.c1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+SeqScan(c1)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------------
+ Nested Loop
+ CTE c1
+ -> Result
+ InitPlan 1 (returns $0)
+ -> Limit
+ -> Index Only Scan using t1_i1 on t1
+ Index Cond: ((c1 IS NOT NULL) AND (c1 = 1))
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+ -> CTE Scan on c1
+ Filter: (c1 = 1)
+(11 rows)
+
+-- No. S-1-5-10
+EXPLAIN (COSTS false) SELECT * FROM s1.v1 WHERE v1.c1 = 1;
+ QUERY PLAN
+-----------------------------------
+ Index Scan using t1_i1 on t1 v1t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+/*+SeqScan(v1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.v1 WHERE v1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+SeqScan(v1)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------
+ Index Scan using t1_i1 on t1 v1t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. S-1-5-11
+EXPLAIN (COSTS false) SELECT * FROM (SELECT * FROM s1.t1 WHERE t1.c1 = 1) AS s1 WHERE s1.c1 = 1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+/*+SeqScan(s1)*/
+EXPLAIN (COSTS false) SELECT * FROM (SELECT * FROM s1.t1 WHERE t1.c1 = 1) AS s1 WHERE s1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+SeqScan(s1)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+----
+---- No. S-2-1 complexity query block
+----
+-- No. S-2-1-1
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1), (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
+;
+ QUERY PLAN
+------------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t2.c1)
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t4.c1)
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t3.c1)
+ -> Index Only Scan using t1_i1 on t1 b1t1
+ -> Index Only Scan using t3_i1 on t3 b1t3
+ -> Index Only Scan using t4_i1 on t4 b1t4
+ -> Sort
+ Sort Key: b1t2.c1
+ -> Seq Scan on t2 b1t2
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt2.c1)
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt4.c1)
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt3.c1)
+ -> Index Only Scan using t1_i1 on t1 bmt1
+ -> Index Only Scan using t3_i1 on t3 bmt3
+ -> Index Only Scan using t4_i1 on t4 bmt4
+ -> Sort
+ Sort Key: bmt2.c1
+ -> Seq Scan on t2 bmt2
+(27 rows)
+
+/*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4)
+TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey)
+*/
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1), (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
+;
+LOG: pg_hint_plan:
+used hint:
+TidScan(b1t1)
+SeqScan(b1t2)
+IndexScan(b1t3 t3_pkey)
+BitmapScan(b1t4 t4_pkey)
+SeqScan(bmt1)
+IndexScan(bmt2 t2_pkey)
+BitmapScan(bmt3 t3_pkey)
+TidScan(bmt4)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $2)
+ -> Aggregate
+ -> Hash Join
+ Hash Cond: (b1t2.c1 = b1t1.c1)
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t3.c1)
+ -> Nested Loop
+ -> Seq Scan on t2 b1t2
+ -> Bitmap Heap Scan on t4 b1t4
+ Recheck Cond: (c1 = b1t2.c1)
+ -> Bitmap Index Scan on t4_pkey
+ Index Cond: (c1 = b1t2.c1)
+ -> Index Scan using t3_pkey on t3 b1t3
+ Index Cond: (c1 = b1t4.c1)
+ -> Hash
+ -> Seq Scan on t1 b1t1
+ -> Hash Join
+ Hash Cond: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (bmt1.c1 = bmt2.c1)
+ -> Seq Scan on t1 bmt1
+ -> Hash
+ -> Index Scan using t2_pkey on t2 bmt2
+ -> Bitmap Heap Scan on t3 bmt3
+ Recheck Cond: (c1 = bmt1.c1)
+ -> Bitmap Index Scan on t3_pkey
+ Index Cond: (c1 = bmt1.c1)
+ -> Hash
+ -> Seq Scan on t4 bmt4
+(31 rows)
+
+-- No. S-2-1-2
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1), (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
+), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.c1 = b2t2.c1 AND b2t1.c1 = b2t3.c1 AND b2t1.c1 = b2t4.c1
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
+;
+ QUERY PLAN
+------------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t2.c1)
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t4.c1)
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t3.c1)
+ -> Index Only Scan using t1_i1 on t1 b1t1
+ -> Index Only Scan using t3_i1 on t3 b1t3
+ -> Index Only Scan using t4_i1 on t4 b1t4
+ -> Sort
+ Sort Key: b1t2.c1
+ -> Seq Scan on t2 b1t2
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (b2t1.c1 = b2t2.c1)
+ -> Merge Join
+ Merge Cond: (b2t1.c1 = b2t4.c1)
+ -> Merge Join
+ Merge Cond: (b2t1.c1 = b2t3.c1)
+ -> Index Only Scan using t1_i1 on t1 b2t1
+ -> Index Only Scan using t3_i1 on t3 b2t3
+ -> Index Only Scan using t4_i1 on t4 b2t4
+ -> Sort
+ Sort Key: b2t2.c1
+ -> Seq Scan on t2 b2t2
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt2.c1)
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt4.c1)
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt3.c1)
+ -> Index Only Scan using t1_i1 on t1 bmt1
+ -> Index Only Scan using t3_i1 on t3 bmt3
+ -> Index Only Scan using t4_i1 on t4 bmt4
+ -> Sort
+ Sort Key: bmt2.c1
+ -> Seq Scan on t2 bmt2
+(41 rows)
+
+/*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4)
+TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey)
+BitmapScan(b2t1 t1_pkey)TidScan(b2t2)SeqScan(b2t3)IndexScan(b2t4 t4_pkey)
+*/
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1), (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
+), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.c1 = b2t2.c1 AND b2t1.c1 = b2t3.c1 AND b2t1.c1 = b2t4.c1
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
+;
+LOG: pg_hint_plan:
+used hint:
+TidScan(b1t1)
+SeqScan(b1t2)
+IndexScan(b1t3 t3_pkey)
+BitmapScan(b1t4 t4_pkey)
+BitmapScan(b2t1 t1_pkey)
+TidScan(b2t2)
+SeqScan(b2t3)
+IndexScan(b2t4 t4_pkey)
+SeqScan(bmt1)
+IndexScan(bmt2 t2_pkey)
+BitmapScan(bmt3 t3_pkey)
+TidScan(bmt4)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $2)
+ -> Aggregate
+ -> Hash Join
+ Hash Cond: (b1t2.c1 = b1t1.c1)
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t3.c1)
+ -> Nested Loop
+ -> Seq Scan on t2 b1t2
+ -> Bitmap Heap Scan on t4 b1t4
+ Recheck Cond: (c1 = b1t2.c1)
+ -> Bitmap Index Scan on t4_pkey
+ Index Cond: (c1 = b1t2.c1)
+ -> Index Scan using t3_pkey on t3 b1t3
+ Index Cond: (c1 = b1t4.c1)
+ -> Hash
+ -> Seq Scan on t1 b1t1
+ InitPlan 2 (returns $4)
+ -> Aggregate
+ -> Hash Join
+ Hash Cond: (b2t1.c1 = b2t3.c1)
+ -> Merge Join
+ Merge Cond: (b2t1.c1 = b2t2.c1)
+ -> Nested Loop
+ -> Index Scan using t4_pkey on t4 b2t4
+ -> Bitmap Heap Scan on t1 b2t1
+ Recheck Cond: (c1 = b2t4.c1)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: (c1 = b2t4.c1)
+ -> Sort
+ Sort Key: b2t2.c1
+ -> Seq Scan on t2 b2t2
+ -> Hash
+ -> Seq Scan on t3 b2t3
+ -> Hash Join
+ Hash Cond: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (bmt1.c1 = bmt2.c1)
+ -> Seq Scan on t1 bmt1
+ -> Hash
+ -> Index Scan using t2_pkey on t2 bmt2
+ -> Bitmap Heap Scan on t3 bmt3
+ Recheck Cond: (c1 = bmt1.c1)
+ -> Bitmap Index Scan on t3_pkey
+ Index Cond: (c1 = bmt1.c1)
+ -> Hash
+ -> Seq Scan on t4 bmt4
+(48 rows)
+
+-- No. S-2-1-3
+EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, (SELECT * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = sbmt4.c1;
+ QUERY PLAN
+----------------------------------------------------------------
+ Aggregate
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt2.c1)
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt4.c1)
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt3.c1)
+ -> Index Only Scan using t1_i1 on t1 bmt1
+ -> Index Only Scan using t3_i1 on t3 bmt3
+ -> Index Only Scan using t4_i1 on t4 bmt4
+ -> Sort
+ Sort Key: bmt2.c1
+ -> Seq Scan on t2 bmt2
+(13 rows)
+
+/*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4)
+*/
+EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, (SELECT * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = sbmt4.c1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(bmt1)
+IndexScan(bmt2 t2_pkey)
+BitmapScan(bmt3 t3_pkey)
+TidScan(bmt4)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------------------
+ Aggregate
+ -> Hash Join
+ Hash Cond: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (bmt1.c1 = bmt2.c1)
+ -> Seq Scan on t1 bmt1
+ -> Hash
+ -> Index Scan using t2_pkey on t2 bmt2
+ -> Bitmap Heap Scan on t3 bmt3
+ Recheck Cond: (c1 = bmt1.c1)
+ -> Bitmap Index Scan on t3_pkey
+ Index Cond: (c1 = bmt1.c1)
+ -> Hash
+ -> Seq Scan on t4 bmt4
+(15 rows)
+
+-- No. S-2-1-4
+EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, (SELECT * FROM s1.t3 bmt3) sbmt3, (SELECT * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = sbmt3.c1 AND bmt1.c1 = sbmt4.c1;
+ QUERY PLAN
+----------------------------------------------------------------
+ Aggregate
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt2.c1)
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt4.c1)
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt3.c1)
+ -> Index Only Scan using t1_i1 on t1 bmt1
+ -> Index Only Scan using t3_i1 on t3 bmt3
+ -> Index Only Scan using t4_i1 on t4 bmt4
+ -> Sort
+ Sort Key: bmt2.c1
+ -> Seq Scan on t2 bmt2
+(13 rows)
+
+/*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4)
+*/
+EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, (SELECT * FROM s1.t3 bmt3) sbmt3, (SELECT * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = sbmt3.c1 AND bmt1.c1 = sbmt4.c1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(bmt1)
+IndexScan(bmt2 t2_pkey)
+BitmapScan(bmt3 t3_pkey)
+TidScan(bmt4)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------------------
+ Aggregate
+ -> Hash Join
+ Hash Cond: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (bmt1.c1 = bmt2.c1)
+ -> Seq Scan on t1 bmt1
+ -> Hash
+ -> Index Scan using t2_pkey on t2 bmt2
+ -> Bitmap Heap Scan on t3 bmt3
+ Recheck Cond: (c1 = bmt1.c1)
+ -> Bitmap Index Scan on t3_pkey
+ Index Cond: (c1 = bmt1.c1)
+ -> Hash
+ -> Seq Scan on t4 bmt4
+(15 rows)
+
+-- No. S-2-1-5
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
+ AND bmt1.c1 <> (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
+)
+;
+ QUERY PLAN
+------------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t2.c1)
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t4.c1)
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t3.c1)
+ -> Index Only Scan using t1_i1 on t1 b1t1
+ -> Index Only Scan using t3_i1 on t3 b1t3
+ -> Index Only Scan using t4_i1 on t4 b1t4
+ -> Sort
+ Sort Key: b1t2.c1
+ -> Seq Scan on t2 b1t2
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt2.c1)
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt4.c1)
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt3.c1)
+ -> Index Only Scan using t1_i1 on t1 bmt1
+ Filter: (c1 <> $0)
+ -> Index Only Scan using t3_i1 on t3 bmt3
+ -> Index Only Scan using t4_i1 on t4 bmt4
+ -> Sort
+ Sort Key: bmt2.c1
+ -> Seq Scan on t2 bmt2
+(28 rows)
+
+/*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4)
+TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey)
+*/
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
+ AND bmt1.c1 <> (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
+)
+;
+LOG: pg_hint_plan:
+used hint:
+TidScan(b1t1)
+SeqScan(b1t2)
+IndexScan(b1t3 t3_pkey)
+BitmapScan(b1t4 t4_pkey)
+SeqScan(bmt1)
+IndexScan(bmt2 t2_pkey)
+BitmapScan(bmt3 t3_pkey)
+TidScan(bmt4)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $2)
+ -> Aggregate
+ -> Hash Join
+ Hash Cond: (b1t2.c1 = b1t1.c1)
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t3.c1)
+ -> Nested Loop
+ -> Seq Scan on t2 b1t2
+ -> Bitmap Heap Scan on t4 b1t4
+ Recheck Cond: (c1 = b1t2.c1)
+ -> Bitmap Index Scan on t4_pkey
+ Index Cond: (c1 = b1t2.c1)
+ -> Index Scan using t3_pkey on t3 b1t3
+ Index Cond: (c1 = b1t4.c1)
+ -> Hash
+ -> Seq Scan on t1 b1t1
+ -> Hash Join
+ Hash Cond: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (bmt1.c1 = bmt2.c1)
+ -> Seq Scan on t1 bmt1
+ Filter: (c1 <> $2)
+ -> Hash
+ -> Index Scan using t2_pkey on t2 bmt2
+ -> Bitmap Heap Scan on t3 bmt3
+ Recheck Cond: (c1 = bmt1.c1)
+ -> Bitmap Index Scan on t3_pkey
+ Index Cond: (c1 = bmt1.c1)
+ -> Hash
+ -> Seq Scan on t4 bmt4
+(32 rows)
+
+-- No. S-2-1-6
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
+ AND bmt1.c1 <> (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
+) AND bmt1.c1 <> (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.c1 = b2t2.c1 AND b2t1.c1 = b2t3.c1 AND b2t1.c1 = b2t4.c1
+)
+;
+ QUERY PLAN
+------------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $0)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t2.c1)
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t4.c1)
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t3.c1)
+ -> Index Only Scan using t1_i1 on t1 b1t1
+ -> Index Only Scan using t3_i1 on t3 b1t3
+ -> Index Only Scan using t4_i1 on t4 b1t4
+ -> Sort
+ Sort Key: b1t2.c1
+ -> Seq Scan on t2 b1t2
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (b2t1.c1 = b2t2.c1)
+ -> Merge Join
+ Merge Cond: (b2t1.c1 = b2t4.c1)
+ -> Merge Join
+ Merge Cond: (b2t1.c1 = b2t3.c1)
+ -> Index Only Scan using t1_i1 on t1 b2t1
+ -> Index Only Scan using t3_i1 on t3 b2t3
+ -> Index Only Scan using t4_i1 on t4 b2t4
+ -> Sort
+ Sort Key: b2t2.c1
+ -> Seq Scan on t2 b2t2
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt2.c1)
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt4.c1)
+ -> Merge Join
+ Merge Cond: (bmt1.c1 = bmt3.c1)
+ -> Index Only Scan using t1_i1 on t1 bmt1
+ Filter: ((c1 <> $0) AND (c1 <> $1))
+ -> Index Only Scan using t3_i1 on t3 bmt3
+ -> Index Only Scan using t4_i1 on t4 bmt4
+ -> Sort
+ Sort Key: bmt2.c1
+ -> Seq Scan on t2 bmt2
+(42 rows)
+
+/*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4)
+TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey)
+BitmapScan(b2t1 t1_pkey)TidScan(b2t2)SeqScan(b2t3)IndexScan(b2t4 t4_pkey)
+*/
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
+ AND bmt1.c1 <> (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
+) AND bmt1.c1 <> (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.c1 = b2t2.c1 AND b2t1.c1 = b2t3.c1 AND b2t1.c1 = b2t4.c1
+)
+;
+LOG: pg_hint_plan:
+used hint:
+TidScan(b1t1)
+SeqScan(b1t2)
+IndexScan(b1t3 t3_pkey)
+BitmapScan(b1t4 t4_pkey)
+BitmapScan(b2t1 t1_pkey)
+TidScan(b2t2)
+SeqScan(b2t3)
+IndexScan(b2t4 t4_pkey)
+SeqScan(bmt1)
+IndexScan(bmt2 t2_pkey)
+BitmapScan(bmt3 t3_pkey)
+TidScan(bmt4)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------------
+ Aggregate
+ InitPlan 1 (returns $2)
+ -> Aggregate
+ -> Hash Join
+ Hash Cond: (b1t2.c1 = b1t1.c1)
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t3.c1)
+ -> Nested Loop
+ -> Seq Scan on t2 b1t2
+ -> Bitmap Heap Scan on t4 b1t4
+ Recheck Cond: (c1 = b1t2.c1)
+ -> Bitmap Index Scan on t4_pkey
+ Index Cond: (c1 = b1t2.c1)
+ -> Index Scan using t3_pkey on t3 b1t3
+ Index Cond: (c1 = b1t4.c1)
+ -> Hash
+ -> Seq Scan on t1 b1t1
+ InitPlan 2 (returns $4)
+ -> Aggregate
+ -> Hash Join
+ Hash Cond: (b2t1.c1 = b2t3.c1)
+ -> Merge Join
+ Merge Cond: (b2t1.c1 = b2t2.c1)
+ -> Nested Loop
+ -> Index Scan using t4_pkey on t4 b2t4
+ -> Bitmap Heap Scan on t1 b2t1
+ Recheck Cond: (c1 = b2t4.c1)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: (c1 = b2t4.c1)
+ -> Sort
+ Sort Key: b2t2.c1
+ -> Seq Scan on t2 b2t2
+ -> Hash
+ -> Seq Scan on t3 b2t3
+ -> Hash Join
+ Hash Cond: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (bmt1.c1 = bmt2.c1)
+ -> Seq Scan on t1 bmt1
+ Filter: ((c1 <> $2) AND (c1 <> $4))
+ -> Hash
+ -> Index Scan using t2_pkey on t2 bmt2
+ -> Bitmap Heap Scan on t3 bmt3
+ Recheck Cond: (c1 = bmt1.c1)
+ -> Bitmap Index Scan on t3_pkey
+ Index Cond: (c1 = bmt1.c1)
+ -> Hash
+ -> Seq Scan on t4 bmt4
+(49 rows)
+
+-- No. S-2-1-7
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
+)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
+, c1
+ WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
+AND bmt1.c1 = c1.c1
+;
+ QUERY PLAN
+------------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t2.c1)
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t4.c1)
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t3.c1)
+ -> Index Only Scan using t1_i1 on t1 b1t1
+ -> Index Only Scan using t3_i1 on t3 b1t3
+ -> Index Only Scan using t4_i1 on t4 b1t4
+ -> Sort
+ Sort Key: b1t2.c1
+ -> Seq Scan on t2 b1t2
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt2.c1 = bmt1.c1)
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (bmt2.c1 = c1.c1)
+ -> Seq Scan on t2 bmt2
+ -> Hash
+ -> CTE Scan on c1
+ -> Index Only Scan using t3_i1 on t3 bmt3
+ Index Cond: (c1 = bmt2.c1)
+ -> Index Only Scan using t1_i1 on t1 bmt1
+ Index Cond: (c1 = bmt3.c1)
+ -> Index Only Scan using t4_i1 on t4 bmt4
+ Index Cond: (c1 = bmt3.c1)
+(31 rows)
+
+/*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4)
+TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
+)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
+, c1
+ WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
+AND bmt1.c1 = c1.c1
+;
+LOG: pg_hint_plan:
+used hint:
+TidScan(b1t1)
+SeqScan(b1t2)
+IndexScan(b1t3 t3_pkey)
+BitmapScan(b1t4 t4_pkey)
+SeqScan(bmt1)
+IndexScan(bmt2 t2_pkey)
+BitmapScan(bmt3 t3_pkey)
+TidScan(bmt4)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Hash Join
+ Hash Cond: (b1t2.c1 = b1t1.c1)
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t3.c1)
+ -> Nested Loop
+ -> Seq Scan on t2 b1t2
+ -> Bitmap Heap Scan on t4 b1t4
+ Recheck Cond: (c1 = b1t2.c1)
+ -> Bitmap Index Scan on t4_pkey
+ Index Cond: (c1 = b1t2.c1)
+ -> Index Scan using t3_pkey on t3 b1t3
+ Index Cond: (c1 = b1t4.c1)
+ -> Hash
+ -> Seq Scan on t1 b1t1
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (bmt1.c1 = c1.c1)
+ -> Seq Scan on t1 bmt1
+ -> Hash
+ -> CTE Scan on c1
+ -> Index Scan using t2_pkey on t2 bmt2
+ Index Cond: (c1 = bmt1.c1)
+ -> Bitmap Heap Scan on t3 bmt3
+ Recheck Cond: (c1 = bmt1.c1)
+ -> Bitmap Index Scan on t3_pkey
+ Index Cond: (c1 = bmt1.c1)
+ -> Seq Scan on t4 bmt4
+(33 rows)
+
+-- No. S-2-1-8
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
+)
+, c2 (c1) AS (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.c1 = b2t2.c1 AND b2t1.c1 = b2t3.c1 AND b2t1.c1 = b2t4.c1
+)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
+, c1, c2
+ WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 = c2.c1
+;
+ QUERY PLAN
+------------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t2.c1)
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t4.c1)
+ -> Merge Join
+ Merge Cond: (b1t1.c1 = b1t3.c1)
+ -> Index Only Scan using t1_i1 on t1 b1t1
+ -> Index Only Scan using t3_i1 on t3 b1t3
+ -> Index Only Scan using t4_i1 on t4 b1t4
+ -> Sort
+ Sort Key: b1t2.c1
+ -> Seq Scan on t2 b1t2
+ CTE c2
+ -> Aggregate
+ -> Merge Join
+ Merge Cond: (b2t1.c1 = b2t2.c1)
+ -> Merge Join
+ Merge Cond: (b2t1.c1 = b2t4.c1)
+ -> Merge Join
+ Merge Cond: (b2t1.c1 = b2t3.c1)
+ -> Index Only Scan using t1_i1 on t1 b2t1
+ -> Index Only Scan using t3_i1 on t3 b2t3
+ -> Index Only Scan using t4_i1 on t4 b2t4
+ -> Sort
+ Sort Key: b2t2.c1
+ -> Seq Scan on t2 b2t2
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = c2.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt2.c1 = bmt1.c1)
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (bmt2.c1 = c1.c1)
+ -> Seq Scan on t2 bmt2
+ -> Hash
+ -> CTE Scan on c1
+ -> Index Only Scan using t3_i1 on t3 bmt3
+ Index Cond: (c1 = bmt2.c1)
+ -> Index Only Scan using t1_i1 on t1 bmt1
+ Index Cond: (c1 = bmt3.c1)
+ -> Index Only Scan using t4_i1 on t4 bmt4
+ Index Cond: (c1 = bmt3.c1)
+ -> CTE Scan on c2
+(48 rows)
+
+/*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4)
+TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey)
+BitmapScan(b2t1 t1_pkey)TidScan(b2t2)SeqScan(b2t3)IndexScan(b2t4 t4_pkey)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
+)
+, c2 (c1) AS (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.c1 = b2t2.c1 AND b2t1.c1 = b2t3.c1 AND b2t1.c1 = b2t4.c1
+)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
+, c1, c2
+ WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 = c2.c1
+;
+LOG: pg_hint_plan:
+used hint:
+TidScan(b1t1)
+SeqScan(b1t2)
+IndexScan(b1t3 t3_pkey)
+BitmapScan(b1t4 t4_pkey)
+BitmapScan(b2t1 t1_pkey)
+TidScan(b2t2)
+SeqScan(b2t3)
+IndexScan(b2t4 t4_pkey)
+SeqScan(bmt1)
+IndexScan(bmt2 t2_pkey)
+BitmapScan(bmt3 t3_pkey)
+TidScan(bmt4)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Hash Join
+ Hash Cond: (b1t2.c1 = b1t1.c1)
+ -> Nested Loop
+ Join Filter: (b1t2.c1 = b1t3.c1)
+ -> Nested Loop
+ -> Seq Scan on t2 b1t2
+ -> Bitmap Heap Scan on t4 b1t4
+ Recheck Cond: (c1 = b1t2.c1)
+ -> Bitmap Index Scan on t4_pkey
+ Index Cond: (c1 = b1t2.c1)
+ -> Index Scan using t3_pkey on t3 b1t3
+ Index Cond: (c1 = b1t4.c1)
+ -> Hash
+ -> Seq Scan on t1 b1t1
+ CTE c2
+ -> Aggregate
+ -> Hash Join
+ Hash Cond: (b2t1.c1 = b2t3.c1)
+ -> Merge Join
+ Merge Cond: (b2t1.c1 = b2t2.c1)
+ -> Nested Loop
+ -> Index Scan using t4_pkey on t4 b2t4
+ -> Bitmap Heap Scan on t1 b2t1
+ Recheck Cond: (c1 = b2t4.c1)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: (c1 = b2t4.c1)
+ -> Sort
+ Sort Key: b2t2.c1
+ -> Seq Scan on t2 b2t2
+ -> Hash
+ -> Seq Scan on t3 b2t3
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = c2.c1)
+ -> Nested Loop
+ -> Nested Loop
+ -> Hash Join
+ Hash Cond: (bmt1.c1 = c1.c1)
+ -> Seq Scan on t1 bmt1
+ -> Hash
+ -> CTE Scan on c1
+ -> Index Scan using t2_pkey on t2 bmt2
+ Index Cond: (c1 = bmt1.c1)
+ -> Bitmap Heap Scan on t3 bmt3
+ Recheck Cond: (c1 = bmt1.c1)
+ -> Bitmap Index Scan on t3_pkey
+ Index Cond: (c1 = bmt1.c1)
+ -> CTE Scan on c2
+ -> Seq Scan on t4 bmt4
+(53 rows)
+
+----
+---- No. S-2-2 the number of the tables per quiry block
+----
+-- No. S-2-2-1
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = 1
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = 1
+)
+ FROM s1.t1 bmt1, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = 1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = 1
+)
+;
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Result
+ InitPlan 1 (returns $0)
+ -> Limit
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 4 (returns $3)
+ -> Result
+ InitPlan 3 (returns $2)
+ -> Limit
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 6 (returns $5)
+ -> Result
+ InitPlan 5 (returns $4)
+ -> Limit
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 IS NOT NULL) AND (c1 = 1))
+ -> Nested Loop
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 <> $5) AND (c1 = 1))
+ -> CTE Scan on c1
+(27 rows)
+
+/*+SeqScan(bmt1)
+TidScan(b1t1)
+BitmapScan(b2t1 t1_pkey)
+IndexScan(b3t1 t1_pkey)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = 1
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = 1
+)
+ FROM s1.t1 bmt1, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = 1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = 1
+)
+;
+LOG: pg_hint_plan:
+used hint:
+TidScan(b1t1)
+BitmapScan(b2t1 t1_pkey)
+IndexScan(b3t1 t1_pkey)
+SeqScan(bmt1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Result
+ InitPlan 1 (returns $0)
+ -> Limit
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 4 (returns $3)
+ -> Result
+ InitPlan 3 (returns $2)
+ -> Limit
+ -> Bitmap Heap Scan on t1 b2t1
+ Recheck Cond: ((c1 IS NOT NULL) AND (c1 = 1))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 6 (returns $5)
+ -> Result
+ InitPlan 5 (returns $4)
+ -> Limit
+ -> Index Scan using t1_pkey on t1 b3t1
+ Index Cond: ((c1 IS NOT NULL) AND (c1 = 1))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ -> Seq Scan on t1 bmt1
+ Filter: ((c1 <> $5) AND (ctid = '(1,1)'::tid) AND (c1 = 1))
+ -> CTE Scan on c1
+(28 rows)
+
+-- No. S-2-2-2
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)'
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)'
+)
+;
+ QUERY PLAN
+-------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t2.c1)
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 <> $2)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> CTE Scan on c1
+(34 rows)
+
+/*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)
+TidScan(b1t1)SeqScan(b1t2)
+BitmapScan(b2t1 t1_pkey)TidScan(b2t2)
+IndexScan(b3t1 t1_pkey)BitmapScan(b3t2 t2_pkey)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)'
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)'
+)
+;
+LOG: pg_hint_plan:
+used hint:
+TidScan(b1t1)
+SeqScan(b1t2)
+BitmapScan(b2t1 t1_pkey)
+TidScan(b2t2)
+IndexScan(b3t1 t1_pkey)
+BitmapScan(b3t2 t2_pkey)
+SeqScan(bmt1)
+IndexScan(bmt2 t2_pkey)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $2)
+ -> Aggregate
+ -> Nested Loop
+ -> Tid Scan on t2 b2t2
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t1 b2t1
+ Recheck Cond: (c1 = b2t2.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: (c1 = b2t2.c1)
+ InitPlan 3 (returns $4)
+ -> Aggregate
+ -> Nested Loop
+ -> Index Scan using t1_pkey on t1 b3t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t2 b3t2
+ Recheck Cond: (c1 = b3t1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t2_pkey
+ Index Cond: (c1 = b3t1.c1)
+ -> Nested Loop
+ -> Nested Loop
+ -> Seq Scan on t1 bmt1
+ Filter: ((c1 <> $4) AND (ctid = '(1,1)'::tid))
+ -> Index Scan using t2_pkey on t2 bmt2
+ Index Cond: (c1 = bmt1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> CTE Scan on c1
+(37 rows)
+
+-- No. S-2-2-3
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+;
+ QUERY PLAN
+-------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t4.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t3.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t2.c1)
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = c1.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 <> $2)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> CTE Scan on c1
+(67 rows)
+
+/*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4)
+TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey)
+BitmapScan(b2t1 t1_pkey)TidScan(b2t2)SeqScan(b2t3)IndexScan(b2t4 t4_pkey)
+IndexScan(b3t1 t1_pkey)BitmapScan(b3t2 t2_pkey)TidScan(b3t3)SeqScan(b3t4)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+;
+LOG: pg_hint_plan:
+used hint:
+TidScan(b1t1)
+SeqScan(b1t2)
+IndexScan(b1t3 t3_pkey)
+BitmapScan(b1t4 t4_pkey)
+BitmapScan(b2t1 t1_pkey)
+TidScan(b2t2)
+SeqScan(b2t3)
+IndexScan(b2t4 t4_pkey)
+IndexScan(b3t1 t1_pkey)
+BitmapScan(b3t2 t2_pkey)
+TidScan(b3t3)
+SeqScan(b3t4)
+SeqScan(bmt1)
+IndexScan(bmt2 t2_pkey)
+BitmapScan(bmt3 t3_pkey)
+TidScan(bmt4)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t3_pkey on t3 b1t3
+ Index Cond: (c1 = b1t1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t4 b1t4
+ Recheck Cond: (c1 = b1t1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t4_pkey
+ Index Cond: (c1 = b1t1.c1)
+ InitPlan 2 (returns $4)
+ -> Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ -> Tid Scan on t2 b2t2
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t1 b2t1
+ Recheck Cond: (c1 = b2t2.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: (c1 = b2t2.c1)
+ -> Seq Scan on t3 b2t3
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t4_pkey on t4 b2t4
+ Index Cond: (c1 = b2t1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $7)
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t4.c1)
+ -> Nested Loop
+ -> Nested Loop
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Index Scan using t1_pkey on t1 b3t1
+ Index Cond: (c1 = b3t3.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t2 b3t2
+ Recheck Cond: (c1 = b3t1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t2_pkey
+ Index Cond: (c1 = b3t1.c1)
+ -> Seq Scan on t4 b3t4
+ Filter: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = c1.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ -> Nested Loop
+ -> Seq Scan on t1 bmt1
+ Filter: ((c1 <> $7) AND (ctid = '(1,1)'::tid))
+ -> Index Scan using t2_pkey on t2 bmt2
+ Index Cond: (c1 = bmt1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t3 bmt3
+ Recheck Cond: (c1 = bmt1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t3_pkey
+ Index Cond: (c1 = bmt1.c1)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> CTE Scan on c1
+(74 rows)
+
+-- No. S-2-2-4
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = 1
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)'
+)
+;
+ QUERY PLAN
+-------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+ InitPlan 3 (returns $2)
+ -> Result
+ InitPlan 2 (returns $1)
+ -> Limit
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 4 (returns $3)
+ -> Aggregate
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = c1.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt3.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt2.c1)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 <> $3)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> CTE Scan on c1
+(46 rows)
+
+/*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4)
+TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey)
+BitmapScan(b2t1 t1_pkey)
+IndexScan(b3t1 t1_pkey)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = 1
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)'
+)
+;
+LOG: pg_hint_plan:
+used hint:
+TidScan(b1t1)
+SeqScan(b1t2)
+IndexScan(b1t3 t3_pkey)
+BitmapScan(b1t4 t4_pkey)
+BitmapScan(b2t1 t1_pkey)
+IndexScan(b3t1 t1_pkey)
+SeqScan(bmt1)
+IndexScan(bmt2 t2_pkey)
+BitmapScan(bmt3 t3_pkey)
+TidScan(bmt4)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------------------------------------------------
+ Aggregate
+ CTE c1
+ -> Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t3_pkey on t3 b1t3
+ Index Cond: (c1 = b1t1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t4 b1t4
+ Recheck Cond: (c1 = b1t1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t4_pkey
+ Index Cond: (c1 = b1t1.c1)
+ InitPlan 3 (returns $3)
+ -> Result
+ InitPlan 2 (returns $2)
+ -> Limit
+ -> Bitmap Heap Scan on t1 b2t1
+ Recheck Cond: ((c1 IS NOT NULL) AND (c1 = 1))
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 5 (returns $5)
+ -> Result
+ InitPlan 4 (returns $4)
+ -> Limit
+ -> Index Scan Backward using t1_pkey on t1 b3t1
+ Index Cond: (c1 IS NOT NULL)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = c1.c1)
+ -> Nested Loop
+ Join Filter: (bmt1.c1 = bmt4.c1)
+ -> Nested Loop
+ -> Nested Loop
+ -> Seq Scan on t1 bmt1
+ Filter: ((c1 <> $5) AND (ctid = '(1,1)'::tid))
+ -> Index Scan using t2_pkey on t2 bmt2
+ Index Cond: (c1 = bmt1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t3 bmt3
+ Recheck Cond: (c1 = bmt1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t3_pkey
+ Index Cond: (c1 = bmt1.c1)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> CTE Scan on c1
+(54 rows)
+
+----
+---- No. S-2-3 RULE definition table
+----
+-- No. S-2-3-1
+EXPLAIN (COSTS false) UPDATE s1.r1 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(19 rows)
+
+/*+TidScan(t1)SeqScan(t2)IndexScan(t3 t3_pkey)BitmapScan(t4 t4_pkey)
+SeqScan(r1)*/
+EXPLAIN (COSTS false) UPDATE s1.r1 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+SeqScan(r1)
+TidScan(t1)
+SeqScan(t2)
+IndexScan(t3 t3_pkey)
+BitmapScan(t4 t4_pkey)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (t1.c1 = t2.c1)
+ -> Nested Loop
+ -> Seq Scan on r1
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t3_pkey on t3
+ Index Cond: (c1 = t1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t4
+ Recheck Cond: (c1 = t1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t4_pkey
+ Index Cond: (c1 = t1.c1)
+(20 rows)
+
+EXPLAIN (COSTS false) UPDATE s1.r1_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r1_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(19 rows)
+
+/*+TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey)
+SeqScan(r1_)*/
+EXPLAIN (COSTS false) UPDATE s1.r1_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+TidScan(b1t1)
+SeqScan(b1t2)
+IndexScan(b1t3 t3_pkey)
+BitmapScan(b1t4 t4_pkey)
+SeqScan(r1_)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Nested Loop
+ -> Seq Scan on r1_
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t3_pkey on t3 b1t3
+ Index Cond: (c1 = b1t1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t4 b1t4
+ Recheck Cond: (c1 = b1t1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t4_pkey
+ Index Cond: (c1 = b1t1.c1)
+(20 rows)
+
+-- No. S-2-3-2
+EXPLAIN (COSTS false) UPDATE s1.r2 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r2
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r2
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(39 rows)
+
+/*+TidScan(t1)SeqScan(t2)IndexScan(t3 t3_pkey)BitmapScan(t4 t4_pkey)
+SeqScan(r2)*/
+EXPLAIN (COSTS false) UPDATE s1.r2 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+SeqScan(r2)
+TidScan(t1)
+SeqScan(t2)
+IndexScan(t3 t3_pkey)
+BitmapScan(t4 t4_pkey)
+not used hint:
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+SeqScan(r2)
+TidScan(t1)
+SeqScan(t2)
+IndexScan(t3 t3_pkey)
+BitmapScan(t4 t4_pkey)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (t1.c1 = t2.c1)
+ -> Nested Loop
+ -> Seq Scan on r2
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t3_pkey on t3
+ Index Cond: (c1 = t1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t4
+ Recheck Cond: (c1 = t1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t4_pkey
+ Index Cond: (c1 = t1.c1)
+
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (t1.c1 = t2.c1)
+ -> Nested Loop
+ -> Seq Scan on r2
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t3_pkey on t3
+ Index Cond: (c1 = t1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t4
+ Recheck Cond: (c1 = t1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t4_pkey
+ Index Cond: (c1 = t1.c1)
+(41 rows)
+
+EXPLAIN (COSTS false) UPDATE s1.r2_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r2_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r2_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(39 rows)
+
+/*+TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey)
+BitmapScan(b2t1 t1_pkey)TidScan(b2t2)SeqScan(b2t3)IndexScan(b2t4 t4_pkey)
+SeqScan(r2_)*/
+EXPLAIN (COSTS false) UPDATE s1.r2_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+TidScan(b1t1)
+SeqScan(b1t2)
+IndexScan(b1t3 t3_pkey)
+BitmapScan(b1t4 t4_pkey)
+SeqScan(r2_)
+not used hint:
+BitmapScan(b2t1 t1_pkey)
+TidScan(b2t2)
+SeqScan(b2t3)
+IndexScan(b2t4 t4_pkey)
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(b2t1 t1_pkey)
+TidScan(b2t2)
+SeqScan(b2t3)
+IndexScan(b2t4 t4_pkey)
+SeqScan(r2_)
+not used hint:
+TidScan(b1t1)
+SeqScan(b1t2)
+IndexScan(b1t3 t3_pkey)
+BitmapScan(b1t4 t4_pkey)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Nested Loop
+ -> Seq Scan on r2_
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t3_pkey on t3 b1t3
+ Index Cond: (c1 = b1t1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t4 b1t4
+ Recheck Cond: (c1 = b1t1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t4_pkey
+ Index Cond: (c1 = b1t1.c1)
+
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ -> Nested Loop
+ -> Seq Scan on r2_
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+ -> Tid Scan on t2 b2t2
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t1 b2t1
+ Recheck Cond: (c1 = b2t2.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: (c1 = b2t2.c1)
+ -> Seq Scan on t3 b2t3
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t4_pkey on t4 b2t4
+ Index Cond: (c1 = b2t1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+(41 rows)
+
+-- No. S-2-3-3
+EXPLAIN (COSTS false) UPDATE s1.r3 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r3
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r3
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (t1.c1 = t4.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t3.c1)
+ -> Nested Loop
+ Join Filter: (t1.c1 = t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r3
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(59 rows)
+
+/*+TidScan(t1)SeqScan(t2)IndexScan(t3 t3_pkey)BitmapScan(t4 t4_pkey)
+SeqScan(r3)*/
+EXPLAIN (COSTS false) UPDATE s1.r3 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+SeqScan(r3)
+TidScan(t1)
+SeqScan(t2)
+IndexScan(t3 t3_pkey)
+BitmapScan(t4 t4_pkey)
+not used hint:
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+SeqScan(r3)
+TidScan(t1)
+SeqScan(t2)
+IndexScan(t3 t3_pkey)
+BitmapScan(t4 t4_pkey)
+not used hint:
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+SeqScan(r3)
+TidScan(t1)
+SeqScan(t2)
+IndexScan(t3 t3_pkey)
+BitmapScan(t4 t4_pkey)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (t1.c1 = t2.c1)
+ -> Nested Loop
+ -> Seq Scan on r3
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t3_pkey on t3
+ Index Cond: (c1 = t1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t4
+ Recheck Cond: (c1 = t1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t4_pkey
+ Index Cond: (c1 = t1.c1)
+
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (t1.c1 = t2.c1)
+ -> Nested Loop
+ -> Seq Scan on r3
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t3_pkey on t3
+ Index Cond: (c1 = t1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t4
+ Recheck Cond: (c1 = t1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t4_pkey
+ Index Cond: (c1 = t1.c1)
+
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (t1.c1 = t2.c1)
+ -> Nested Loop
+ -> Seq Scan on r3
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t3_pkey on t3
+ Index Cond: (c1 = t1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t4
+ Recheck Cond: (c1 = t1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t4_pkey
+ Index Cond: (c1 = t1.c1)
+(62 rows)
+
+EXPLAIN (COSTS false) UPDATE s1.r3_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t4.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t3.c1)
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r3_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t4.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r3_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1 b2t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t4.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t3.c1)
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t2.c1)
+ -> Nested Loop
+ -> Tid Scan on r3_
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+ -> Tid Scan on t1 b3t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
+(59 rows)
+
+/*+TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey)
+BitmapScan(b2t1 t1_pkey)TidScan(b2t2)SeqScan(b2t3)IndexScan(b2t4 t4_pkey)
+IndexScan(b3t1 t1_pkey)BitmapScan(b3t2 t2_pkey)TidScan(b3t3)SeqScan(b3t4)
+SeqScan(r3_)*/
+EXPLAIN (COSTS false) UPDATE s1.r3_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+TidScan(b1t1)
+SeqScan(b1t2)
+IndexScan(b1t3 t3_pkey)
+BitmapScan(b1t4 t4_pkey)
+SeqScan(r3_)
+not used hint:
+BitmapScan(b2t1 t1_pkey)
+TidScan(b2t2)
+SeqScan(b2t3)
+IndexScan(b2t4 t4_pkey)
+IndexScan(b3t1 t1_pkey)
+BitmapScan(b3t2 t2_pkey)
+TidScan(b3t3)
+SeqScan(b3t4)
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(b2t1 t1_pkey)
+TidScan(b2t2)
+SeqScan(b2t3)
+IndexScan(b2t4 t4_pkey)
+SeqScan(r3_)
+not used hint:
+TidScan(b1t1)
+SeqScan(b1t2)
+IndexScan(b1t3 t3_pkey)
+BitmapScan(b1t4 t4_pkey)
+IndexScan(b3t1 t1_pkey)
+BitmapScan(b3t2 t2_pkey)
+TidScan(b3t3)
+SeqScan(b3t4)
+duplication hint:
+error hint:
+
+LOG: pg_hint_plan:
+used hint:
+IndexScan(b3t1 t1_pkey)
+BitmapScan(b3t2 t2_pkey)
+TidScan(b3t3)
+SeqScan(b3t4)
+SeqScan(r3_)
+not used hint:
+TidScan(b1t1)
+SeqScan(b1t2)
+IndexScan(b1t3 t3_pkey)
+BitmapScan(b1t4 t4_pkey)
+BitmapScan(b2t1 t1_pkey)
+TidScan(b2t2)
+SeqScan(b2t3)
+IndexScan(b2t4 t4_pkey)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------------------------------
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (b1t1.c1 = b1t2.c1)
+ -> Nested Loop
+ -> Seq Scan on r3_
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t3_pkey on t3 b1t3
+ Index Cond: (c1 = b1t1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t4 b1t4
+ Recheck Cond: (c1 = b1t1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t4_pkey
+ Index Cond: (c1 = b1t1.c1)
+
+ Aggregate
+ -> Nested Loop
+ -> Nested Loop
+ Join Filter: (b2t1.c1 = b2t3.c1)
+ -> Nested Loop
+ -> Nested Loop
+ -> Seq Scan on r3_
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+ -> Tid Scan on t2 b2t2
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t1 b2t1
+ Recheck Cond: (c1 = b2t2.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: (c1 = b2t2.c1)
+ -> Seq Scan on t3 b2t3
+ Filter: (ctid = '(1,1)'::tid)
+ -> Index Scan using t4_pkey on t4 b2t4
+ Index Cond: (c1 = b2t1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+
+ Aggregate
+ -> Nested Loop
+ Join Filter: (b3t1.c1 = b3t4.c1)
+ -> Nested Loop
+ -> Nested Loop
+ -> Nested Loop
+ -> Seq Scan on r3_
+ Filter: ((ctid = '(1,1)'::tid) AND (c1 = 1))
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Index Scan using t1_pkey on t1 b3t1
+ Index Cond: (c1 = b3t3.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t2 b3t2
+ Recheck Cond: (c1 = b3t1.c1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on t2_pkey
+ Index Cond: (c1 = b3t1.c1)
+ -> Seq Scan on t4 b3t4
+ Filter: (ctid = '(1,1)'::tid)
+(62 rows)
+
+----
+---- No. S-2-4 VALUES clause
+----
+-- No. S-2-4-1
+EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1')) AS t1 (c1) WHERE t1.c1 = 1;
+ QUERY PLAN
+---------------------------
+ Values Scan on "*VALUES*"
+ Filter: (column1 = 1)
+(2 rows)
+
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1')) AS t1 (c1) WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+SeqScan(t1)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------
+ Values Scan on "*VALUES*"
+ Filter: (column1 = 1)
+(2 rows)
+
+/*+SeqScan(*VALUES*)*/
+EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1')) AS t1 (c1) WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+SeqScan(*VALUES*)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------
+ Values Scan on "*VALUES*"
+ Filter: (column1 = 1)
+(2 rows)
+
+-- No. S-2-4-2
+EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1')) AS t1 (c1, c2, c3, c4), (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t2 (c1, c2) WHERE t1.c1 = t2.c1;
+ QUERY PLAN
+----------------------------------------------------------
+ Nested Loop
+ Join Filter: ("*VALUES*".column1 = "*VALUES*".column1)
+ -> Values Scan on "*VALUES*"
+ -> Values Scan on "*VALUES*"
+(4 rows)
+
+/*+SeqScan(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1')) AS t1 (c1, c2, c3, c4), (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t2 (c1, c2) WHERE t1.c1 = t2.c1;
+INFO: hint syntax error at or near "t2)"
+DETAIL: Closing parenthesis is necessary.
+ QUERY PLAN
+----------------------------------------------------------
+ Nested Loop
+ Join Filter: ("*VALUES*".column1 = "*VALUES*".column1)
+ -> Values Scan on "*VALUES*"
+ -> Values Scan on "*VALUES*"
+(4 rows)
+
+/*+SeqScan(*VALUES*)*/
+EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1')) AS t1 (c1, c2, c3, c4), (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t2 (c1, c2) WHERE t1.c1 = t2.c1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+SeqScan(*VALUES*)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------------------
+ Nested Loop
+ Join Filter: ("*VALUES*".column1 = "*VALUES*".column1)
+ -> Values Scan on "*VALUES*"
+ -> Values Scan on "*VALUES*"
+(4 rows)
+
+----
+---- No. S-3-1 scan method hint
+----
+-- No. S-3-1-1
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 >= 1;
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c1 >= 1)
+(2 rows)
+
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 >= 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c1 >= 1)
+(2 rows)
+
+-- No. S-3-1-2
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on t1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. S-3-1-3
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+/*+IndexScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+IndexScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. S-3-1-4
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 >= 1;
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c1 >= 1)
+(2 rows)
+
+/*+IndexScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 >= 1;
+LOG: pg_hint_plan:
+used hint:
+IndexScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 >= 1)
+(2 rows)
+
+-- No. S-3-1-5
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c3 < 10;
+ QUERY PLAN
+---------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c3 < 10)
+ -> Bitmap Index Scan on t1_i
+ Index Cond: (c3 < 10)
+(4 rows)
+
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c3 < 10;
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c3 < 10)
+ -> Bitmap Index Scan on t1_i
+ Index Cond: (c3 < 10)
+(4 rows)
+
+-- No. S-3-1-6
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 = 1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 = 1)
+(4 rows)
+
+-- No. S-3-1-7
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(3 rows)
+
+/*+TidScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+TidScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(3 rows)
+
+-- No. S-3-1-8
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid IN ('(1,1)', '(2,2)', '(3,3)');
+ QUERY PLAN
+-------------------------------------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+ Filter: (ctid = ANY ('{"(1,1)","(2,2)","(3,3)"}'::tid[]))
+(3 rows)
+
+/*+TidScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid IN ('(1,1)', '(2,2)', '(3,3)');
+LOG: pg_hint_plan:
+used hint:
+TidScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------
+ Tid Scan on t1
+ TID Cond: (ctid = ANY ('{"(1,1)","(2,2)","(3,3)"}'::tid[]))
+ Filter: (c1 = 1)
+(3 rows)
+
+-- No. S-3-1-9
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 >= 1;
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c1 >= 1)
+(2 rows)
+
+/*+NoSeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 >= 1;
+LOG: pg_hint_plan:
+used hint:
+NoSeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 >= 1)
+(2 rows)
+
+-- No. S-3-1-10
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+/*+NoSeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+NoSeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. S-3-1-11
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+/*+NoIndexScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+NoIndexScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c1 = 1)
+ -> Bitmap Index Scan on t1_i1
+ Index Cond: (c1 = 1)
+(4 rows)
+
+-- No. S-3-1-12
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 >= 1;
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c1 >= 1)
+(2 rows)
+
+/*+NoIndexScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 >= 1;
+LOG: pg_hint_plan:
+used hint:
+NoIndexScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c1 >= 1)
+(2 rows)
+
+-- No. S-3-1-13
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c3 < 10;
+ QUERY PLAN
+---------------------------------
+ Bitmap Heap Scan on t1
+ Recheck Cond: (c3 < 10)
+ -> Bitmap Index Scan on t1_i
+ Index Cond: (c3 < 10)
+(4 rows)
+
+/*+NoBitmapScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c3 < 10;
+LOG: pg_hint_plan:
+used hint:
+NoBitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c3 < 10)
+(2 rows)
+
+-- No. S-3-1-14
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+/*+NoBitmapScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+NoBitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. S-3-1-15
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(3 rows)
+
+/*+NoTidScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoTidScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+ Filter: (ctid = '(1,1)'::tid)
+(3 rows)
+
+-- No. S-3-1-16
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+/*+NoTidScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+NoTidScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. S-3-1-17
+EXPLAIN (COSTS false) SELECT c1 FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+-----------------------------------
+ Index Only Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+/*+IndexOnlyScan(t1)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+IndexOnlyScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------
+ Index Only Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. S-3-1-18
+EXPLAIN (COSTS false) SELECT c1 FROM s1.t1 WHERE t1.c1 >= 1;
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c1 >= 1)
+(2 rows)
+
+/*+IndexOnlyScan(t1)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.t1 WHERE t1.c1 >= 1;
+LOG: pg_hint_plan:
+used hint:
+IndexOnlyScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------
+ Index Only Scan using t1_i1 on t1
+ Index Cond: (c1 >= 1)
+(2 rows)
+
+-- No. S-3-1-19
+EXPLAIN (COSTS false) SELECT c1 FROM s1.t1 WHERE t1.c1 = 1;
+ QUERY PLAN
+-----------------------------------
+ Index Only Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+/*+NoIndexOnlyScan(t1)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.t1 WHERE t1.c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+NoIndexOnlyScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------
+ Index Scan using t1_i1 on t1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. S-3-1-20
+EXPLAIN (COSTS false) SELECT c1 FROM s1.t1 WHERE t1.c1 >= 1;
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c1 >= 1)
+(2 rows)
+
+/*+NoIndexOnlyScan(t1)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.t1 WHERE t1.c1 >= 1;
+LOG: pg_hint_plan:
+used hint:
+NoIndexOnlyScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------
+ Seq Scan on t1
+ Filter: (c1 >= 1)
+(2 rows)
+
+----
+---- No. S-3-3 index name specified
+----
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE ti1.c2 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on ti1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c2 = 1)
+(3 rows)
+
+SET enable_tidscan TO off;
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE ti1.c2 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+---------------------------------
+ Index Scan using ti1_i2 on ti1
+ Index Cond: (c2 = 1)
+ Filter: (ctid = '(1,1)'::tid)
+(3 rows)
+
+SET enable_indexscan TO off;
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE ti1.c2 = 1 AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------
+ Bitmap Heap Scan on ti1
+ Recheck Cond: (c2 = 1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on ti1_i2
+ Index Cond: (c2 = 1)
+(5 rows)
+
+RESET enable_tidscan;
+RESET enable_indexscan;
+EXPLAIN (COSTS false) SELECT c2 FROM s1.ti1 WHERE ti1.c2 >= 1;
+ QUERY PLAN
+---------------------
+ Seq Scan on ti1
+ Filter: (c2 >= 1)
+(2 rows)
+
+-- No. S-3-3-1
+/*+IndexScan(ti1 ti1_i3)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE ti1.c2 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(ti1 ti1_i3)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------
+ Index Scan using ti1_i3 on ti1
+ Index Cond: (c2 = 1)
+ Filter: (ctid = '(1,1)'::tid)
+(3 rows)
+
+-- No. S-3-3-2
+/*+IndexScan(ti1 ti1_i3 ti1_i2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE ti1.c2 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(ti1 ti1_i3 ti1_i2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------
+ Index Scan using ti1_i2 on ti1
+ Index Cond: (c2 = 1)
+ Filter: (ctid = '(1,1)'::tid)
+(3 rows)
+
+-- No. S-3-3-3
+/*+IndexScan(ti1 ti1_i4 ti1_i3 ti1_i2 ti1_i1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE ti1.c2 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(ti1 ti1_i4 ti1_i3 ti1_i2 ti1_i1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------
+ Index Scan using ti1_i2 on ti1
+ Index Cond: (c2 = 1)
+ Filter: (ctid = '(1,1)'::tid)
+(3 rows)
+
+-- No. S-3-3-4
+/*+BitmapScan(ti1 ti1_i3)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE ti1.c2 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(ti1 ti1_i3)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------
+ Bitmap Heap Scan on ti1
+ Recheck Cond: (c2 = 1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on ti1_i3
+ Index Cond: (c2 = 1)
+(5 rows)
+
+-- No. S-3-3-5
+/*+BitmapScan(ti1 ti1_i3 ti1_i2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE ti1.c2 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(ti1 ti1_i3 ti1_i2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------
+ Bitmap Heap Scan on ti1
+ Recheck Cond: (c2 = 1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on ti1_i2
+ Index Cond: (c2 = 1)
+(5 rows)
+
+-- No. S-3-3-6
+/*+BitmapScan(ti1 ti1_i4 ti1_i3 ti1_i2 ti1_i1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE ti1.c2 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(ti1 ti1_i4 ti1_i3 ti1_i2 ti1_i1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------
+ Bitmap Heap Scan on ti1
+ Recheck Cond: (c2 = 1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on ti1_i2
+ Index Cond: (c2 = 1)
+(5 rows)
+
+-- No. S-3-3-7
+/*+IndexOnlyScan(ti1 ti1_i3)*/
+EXPLAIN (COSTS false) SELECT c2 FROM s1.ti1 WHERE ti1.c2 >= 1;
+LOG: pg_hint_plan:
+used hint:
+IndexOnlyScan(ti1 ti1_i3)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------
+ Index Only Scan using ti1_i3 on ti1
+ Index Cond: (c2 >= 1)
+(2 rows)
+
+-- No. S-3-3-8
+/*+IndexOnlyScan(ti1 ti1_i3 ti1_i2)*/
+EXPLAIN (COSTS false) SELECT c2 FROM s1.ti1 WHERE ti1.c2 >= 1;
+LOG: pg_hint_plan:
+used hint:
+IndexOnlyScan(ti1 ti1_i3 ti1_i2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------
+ Index Only Scan using ti1_i2 on ti1
+ Index Cond: (c2 >= 1)
+(2 rows)
+
+-- No. S-3-3-9
+/*+IndexOnlyScan(ti1 ti1_i4 ti1_i3 ti1_i2 ti1_i1)*/
+EXPLAIN (COSTS false) SELECT c2 FROM s1.ti1 WHERE ti1.c2 >= 1;
+LOG: pg_hint_plan:
+used hint:
+IndexOnlyScan(ti1 ti1_i4 ti1_i3 ti1_i2 ti1_i1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------
+ Index Only Scan using ti1_i1 on ti1
+ Index Cond: (c2 >= 1)
+(2 rows)
+
+----
+---- No. S-3-4 index type
+----
+\d s1.ti1
+ Table "s1.ti1"
+ Column | Type | Modifiers
+--------+---------+-----------
+ c1 | integer | not null
+ c2 | integer |
+ c3 | integer |
+ c4 | text |
+Indexes:
+ "ti1_pkey" PRIMARY KEY, btree (c1)
+ "ti1_c2_key" UNIQUE CONSTRAINT, btree (c2)
+ "ti1_uniq" UNIQUE, btree (c1)
+ "ti1_btree" btree (c1)
+ "ti1_expr" btree ((c1 < 100))
+ "ti1_gin" gin (c1)
+ "ti1_gist" gist (c1)
+ "ti1_hash" hash (c1)
+ "ti1_i1" btree (c2)
+ "ti1_i2" btree (c2, c4)
+ "ti1_i3" btree (c2, c4, c4)
+ "ti1_i4" btree (c2, c4, c4, c4)
+ "ti1_multi" btree (c1, c2, c3, c4)
+ "ti1_pred" btree (lower(c4))
+ "ti1_ts" gin (to_tsvector('english'::regconfig, c4))
+
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------------------------------------------------------------------------------------------------
+ Tid Scan on ti1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 < 100) AND (c2 = 1) AND (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery) AND (lower(c4) = '1'::text))
+(3 rows)
+
+-- No. S-3-4-1
+/*+IndexScan(ti1 ti1_btree)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(ti1 ti1_btree)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------------------------------------------------------------------------------------------------------------
+ Index Scan using ti1_btree on ti1
+ Index Cond: (c1 < 100)
+ Filter: ((c2 = 1) AND (ctid = '(1,1)'::tid) AND (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery) AND (lower(c4) = '1'::text))
+(3 rows)
+
+-- No. S-3-4-2
+/*+IndexScan(ti1 ti1_hash)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(ti1 ti1_hash)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------------------------------------------------------------------------------------------------------------
+ Index Scan using ti1_hash on ti1
+ Index Cond: (c1 = 100)
+ Filter: ((c2 = 1) AND (ctid = '(1,1)'::tid) AND (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery) AND (lower(c4) = '1'::text))
+(3 rows)
+
+-- No. S-3-4-3
+/*+IndexScan(ti1 ti1_gist)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(ti1 ti1_gist)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------------------------------------------------------------------------------------------------------------
+ Index Scan using ti1_gist on ti1
+ Index Cond: (c1 < 100)
+ Filter: ((c2 = 1) AND (ctid = '(1,1)'::tid) AND (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery) AND (lower(c4) = '1'::text))
+(3 rows)
+
+-- No. S-3-4-4
+/*+IndexScan(ti1 ti1_gin)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(ti1 ti1_gin)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------------------------------------------------------------------
+ Tid Scan on ti1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 < 100) AND (c2 = 1) AND (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery) AND (lower(c4) = '1'::text))
+(3 rows)
+
+-- No. S-3-4-5
+/*+IndexScan(ti1 ti1_expr)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(ti1 ti1_expr)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------
+ Index Scan using ti1_expr on ti1
+ Index Cond: ((c1 < 100) = true)
+ Filter: ((c1 < 100) AND (c2 = 1) AND (ctid = '(1,1)'::tid) AND (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery) AND (lower(c4) = '1'::text))
+(3 rows)
+
+-- No. S-3-4-6
+/*+IndexScan(ti1 ti1_pred)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(ti1 ti1_pred)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------------------------------------------------------------------------------
+ Index Scan using ti1_pred on ti1
+ Index Cond: (lower(c4) = '1'::text)
+ Filter: ((c1 < 100) AND (c2 = 1) AND (ctid = '(1,1)'::tid) AND (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery))
+(3 rows)
+
+-- No. S-3-4-7
+/*+IndexScan(ti1 ti1_uniq)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(ti1 ti1_uniq)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------------------------------------------------------------------------------------------------------------
+ Index Scan using ti1_uniq on ti1
+ Index Cond: (c1 < 100)
+ Filter: ((c2 = 1) AND (ctid = '(1,1)'::tid) AND (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery) AND (lower(c4) = '1'::text))
+(3 rows)
+
+-- No. S-3-4-8
+/*+IndexScan(ti1 ti1_multi)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(ti1 ti1_multi)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------------------------------------------------------------------------------
+ Index Scan using ti1_multi on ti1
+ Index Cond: ((c1 < 100) AND (c2 = 1))
+ Filter: ((ctid = '(1,1)'::tid) AND (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery) AND (lower(c4) = '1'::text))
+(3 rows)
+
+-- No. S-3-4-9
+/*+IndexScan(ti1 ti1_ts)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(ti1 ti1_ts)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------------------------------------------------------------------------
+ Tid Scan on ti1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: ((c1 < 100) AND (c2 = 1) AND (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery) AND (lower(c4) = '1'::text))
+(3 rows)
+
+-- No. S-3-4-10
+/*+IndexScan(ti1 ti1_pkey)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(ti1 ti1_pkey)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------------------------------------------------------------------------------------------------------------
+ Index Scan using ti1_pkey on ti1
+ Index Cond: (c1 < 100)
+ Filter: ((c2 = 1) AND (ctid = '(1,1)'::tid) AND (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery) AND (lower(c4) = '1'::text))
+(3 rows)
+
+-- No. S-3-4-11
+/*+IndexScan(ti1 ti1_c2_key)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(ti1 ti1_c2_key)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------------------------------------------------------------------------------------------------------
+ Index Scan using ti1_c2_key on ti1
+ Index Cond: (c2 = 1)
+ Filter: ((c1 < 100) AND (ctid = '(1,1)'::tid) AND (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery) AND (lower(c4) = '1'::text))
+(3 rows)
+
+-- No. S-3-4-12
+/*+BitmapScan(ti1 ti1_btree)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(ti1 ti1_btree)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------------------------------------------------------------------------------------------------------------
+ Bitmap Heap Scan on ti1
+ Recheck Cond: (c1 < 100)
+ Filter: ((c2 = 1) AND (ctid = '(1,1)'::tid) AND (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery) AND (lower(c4) = '1'::text))
+ -> Bitmap Index Scan on ti1_btree
+ Index Cond: (c1 < 100)
+(5 rows)
+
+-- No. S-3-4-13
+/*+BitmapScan(ti1 ti1_hash)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(ti1 ti1_hash)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------------------------------------------------------------------------------------------------------------
+ Bitmap Heap Scan on ti1
+ Recheck Cond: (c1 = 100)
+ Filter: ((c2 = 1) AND (ctid = '(1,1)'::tid) AND (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery) AND (lower(c4) = '1'::text))
+ -> Bitmap Index Scan on ti1_hash
+ Index Cond: (c1 = 100)
+(5 rows)
+
+-- No. S-3-4-14
+/*+BitmapScan(ti1 ti1_gist)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(ti1 ti1_gist)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------------------------------------------------------------------------------------------------------------
+ Bitmap Heap Scan on ti1
+ Recheck Cond: (c1 < 100)
+ Filter: ((c2 = 1) AND (ctid = '(1,1)'::tid) AND (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery) AND (lower(c4) = '1'::text))
+ -> Bitmap Index Scan on ti1_gist
+ Index Cond: (c1 < 100)
+(5 rows)
+
+-- No. S-3-4-15
+/*+BitmapScan(ti1 ti1_gin)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(ti1 ti1_gin)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------------------------------------------------------------------------------------------------------------
+ Bitmap Heap Scan on ti1
+ Recheck Cond: (c1 < 100)
+ Filter: ((c2 = 1) AND (ctid = '(1,1)'::tid) AND (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery) AND (lower(c4) = '1'::text))
+ -> Bitmap Index Scan on ti1_gin
+ Index Cond: (c1 < 100)
+(5 rows)
+
+-- No. S-3-4-16
+/*+BitmapScan(ti1 ti1_expr)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(ti1 ti1_expr)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------
+ Bitmap Heap Scan on ti1
+ Filter: ((c1 < 100) AND (c2 = 1) AND (ctid = '(1,1)'::tid) AND (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery) AND (lower(c4) = '1'::text))
+ -> Bitmap Index Scan on ti1_expr
+ Index Cond: ((c1 < 100) = true)
+(4 rows)
+
+-- No. S-3-4-17
+/*+BitmapScan(ti1 ti1_pred)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(ti1 ti1_pred)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------------------------------------------------------------------------------
+ Bitmap Heap Scan on ti1
+ Recheck Cond: (lower(c4) = '1'::text)
+ Filter: ((c1 < 100) AND (c2 = 1) AND (ctid = '(1,1)'::tid) AND (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery))
+ -> Bitmap Index Scan on ti1_pred
+ Index Cond: (lower(c4) = '1'::text)
+(5 rows)
+
+-- No. S-3-4-18
+/*+BitmapScan(ti1 ti1_uniq)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(ti1 ti1_uniq)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------------------------------------------------------------------------------------------------------------
+ Bitmap Heap Scan on ti1
+ Recheck Cond: (c1 < 100)
+ Filter: ((c2 = 1) AND (ctid = '(1,1)'::tid) AND (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery) AND (lower(c4) = '1'::text))
+ -> Bitmap Index Scan on ti1_uniq
+ Index Cond: (c1 < 100)
+(5 rows)
+
+-- No. S-3-4-19
+/*+BitmapScan(ti1 ti1_multi)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(ti1 ti1_multi)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------------------------------------------------------------------------------
+ Bitmap Heap Scan on ti1
+ Recheck Cond: ((c1 < 100) AND (c2 = 1))
+ Filter: ((ctid = '(1,1)'::tid) AND (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery) AND (lower(c4) = '1'::text))
+ -> Bitmap Index Scan on ti1_multi
+ Index Cond: ((c1 < 100) AND (c2 = 1))
+(5 rows)
+
+-- No. S-3-4-20
+/*+BitmapScan(ti1 ti1_ts)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(ti1 ti1_ts)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------------------------------------------
+ Bitmap Heap Scan on ti1
+ Recheck Cond: (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery)
+ Filter: ((c1 < 100) AND (c2 = 1) AND (ctid = '(1,1)'::tid) AND (lower(c4) = '1'::text))
+ -> Bitmap Index Scan on ti1_ts
+ Index Cond: (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery)
+(5 rows)
+
+-- No. S-3-4-10
+/*+BitmapScan(ti1 ti1_pkey)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(ti1 ti1_pkey)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------------------------------------------------------------------------------------------------------------
+ Bitmap Heap Scan on ti1
+ Recheck Cond: (c1 < 100)
+ Filter: ((c2 = 1) AND (ctid = '(1,1)'::tid) AND (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery) AND (lower(c4) = '1'::text))
+ -> Bitmap Index Scan on ti1_pkey
+ Index Cond: (c1 < 100)
+(5 rows)
+
+-- No. S-3-4-11
+/*+BitmapScan(ti1 ti1_c2_key)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(ti1 ti1_c2_key)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------------------------------------------------------------------------------------------------------
+ Bitmap Heap Scan on ti1
+ Recheck Cond: (c2 = 1)
+ Filter: ((c1 < 100) AND (ctid = '(1,1)'::tid) AND (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery) AND (lower(c4) = '1'::text))
+ -> Bitmap Index Scan on ti1_c2_key
+ Index Cond: (c2 = 1)
+(5 rows)
+
+-- No. S-3-4-23
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 >= 1;
+ QUERY PLAN
+---------------------
+ Seq Scan on ti1
+ Filter: (c1 >= 1)
+(2 rows)
+
+/*+IndexOnlyScan(ti1 ti1_btree)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 >= 1;
+LOG: pg_hint_plan:
+used hint:
+IndexOnlyScan(ti1 ti1_btree)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------
+ Index Only Scan using ti1_btree on ti1
+ Index Cond: (c1 >= 1)
+(2 rows)
+
+-- No. S-3-4-24
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 = 1;
+ QUERY PLAN
+---------------------------------------
+ Index Only Scan using ti1_uniq on ti1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+/*+IndexOnlyScan(ti1 ti1_hash)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+IndexOnlyScan(ti1 ti1_hash)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Index Scan using ti1_hash on ti1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. S-3-4-25
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 < 1;
+ QUERY PLAN
+---------------------------------------
+ Index Only Scan using ti1_uniq on ti1
+ Index Cond: (c1 < 1)
+(2 rows)
+
+/*+IndexOnlyScan(ti1 ti1_gist)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 < 1;
+LOG: pg_hint_plan:
+used hint:
+IndexOnlyScan(ti1 ti1_gist)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Index Scan using ti1_gist on ti1
+ Index Cond: (c1 < 1)
+(2 rows)
+
+-- No. S-3-4-26
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 = 1;
+ QUERY PLAN
+---------------------------------------
+ Index Only Scan using ti1_uniq on ti1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+/*+IndexOnlyScan(ti1 ti1_gin)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+IndexOnlyScan(ti1 ti1_gin)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------
+ Seq Scan on ti1
+ Filter: (c1 = 1)
+(2 rows)
+
+-- No. S-3-4-27
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 < 100;
+ QUERY PLAN
+---------------------------------------
+ Index Only Scan using ti1_uniq on ti1
+ Index Cond: (c1 < 100)
+(2 rows)
+
+/*+IndexOnlyScan(ti1 ti1_expr)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 < 100;
+LOG: pg_hint_plan:
+used hint:
+IndexOnlyScan(ti1 ti1_expr)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------
+ Index Scan using ti1_expr on ti1
+ Index Cond: ((c1 < 100) = true)
+ Filter: (c1 < 100)
+(3 rows)
+
+-- No. S-3-4-28
+EXPLAIN (COSTS false) SELECT c4 FROM s1.ti1 WHERE lower(c4) >= '1';
+ QUERY PLAN
+------------------------------------
+ Seq Scan on ti1
+ Filter: (lower(c4) >= '1'::text)
+(2 rows)
+
+/*+IndexOnlyScan(ti1 ti1_pred)*/
+EXPLAIN (COSTS false) SELECT c4 FROM s1.ti1 WHERE lower(c4) >= '1';
+LOG: pg_hint_plan:
+used hint:
+IndexOnlyScan(ti1 ti1_pred)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------
+ Index Scan using ti1_pred on ti1
+ Index Cond: (lower(c4) >= '1'::text)
+(2 rows)
+
+-- No. S-3-4-29
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 >= 1;
+ QUERY PLAN
+---------------------
+ Seq Scan on ti1
+ Filter: (c1 >= 1)
+(2 rows)
+
+/*+IndexOnlyScan(ti1 ti1_uniq)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 >= 1;
+LOG: pg_hint_plan:
+used hint:
+IndexOnlyScan(ti1 ti1_uniq)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------
+ Index Only Scan using ti1_uniq on ti1
+ Index Cond: (c1 >= 1)
+(2 rows)
+
+-- No. S-3-4-30
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 >= 1;
+ QUERY PLAN
+---------------------
+ Seq Scan on ti1
+ Filter: (c1 >= 1)
+(2 rows)
+
+/*+IndexOnlyScan(ti1 ti1_multi)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 >= 1;
+LOG: pg_hint_plan:
+used hint:
+IndexOnlyScan(ti1 ti1_multi)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------
+ Index Only Scan using ti1_multi on ti1
+ Index Cond: (c1 >= 1)
+(2 rows)
+
+-- No. S-3-4-31
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE to_tsvector('english', c4) @@ 'a & b';
+ QUERY PLAN
+-----------------------------------------------------------------------------------------
+ Bitmap Heap Scan on ti1
+ Recheck Cond: (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery)
+ -> Bitmap Index Scan on ti1_ts
+ Index Cond: (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery)
+(4 rows)
+
+/*+IndexOnlyScan(ti1 ti1_ts)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE to_tsvector('english', c4) @@ 'a & b';
+LOG: pg_hint_plan:
+used hint:
+IndexOnlyScan(ti1 ti1_ts)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------------------------------
+ Seq Scan on ti1
+ Filter: (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery)
+(2 rows)
+
+-- No. S-3-4-32
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 >= 1;
+ QUERY PLAN
+---------------------
+ Seq Scan on ti1
+ Filter: (c1 >= 1)
+(2 rows)
+
+/*+IndexOnlyScan(ti1 ti1_pkey)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 >= 1;
+LOG: pg_hint_plan:
+used hint:
+IndexOnlyScan(ti1 ti1_pkey)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------
+ Index Only Scan using ti1_pkey on ti1
+ Index Cond: (c1 >= 1)
+(2 rows)
+
+-- No. S-3-4-33
+EXPLAIN (COSTS false) SELECT c2 FROM s1.ti1 WHERE c2 >= 1;
+ QUERY PLAN
+---------------------
+ Seq Scan on ti1
+ Filter: (c2 >= 1)
+(2 rows)
+
+/*+IndexOnlyScan(ti1 ti1_c2_key)*/
+EXPLAIN (COSTS false) SELECT c2 FROM s1.ti1 WHERE c2 >= 1;
+LOG: pg_hint_plan:
+used hint:
+IndexOnlyScan(ti1 ti1_c2_key)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Index Only Scan using ti1_c2_key on ti1
+ Index Cond: (c2 >= 1)
+(2 rows)
+
+----
+---- No. S-3-5 not used index
+----
+-- No. S-3-5-1
+/*+IndexScan(ti1 ti1_pred)*/
+EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100;
+LOG: pg_hint_plan:
+used hint:
+IndexScan(ti1 ti1_pred)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------------------------
+ Seq Scan on ti1 (cost=10000000000.00..10000000018.50 rows=1 width=15)
+ Filter: (c1 = 100)
+(2 rows)
+
+-- No. S-3-5-2
+/*+BitmapScan(ti1 ti1_pred)*/
+EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100;
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(ti1 ti1_pred)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------------------------
+ Seq Scan on ti1 (cost=10000000000.00..10000000018.50 rows=1 width=15)
+ Filter: (c1 = 100)
+(2 rows)
+
+-- No. S-3-5-3
+/*+IndexOnlyScan(ti1 ti1_pred)*/
+EXPLAIN (COSTS true) SELECT c1 FROM s1.ti1 WHERE c1 = 100;
+LOG: pg_hint_plan:
+used hint:
+IndexOnlyScan(ti1 ti1_pred)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------
+ Seq Scan on ti1 (cost=10000000000.00..10000000018.50 rows=1 width=4)
+ Filter: (c1 = 100)
+(2 rows)
+
+----
+---- No. S-3-6 not exist index
+----
+-- No. S-3-6-1
+/*+IndexScan(ti1 not_exist)*/
+EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100;
+LOG: pg_hint_plan:
+used hint:
+IndexScan(ti1 not_exist)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------------------------
+ Seq Scan on ti1 (cost=10000000000.00..10000000018.50 rows=1 width=15)
+ Filter: (c1 = 100)
+(2 rows)
+
+-- No. S-3-6-2
+/*+BitmapScan(ti1 not_exist)*/
+EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100;
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(ti1 not_exist)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------------------------
+ Seq Scan on ti1 (cost=10000000000.00..10000000018.50 rows=1 width=15)
+ Filter: (c1 = 100)
+(2 rows)
+
+-- No. S-3-6-3
+/*+IndexOnlyScan(ti1 not_exist)*/
+EXPLAIN (COSTS true) SELECT c1 FROM s1.ti1 WHERE c1 = 100;
+LOG: pg_hint_plan:
+used hint:
+IndexOnlyScan(ti1 not_exist)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------------------------------------
+ Seq Scan on ti1 (cost=10000000000.00..10000000018.50 rows=1 width=4)
+ Filter: (c1 = 100)
+(2 rows)
+
+----
+---- No. S-3-7 query structure
+----
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1 AND t1.ctid = '(1,1)';
+ QUERY PLAN
+-----------------------------------------------
+ Hash Join
+ Hash Cond: (t2.c1 = t1.c1)
+ -> Seq Scan on t2
+ -> Hash
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+(6 rows)
+
+-- No. S-3-7-1
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE c1 = 100;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------
+ Seq Scan on t1
+ Filter: (c1 = 100)
+(2 rows)
+
+-- No. S-3-7-2
+/*+SeqScan(t1)BitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1 AND t1.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+BitmapScan(t2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------
+ Nested Loop
+ -> Seq Scan on t1
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Heap Scan on t2
+ Recheck Cond: (c1 = t1.c1)
+ -> Bitmap Index Scan on t2_i1
+ Index Cond: (c1 = t1.c1)
+(7 rows)
+
+-- No. S-3-7-3
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1 AND t1.ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------
+ Hash Join
+ Hash Cond: (t2.c1 = t1.c1)
+ -> Seq Scan on t2
+ -> Hash
+ -> Seq Scan on t1
+ Filter: (ctid = '(1,1)'::tid)
+(6 rows)
+
+----
+---- No. S-3-8 query structure
+----
+-- No. S-3-8-1
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1 WHERE b1t1.c1 = 1)
+SELECT max(b3t1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.c1 = 1
+ ) FROM s1.t1 b3t1 WHERE b3t1.c1 = (
+SELECT max(b4t1.c1) FROM s1.t1 b4t1 WHERE b4t1.c1 = 1);
+ QUERY PLAN
+---------------------------------------------------------------------
+ Result
+ InitPlan 2 (returns $1)
+ -> Result
+ InitPlan 1 (returns $0)
+ -> Limit
+ -> Index Only Scan using t1_i1 on t1 b2t1
+ Index Cond: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 4 (returns $3)
+ -> Result
+ InitPlan 3 (returns $2)
+ -> Limit
+ -> Index Only Scan using t1_i1 on t1 b4t1
+ Index Cond: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 5 (returns $4)
+ -> Limit
+ -> Index Only Scan using t1_i1 on t1 b3t1
+ Index Cond: ((c1 IS NOT NULL) AND (c1 = $3))
+(17 rows)
+
+/*+SeqScan(b1t1)IndexScan(b2t1 t1_pkey)BitmapScan(b3t1 t1_pkey)TidScan(b4t1)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1 WHERE b1t1.c1 = 1)
+SELECT max(b3t1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.c1 = 1
+ ) FROM s1.t1 b3t1 WHERE b3t1.c1 = (
+SELECT max(b4t1.c1) FROM s1.t1 b4t1 WHERE b4t1.c1 = 1);
+LOG: pg_hint_plan:
+used hint:
+IndexScan(b2t1 t1_pkey)
+BitmapScan(b3t1 t1_pkey)
+TidScan(b4t1)
+not used hint:
+SeqScan(b1t1)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------------
+ Result
+ InitPlan 2 (returns $1)
+ -> Result
+ InitPlan 1 (returns $0)
+ -> Limit
+ -> Index Scan using t1_pkey on t1 b2t1
+ Index Cond: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 4 (returns $3)
+ -> Result
+ InitPlan 3 (returns $2)
+ -> Limit
+ -> Seq Scan on t1 b4t1
+ Filter: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 5 (returns $4)
+ -> Limit
+ -> Bitmap Heap Scan on t1 b3t1
+ Recheck Cond: ((c1 IS NOT NULL) AND (c1 = $3))
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: ((c1 IS NOT NULL) AND (c1 = $3))
+(19 rows)
+
+-- No. S-3-8-2
+EXPLAIN (COSTS false)
+WITH cte1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1 JOIN s1.t2 b1t2 ON(b1t1.c1 = b1t2.c1) WHERE b1t1.c1 = 1)
+SELECT max(b3t1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 JOIN s1.t2 b2t2 ON(b2t1.c1 = b2t2.c1) WHERE b2t1.c1 = 1
+ ) FROM s1.t1 b3t1 JOIN s1.t2 b3t2 ON(b3t1.c1 = b3t2.c1) JOIN cte1 ON(b3t1.c1 = cte1.c1) WHERE b3t1.c1 = (
+SELECT max(b4t1.c1) FROM s1.t1 b4t1 JOIN s1.t2 b4t2 ON(b4t1.c1 = b4t2.c1) WHERE b4t1.c1 = 1);
+ QUERY PLAN
+------------------------------------------------------------
+ Aggregate
+ CTE cte1
+ -> Aggregate
+ -> Nested Loop
+ -> Index Only Scan using t1_i1 on t1 b1t1
+ Index Cond: (c1 = 1)
+ -> Seq Scan on t2 b1t2
+ Filter: (c1 = 1)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ -> Index Only Scan using t1_i1 on t1 b2t1
+ Index Cond: (c1 = 1)
+ -> Seq Scan on t2 b2t2
+ Filter: (c1 = 1)
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Nested Loop
+ -> Index Only Scan using t1_i1 on t1 b4t1
+ Index Cond: (c1 = 1)
+ -> Seq Scan on t2 b4t2
+ Filter: (c1 = 1)
+ -> Nested Loop
+ -> Nested Loop
+ -> Index Only Scan using t1_i1 on t1 b3t1
+ Index Cond: (c1 = $2)
+ -> Seq Scan on t2 b3t2
+ Filter: (c1 = $2)
+ -> CTE Scan on cte1
+ Filter: (c1 = $2)
+(30 rows)
+
+/*+SeqScan(b1t1)IndexScan(b2t1 t1_pkey)BitmapScan(b3t1 t1_pkey)TidScan(b4t1)
+TidScan(b1t2)SeqScan(b2t2)IndexScan(b3t2 t2_pkey)BitmapScan(b4t2 t2_pkey)
+*/
+EXPLAIN (COSTS false)
+WITH cte1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1 JOIN s1.t2 b1t2 ON(b1t1.c1 = b1t2.c1) WHERE b1t1.c1 = 1)
+SELECT max(b3t1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 JOIN s1.t2 b2t2 ON(b2t1.c1 = b2t2.c1) WHERE b2t1.c1 = 1
+ ) FROM s1.t1 b3t1 JOIN s1.t2 b3t2 ON(b3t1.c1 = b3t2.c1) JOIN cte1 ON(b3t1.c1 = cte1.c1) WHERE b3t1.c1 = (
+SELECT max(b4t1.c1) FROM s1.t1 b4t1 JOIN s1.t2 b4t2 ON(b4t1.c1 = b4t2.c1) WHERE b4t1.c1 = 1);
+LOG: pg_hint_plan:
+used hint:
+SeqScan(b1t1)
+TidScan(b1t2)
+IndexScan(b2t1 t1_pkey)
+SeqScan(b2t2)
+BitmapScan(b3t1 t1_pkey)
+IndexScan(b3t2 t2_pkey)
+TidScan(b4t1)
+BitmapScan(b4t2 t2_pkey)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------
+ Aggregate
+ CTE cte1
+ -> Aggregate
+ -> Nested Loop
+ -> Seq Scan on t1 b1t1
+ Filter: (c1 = 1)
+ -> Seq Scan on t2 b1t2
+ Filter: (c1 = 1)
+ InitPlan 2 (returns $1)
+ -> Aggregate
+ -> Nested Loop
+ -> Index Scan using t1_pkey on t1 b2t1
+ Index Cond: (c1 = 1)
+ -> Seq Scan on t2 b2t2
+ Filter: (c1 = 1)
+ InitPlan 3 (returns $2)
+ -> Aggregate
+ -> Nested Loop
+ -> Seq Scan on t1 b4t1
+ Filter: (c1 = 1)
+ -> Bitmap Heap Scan on t2 b4t2
+ Recheck Cond: (c1 = 1)
+ -> Bitmap Index Scan on t2_pkey
+ Index Cond: (c1 = 1)
+ -> Nested Loop
+ -> Nested Loop
+ -> Bitmap Heap Scan on t1 b3t1
+ Recheck Cond: (c1 = $2)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: (c1 = $2)
+ -> Index Scan using t2_pkey on t2 b3t2
+ Index Cond: (c1 = $2)
+ -> CTE Scan on cte1
+ Filter: (c1 = $2)
+(34 rows)
+
+-- No. S-3-8-3
+EXPLAIN (COSTS false)
+WITH cte1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1 JOIN s1.t2 b1t2 ON(b1t1.c1 = b1t2.c1) WHERE b1t1.c1 = 1)
+SELECT max(b3t1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.c1 = 1
+ ) FROM s1.t1 b3t1 JOIN s1.t2 b3t2 ON(b3t1.c1 = b3t2.c1) JOIN cte1 ON(b3t1.c1 = cte1.c1) WHERE b3t1.c1 = (
+SELECT max(b4t1.c1) FROM s1.t1 b4t1 WHERE b4t1.c1 = 1);
+ QUERY PLAN
+---------------------------------------------------------------------
+ Aggregate
+ CTE cte1
+ -> Aggregate
+ -> Nested Loop
+ -> Index Only Scan using t1_i1 on t1 b1t1
+ Index Cond: (c1 = 1)
+ -> Seq Scan on t2 b1t2
+ Filter: (c1 = 1)
+ InitPlan 3 (returns $2)
+ -> Result
+ InitPlan 2 (returns $1)
+ -> Limit
+ -> Index Only Scan using t1_i1 on t1 b2t1
+ Index Cond: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 5 (returns $4)
+ -> Result
+ InitPlan 4 (returns $3)
+ -> Limit
+ -> Index Only Scan using t1_i1 on t1 b4t1
+ Index Cond: ((c1 IS NOT NULL) AND (c1 = 1))
+ -> Nested Loop
+ -> Nested Loop
+ -> Index Only Scan using t1_i1 on t1 b3t1
+ Index Cond: (c1 = $4)
+ -> Seq Scan on t2 b3t2
+ Filter: (c1 = $4)
+ -> CTE Scan on cte1
+ Filter: (c1 = $4)
+(28 rows)
+
+/*+SeqScan(b1t1)IndexScan(b2t1 t1_pkey)BitmapScan(b3t1 t1_pkey)TidScan(b4t1)
+TidScan(b1t2)IndexScan(b3t2 t2_pkey)
+*/
+EXPLAIN (COSTS false)
+WITH cte1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1 JOIN s1.t2 b1t2 ON(b1t1.c1 = b1t2.c1) WHERE b1t1.c1 = 1)
+SELECT max(b3t1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.c1 = 1
+ ) FROM s1.t1 b3t1 JOIN s1.t2 b3t2 ON(b3t1.c1 = b3t2.c1) JOIN cte1 ON(b3t1.c1 = cte1.c1) WHERE b3t1.c1 = (
+SELECT max(b4t1.c1) FROM s1.t1 b4t1 WHERE b4t1.c1 = 1);
+LOG: pg_hint_plan:
+used hint:
+SeqScan(b1t1)
+TidScan(b1t2)
+IndexScan(b2t1 t1_pkey)
+BitmapScan(b3t1 t1_pkey)
+IndexScan(b3t2 t2_pkey)
+TidScan(b4t1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------------------------------------
+ Aggregate
+ CTE cte1
+ -> Aggregate
+ -> Nested Loop
+ -> Seq Scan on t1 b1t1
+ Filter: (c1 = 1)
+ -> Seq Scan on t2 b1t2
+ Filter: (c1 = 1)
+ InitPlan 3 (returns $2)
+ -> Result
+ InitPlan 2 (returns $1)
+ -> Limit
+ -> Index Scan using t1_pkey on t1 b2t1
+ Index Cond: ((c1 IS NOT NULL) AND (c1 = 1))
+ InitPlan 5 (returns $4)
+ -> Result
+ InitPlan 4 (returns $3)
+ -> Limit
+ -> Seq Scan on t1 b4t1
+ Filter: ((c1 IS NOT NULL) AND (c1 = 1))
+ -> Nested Loop
+ -> Nested Loop
+ -> Bitmap Heap Scan on t1 b3t1
+ Recheck Cond: (c1 = $4)
+ -> Bitmap Index Scan on t1_pkey
+ Index Cond: (c1 = $4)
+ -> Index Scan using t2_pkey on t2 b3t2
+ Index Cond: (c1 = $4)
+ -> CTE Scan on cte1
+ Filter: (c1 = $4)
+(30 rows)
+
+----
+---- No. S-3-9 inheritance table select type
+----
+-- No. S-3-9-1
+EXPLAIN (COSTS false) SELECT * FROM ONLY s1.p1 WHERE c1 = 1;
+ QUERY PLAN
+--------------------
+ Seq Scan on p1
+ Filter: (c1 = 1)
+(2 rows)
+
+/*+IndexScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY s1.p1 WHERE c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+IndexScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------
+ Index Scan using p1_i on p1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. S-3-9-2
+EXPLAIN (COSTS false) SELECT * FROM s1.p1 WHERE c1 = 1;
+ QUERY PLAN
+---------------------------------
+ Result
+ -> Append
+ -> Seq Scan on p1
+ Filter: (c1 = 1)
+ -> Seq Scan on p1c1 p1
+ Filter: (c1 = 1)
+(6 rows)
+
+/*+IndexScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.p1 WHERE c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+IndexScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------
+ Result
+ -> Append
+ -> Index Scan using p1_i on p1
+ Index Cond: (c1 = 1)
+ -> Index Scan using p1c1_i on p1c1 p1
+ Index Cond: (c1 = 1)
+(6 rows)
+
+----
+---- No. S-3-10 inheritance table number
+----
+-- No. S-3-10-1
+EXPLAIN (COSTS false) SELECT * FROM s1.p1 WHERE c1 = 1;
+ QUERY PLAN
+---------------------------------
+ Result
+ -> Append
+ -> Seq Scan on p1
+ Filter: (c1 = 1)
+ -> Seq Scan on p1c1 p1
+ Filter: (c1 = 1)
+(6 rows)
+
+/*+IndexScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.p1 WHERE c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+IndexScan(p1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------
+ Result
+ -> Append
+ -> Index Scan using p1_i on p1
+ Index Cond: (c1 = 1)
+ -> Index Scan using p1c1_i on p1c1 p1
+ Index Cond: (c1 = 1)
+(6 rows)
+
+-- No. S-3-10-2
+EXPLAIN (COSTS false) SELECT * FROM s1.p2 WHERE c1 = 1;
+ QUERY PLAN
+-----------------------------------
+ Result
+ -> Append
+ -> Seq Scan on p2
+ Filter: (c1 = 1)
+ -> Seq Scan on p2c1 p2
+ Filter: (c1 = 1)
+ -> Seq Scan on p2c1c1 p2
+ Filter: (c1 = 1)
+(8 rows)
+
+/*+IndexScan(p2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.p2 WHERE c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+IndexScan(p2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------------
+ Result
+ -> Append
+ -> Index Scan using p2_i on p2
+ Index Cond: (c1 = 1)
+ -> Index Scan using p2c1_i on p2c1 p2
+ Index Cond: (c1 = 1)
+ -> Index Scan using p2c1c1_i on p2c1c1 p2
+ Index Cond: (c1 = 1)
+(8 rows)
+
+----
+---- No. S-3-11 inheritance table specified table
+----
+EXPLAIN (COSTS false) SELECT * FROM s1.p2 WHERE c1 = 1;
+ QUERY PLAN
+-----------------------------------
+ Result
+ -> Append
+ -> Seq Scan on p2
+ Filter: (c1 = 1)
+ -> Seq Scan on p2c1 p2
+ Filter: (c1 = 1)
+ -> Seq Scan on p2c1c1 p2
+ Filter: (c1 = 1)
+(8 rows)
+
+-- No. S-3-11-1
+/*+IndexScan(p2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.p2 WHERE c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+IndexScan(p2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------------
+ Result
+ -> Append
+ -> Index Scan using p2_i on p2
+ Index Cond: (c1 = 1)
+ -> Index Scan using p2c1_i on p2c1 p2
+ Index Cond: (c1 = 1)
+ -> Index Scan using p2c1c1_i on p2c1c1 p2
+ Index Cond: (c1 = 1)
+(8 rows)
+
+-- No. S-3-11-2
+/*+IndexScan(p2c1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.p2 WHERE c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+IndexScan(p2c1)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------
+ Result
+ -> Append
+ -> Seq Scan on p2
+ Filter: (c1 = 1)
+ -> Seq Scan on p2c1 p2
+ Filter: (c1 = 1)
+ -> Seq Scan on p2c1c1 p2
+ Filter: (c1 = 1)
+(8 rows)
+
+-- No. S-3-11-3
+/*+IndexScan(p2 p2_pkey p2c1_pkey p2c1c1_pkey)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.p2 WHERE c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+IndexScan(p2 p2_pkey p2c1_pkey p2c1c1_pkey)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------------------------
+ Result
+ -> Append
+ -> Index Scan using p2_pkey on p2
+ Index Cond: (c1 = 1)
+ -> Index Scan using p2c1_pkey on p2c1 p2
+ Index Cond: (c1 = 1)
+ -> Index Scan using p2c1c1_pkey on p2c1c1 p2
+ Index Cond: (c1 = 1)
+(8 rows)
+
+-- No. S-3-11-4
+/*+IndexScan(p2 p2c1_pkey)*/
+EXPLAIN (COSTS true) SELECT * FROM s1.p2 WHERE c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+IndexScan(p2 p2c1_pkey)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------------------------------------------
+ Result (cost=10000000000.00..20000000009.89 rows=3 width=34)
+ -> Append (cost=10000000000.00..20000000009.89 rows=3 width=34)
+ -> Seq Scan on p2 (cost=10000000000.00..10000000000.00 rows=1 width=44)
+ Filter: (c1 = 1)
+ -> Index Scan using p2c1_pkey on p2c1 p2 (cost=0.00..8.27 rows=1 width=44)
+ Index Cond: (c1 = 1)
+ -> Seq Scan on p2c1c1 p2 (cost=10000000000.00..10000000001.62 rows=1 width=14)
+ Filter: (c1 = 1)
+(8 rows)
+
+----
+---- No. S-3-12 specified same table
+----
+-- No. S-3-12-1
+/*+IndexScan(ti1) BitmapScan(ti1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+INFO: hint syntax error at or near "IndexScan(ti1) BitmapScan(ti1)"
+DETAIL: Conflict scan method hint.
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(ti1)
+not used hint:
+duplication hint:
+IndexScan(ti1)
+error hint:
+
+ QUERY PLAN
+-------------------------------------
+ Bitmap Heap Scan on ti1
+ Recheck Cond: (c1 = 1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on ti1_uniq
+ Index Cond: (c1 = 1)
+(5 rows)
+
+-- No. S-3-12-2
+/*+IndexScan(ti1 ti1_pkey) BitmapScan(ti1 ti1_btree)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+INFO: hint syntax error at or near "IndexScan(ti1 ti1_pkey) BitmapScan(ti1 ti1_btree)"
+DETAIL: Conflict scan method hint.
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(ti1 ti1_btree)
+not used hint:
+duplication hint:
+IndexScan(ti1 ti1_pkey)
+error hint:
+
+ QUERY PLAN
+--------------------------------------
+ Bitmap Heap Scan on ti1
+ Recheck Cond: (c1 = 1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on ti1_btree
+ Index Cond: (c1 = 1)
+(5 rows)
+
+-- No. S-3-12-3
+/*+BitmapScan(ti1) IndexScan(ti1) BitmapScan(ti1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+INFO: hint syntax error at or near "BitmapScan(ti1) IndexScan(ti1) BitmapScan(ti1)"
+DETAIL: Conflict scan method hint.
+INFO: hint syntax error at or near "IndexScan(ti1) BitmapScan(ti1)"
+DETAIL: Conflict scan method hint.
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(ti1)
+not used hint:
+duplication hint:
+BitmapScan(ti1)
+IndexScan(ti1)
+error hint:
+
+ QUERY PLAN
+-------------------------------------
+ Bitmap Heap Scan on ti1
+ Recheck Cond: (c1 = 1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on ti1_uniq
+ Index Cond: (c1 = 1)
+(5 rows)
+
+-- No. S-3-12-4
+/*+BitmapScan(ti1 ti1_hash) IndexScan(ti1 ti1_pkey) BitmapScan(ti1 ti1_btree)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+INFO: hint syntax error at or near "BitmapScan(ti1 ti1_hash) IndexScan(ti1 ti1_pkey) BitmapScan(ti1 ti1_btree)"
+DETAIL: Conflict scan method hint.
+INFO: hint syntax error at or near "IndexScan(ti1 ti1_pkey) BitmapScan(ti1 ti1_btree)"
+DETAIL: Conflict scan method hint.
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(ti1 ti1_btree)
+not used hint:
+duplication hint:
+BitmapScan(ti1 ti1_hash)
+IndexScan(ti1 ti1_pkey)
+error hint:
+
+ QUERY PLAN
+--------------------------------------
+ Bitmap Heap Scan on ti1
+ Recheck Cond: (c1 = 1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on ti1_btree
+ Index Cond: (c1 = 1)
+(5 rows)
+
+----
+---- No. S-3-13 message output
+----
+-- No. S-3-13-1
+/*+SeqScan(ti1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+SeqScan(ti1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------
+ Seq Scan on ti1
+ Filter: ((c1 = 1) AND (ctid = '(1,1)'::tid))
+(2 rows)
+
+-- No. S-3-13-2
+/*+SeqScan(ti1 ti1_pkey)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+INFO: hint syntax error at or near "ti1_pkey)"
+DETAIL: Closing parenthesis is necessary.
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on ti1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(3 rows)
+
+-- No. S-3-13-3
+/*+SeqScan(ti1 ti1_pkey ti1_btree)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+INFO: hint syntax error at or near "ti1_pkey ti1_btree)"
+DETAIL: Closing parenthesis is necessary.
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on ti1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(3 rows)
+
+-- No. S-3-13-4
+/*+IndexScan(ti1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(ti1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Index Scan using ti1_uniq on ti1
+ Index Cond: (c1 = 1)
+ Filter: (ctid = '(1,1)'::tid)
+(3 rows)
+
+-- No. S-3-13-5
+/*+IndexScan(ti1 ti1_pkey)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(ti1 ti1_pkey)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Index Scan using ti1_pkey on ti1
+ Index Cond: (c1 = 1)
+ Filter: (ctid = '(1,1)'::tid)
+(3 rows)
+
+-- No. S-3-13-6
+/*+IndexScan(ti1 ti1_pkey ti1_btree)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+IndexScan(ti1 ti1_pkey ti1_btree)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------
+ Index Scan using ti1_btree on ti1
+ Index Cond: (c1 = 1)
+ Filter: (ctid = '(1,1)'::tid)
+(3 rows)
+
+-- No. S-3-13-7
+/*+BitmapScan(ti1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(ti1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------
+ Bitmap Heap Scan on ti1
+ Recheck Cond: (c1 = 1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on ti1_uniq
+ Index Cond: (c1 = 1)
+(5 rows)
+
+-- No. S-3-13-8
+/*+BitmapScan(ti1 ti1_pkey)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(ti1 ti1_pkey)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-------------------------------------
+ Bitmap Heap Scan on ti1
+ Recheck Cond: (c1 = 1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on ti1_pkey
+ Index Cond: (c1 = 1)
+(5 rows)
+
+-- No. S-3-13-9
+/*+BitmapScan(ti1 ti1_pkey ti1_btree)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+BitmapScan(ti1 ti1_pkey ti1_btree)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------
+ Bitmap Heap Scan on ti1
+ Recheck Cond: (c1 = 1)
+ Filter: (ctid = '(1,1)'::tid)
+ -> Bitmap Index Scan on ti1_btree
+ Index Cond: (c1 = 1)
+(5 rows)
+
+-- No. S-3-13-10
+/*+TidScan(ti1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+TidScan(ti1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on ti1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(3 rows)
+
+-- No. S-3-13-11
+/*+TidScan(ti1 ti1_pkey)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+INFO: hint syntax error at or near "ti1_pkey)"
+DETAIL: Closing parenthesis is necessary.
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on ti1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(3 rows)
+
+-- No. S-3-13-12
+/*+TidScan(ti1 ti1_pkey ti1_btree)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+INFO: hint syntax error at or near "ti1_pkey ti1_btree)"
+DETAIL: Closing parenthesis is necessary.
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on ti1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(3 rows)
+
+-- No. S-3-13-13
+/*+NoSeqScan(ti1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoSeqScan(ti1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on ti1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(3 rows)
+
+-- No. S-3-13-14
+/*+NoSeqScan(ti1 ti1_pkey)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+INFO: hint syntax error at or near "ti1_pkey)"
+DETAIL: Closing parenthesis is necessary.
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on ti1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(3 rows)
+
+-- No. S-3-13-15
+/*+NoSeqScan(ti1 ti1_pkey ti1_btree)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+INFO: hint syntax error at or near "ti1_pkey ti1_btree)"
+DETAIL: Closing parenthesis is necessary.
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on ti1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(3 rows)
+
+-- No. S-3-13-16
+/*+NoIndexScan(ti1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoIndexScan(ti1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on ti1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(3 rows)
+
+-- No. S-3-13-17
+/*+NoIndexScan(ti1 ti1_pkey)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+INFO: hint syntax error at or near "ti1_pkey)"
+DETAIL: Closing parenthesis is necessary.
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on ti1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(3 rows)
+
+-- No. S-3-13-18
+/*+NoIndexScan(ti1 ti1_pkey ti1_btree)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+INFO: hint syntax error at or near "ti1_pkey ti1_btree)"
+DETAIL: Closing parenthesis is necessary.
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on ti1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(3 rows)
+
+-- No. S-3-13-19
+/*+NoBitmapScan(ti1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoBitmapScan(ti1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on ti1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(3 rows)
+
+-- No. S-3-13-20
+/*+NoBitmapScan(ti1 ti1_pkey)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+INFO: hint syntax error at or near "ti1_pkey)"
+DETAIL: Closing parenthesis is necessary.
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on ti1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(3 rows)
+
+-- No. S-3-13-21
+/*+NoBitmapScan(ti1 ti1_pkey ti1_btree)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+INFO: hint syntax error at or near "ti1_pkey ti1_btree)"
+DETAIL: Closing parenthesis is necessary.
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on ti1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(3 rows)
+
+-- No. S-3-13-22
+/*+NoTidScan(ti1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+LOG: pg_hint_plan:
+used hint:
+NoTidScan(ti1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Index Scan using ti1_uniq on ti1
+ Index Cond: (c1 = 1)
+ Filter: (ctid = '(1,1)'::tid)
+(3 rows)
+
+-- No. S-3-13-23
+/*+NoTidScan(ti1 ti1_pkey)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+INFO: hint syntax error at or near "ti1_pkey)"
+DETAIL: Closing parenthesis is necessary.
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on ti1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(3 rows)
+
+-- No. S-3-13-24
+/*+NoTidScan(ti1 ti1_pkey ti1_btree)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+INFO: hint syntax error at or near "ti1_pkey ti1_btree)"
+DETAIL: Closing parenthesis is necessary.
+ QUERY PLAN
+-----------------------------------
+ Tid Scan on ti1
+ TID Cond: (ctid = '(1,1)'::tid)
+ Filter: (c1 = 1)
+(3 rows)
+
+-- No. S-3-13-25
+/*+IndexOnlyScan(ti1)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 >= 1;
+LOG: pg_hint_plan:
+used hint:
+IndexOnlyScan(ti1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------
+ Index Only Scan using ti1_uniq on ti1
+ Index Cond: (c1 >= 1)
+(2 rows)
+
+-- No. S-3-13-26
+/*+IndexOnlyScan(ti1 ti1_pkey)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 >= 1;
+LOG: pg_hint_plan:
+used hint:
+IndexOnlyScan(ti1 ti1_pkey)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+---------------------------------------
+ Index Only Scan using ti1_pkey on ti1
+ Index Cond: (c1 >= 1)
+(2 rows)
+
+-- No. S-3-13-27
+/*+IndexOnlyScan(ti1 ti1_pkey ti1_btree)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 >= 1;
+LOG: pg_hint_plan:
+used hint:
+IndexOnlyScan(ti1 ti1_pkey ti1_btree)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------
+ Index Only Scan using ti1_btree on ti1
+ Index Cond: (c1 >= 1)
+(2 rows)
+
+-- No. S-3-13-28
+/*+NoIndexOnlyScan(ti1)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 = 1;
+LOG: pg_hint_plan:
+used hint:
+NoIndexOnlyScan(ti1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Index Scan using ti1_uniq on ti1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. S-3-13-29
+/*+NoIndexOnlyScan(ti1 ti1_pkey)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 = 1;
+INFO: hint syntax error at or near "ti1_pkey)"
+DETAIL: Closing parenthesis is necessary.
+ QUERY PLAN
+---------------------------------------
+ Index Only Scan using ti1_uniq on ti1
+ Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. S-3-13-30
+/*+NoIndexOnlyScan(ti1 ti1_pkey ti1_btree)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 = 1;
+INFO: hint syntax error at or near "ti1_pkey ti1_btree)"
+DETAIL: Closing parenthesis is necessary.
+ QUERY PLAN
+---------------------------------------
+ Index Only Scan using ti1_uniq on ti1
+ Index Cond: (c1 = 1)
+(2 rows)
+
--- /dev/null
+DROP ROLE IF EXISTS super_user;
+DROP ROLE IF EXISTS normal_user;
--- /dev/null
+SET search_path TO public;
+CREATE EXTENSION pg_stat_statements;
+CREATE EXTENSION btree_gist;
+CREATE EXTENSION btree_gin;
+CREATE ROLE super_user
+ SUPERUSER
+ NOCREATEDB
+ NOCREATEROLE
+ NOINHERIT
+ NOLOGIN
+ NOREPLICATION
+ CONNECTION LIMIT 1;
+CREATE ROLE normal_user
+ NOSUPERUSER
+ NOCREATEDB
+ NOCREATEROLE
+ NOINHERIT
+ NOLOGIN
+ NOREPLICATION
+ CONNECTION LIMIT 1;
+CREATE SCHEMA s1;
+CREATE SCHEMA s2;
+CREATE TABLE s1.t1 (c1 int, c2 int, c3 int, c4 text, PRIMARY KEY (c1));
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "t1_pkey" for table "t1"
+CREATE TABLE s1.t2 (LIKE s1.t1 INCLUDING ALL);
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "t2_pkey" for table "t2"
+CREATE TABLE s1.t3 (LIKE s1.t1 INCLUDING ALL);
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "t3_pkey" for table "t3"
+CREATE TABLE s1.t4 (LIKE s1.t1 INCLUDING ALL);
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "t4_pkey" for table "t4"
+CREATE TABLE s2.t1 (LIKE s1.t1 INCLUDING ALL);
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "t1_pkey" for table "t1"
+CREATE TABLE s1.p1 (LIKE s1.t1 INCLUDING ALL);
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "p1_pkey" for table "p1"
+CREATE TABLE s1.p2 (LIKE s1.t1 INCLUDING ALL);
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "p2_pkey" for table "p2"
+CREATE TABLE s1.p1c1 (LIKE s1.p1 INCLUDING ALL, CHECK (c1 <= 100)) INHERITS(s1.p1);
+NOTICE: merging column "c1" with inherited definition
+NOTICE: merging column "c2" with inherited definition
+NOTICE: merging column "c3" with inherited definition
+NOTICE: merging column "c4" with inherited definition
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "p1c1_pkey" for table "p1c1"
+CREATE TABLE s1.p1c2 (LIKE s1.p1 INCLUDING ALL, CHECK (c1 > 100 AND c1 <= 200)) INHERITS(s1.p1);
+NOTICE: merging column "c1" with inherited definition
+NOTICE: merging column "c2" with inherited definition
+NOTICE: merging column "c3" with inherited definition
+NOTICE: merging column "c4" with inherited definition
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "p1c2_pkey" for table "p1c2"
+CREATE TABLE s1.p1c3 (LIKE s1.p1 INCLUDING ALL, CHECK (c1 > 200)) INHERITS(s1.p1);
+NOTICE: merging column "c1" with inherited definition
+NOTICE: merging column "c2" with inherited definition
+NOTICE: merging column "c3" with inherited definition
+NOTICE: merging column "c4" with inherited definition
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "p1c3_pkey" for table "p1c3"
+CREATE TABLE s1.p2c1 (LIKE s1.p2 INCLUDING ALL, CHECK (c1 <= 100)) INHERITS(s1.p2);
+NOTICE: merging column "c1" with inherited definition
+NOTICE: merging column "c2" with inherited definition
+NOTICE: merging column "c3" with inherited definition
+NOTICE: merging column "c4" with inherited definition
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "p2c1_pkey" for table "p2c1"
+CREATE TABLE s1.p2c2 (LIKE s1.p2 INCLUDING ALL, CHECK (c1 > 100 AND c1 <= 200)) INHERITS(s1.p2);
+NOTICE: merging column "c1" with inherited definition
+NOTICE: merging column "c2" with inherited definition
+NOTICE: merging column "c3" with inherited definition
+NOTICE: merging column "c4" with inherited definition
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "p2c2_pkey" for table "p2c2"
+CREATE TABLE s1.p2c3 (LIKE s1.p2 INCLUDING ALL, CHECK (c1 > 200)) INHERITS(s1.p2);
+NOTICE: merging column "c1" with inherited definition
+NOTICE: merging column "c2" with inherited definition
+NOTICE: merging column "c3" with inherited definition
+NOTICE: merging column "c4" with inherited definition
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "p2c3_pkey" for table "p2c3"
+CREATE TABLE s1.p2c1c1 (LIKE s1.p2c1 INCLUDING ALL, CHECK (c1 <= 50)) INHERITS(s1.p2c1);
+NOTICE: merging column "c1" with inherited definition
+NOTICE: merging column "c2" with inherited definition
+NOTICE: merging column "c3" with inherited definition
+NOTICE: merging column "c4" with inherited definition
+NOTICE: merging constraint "p2c1_c1_check" with inherited definition
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "p2c1c1_pkey" for table "p2c1c1"
+CREATE TABLE s1.p2c1c2 (LIKE s1.p2c1 INCLUDING ALL, CHECK (c1 > 50 AND c1 <= 100)) INHERITS(s1.p2c1);
+NOTICE: merging column "c1" with inherited definition
+NOTICE: merging column "c2" with inherited definition
+NOTICE: merging column "c3" with inherited definition
+NOTICE: merging column "c4" with inherited definition
+NOTICE: merging constraint "p2c1_c1_check" with inherited definition
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "p2c1c2_pkey" for table "p2c1c2"
+CREATE TABLE s1.p2c2c1 (LIKE s1.p2c2 INCLUDING ALL, CHECK (c1 > 100 AND c1 <= 150)) INHERITS(s1.p2c2);
+NOTICE: merging column "c1" with inherited definition
+NOTICE: merging column "c2" with inherited definition
+NOTICE: merging column "c3" with inherited definition
+NOTICE: merging column "c4" with inherited definition
+NOTICE: merging constraint "p2c2_c1_check" with inherited definition
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "p2c2c1_pkey" for table "p2c2c1"
+CREATE TABLE s1.p2c2c2 (LIKE s1.p2c2 INCLUDING ALL, CHECK (c1 > 150 AND c1 <= 200)) INHERITS(s1.p2c2);
+NOTICE: merging column "c1" with inherited definition
+NOTICE: merging column "c2" with inherited definition
+NOTICE: merging column "c3" with inherited definition
+NOTICE: merging column "c4" with inherited definition
+NOTICE: merging constraint "p2c2_c1_check" with inherited definition
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "p2c2c2_pkey" for table "p2c2c2"
+CREATE TABLE s1.p2c3c1 (LIKE s1.p2c3 INCLUDING ALL, CHECK (c1 > 200 AND c1 <= 250)) INHERITS(s1.p2c3);
+NOTICE: merging column "c1" with inherited definition
+NOTICE: merging column "c2" with inherited definition
+NOTICE: merging column "c3" with inherited definition
+NOTICE: merging column "c4" with inherited definition
+NOTICE: merging constraint "p2c3_c1_check" with inherited definition
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "p2c3c1_pkey" for table "p2c3c1"
+CREATE TABLE s1.p2c3c2 (LIKE s1.p2c3 INCLUDING ALL, CHECK (c1 > 250)) INHERITS(s1.p2c3);
+NOTICE: merging column "c1" with inherited definition
+NOTICE: merging column "c2" with inherited definition
+NOTICE: merging column "c3" with inherited definition
+NOTICE: merging column "c4" with inherited definition
+NOTICE: merging constraint "p2c3_c1_check" with inherited definition
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "p2c3c2_pkey" for table "p2c3c2"
+CREATE TABLE s1.r1 (LIKE s1.t1);
+CREATE TABLE s1.r2 (LIKE s1.t1);
+CREATE TABLE s1.r3 (LIKE s1.t1);
+CREATE TABLE s1.r4 (LIKE s1.t1);
+CREATE TABLE s1.r5 (LIKE s1.t1);
+CREATE TABLE s1.r1_ (LIKE s1.t1);
+CREATE TABLE s1.r2_ (LIKE s1.t1);
+CREATE TABLE s1.r3_ (LIKE s1.t1);
+CREATE TABLE s1.ti1 (c1 int, c2 int, c3 int, c4 text, PRIMARY KEY (c1), UNIQUE (c2));
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "ti1_pkey" for table "ti1"
+NOTICE: CREATE TABLE / UNIQUE will create implicit index "ti1_c2_key" for table "ti1"
+CREATE UNLOGGED TABLE s1.ul1 (LIKE s1.t1 INCLUDING ALL);
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "ul1_pkey" for table "ul1"
+INSERT INTO s1.t1 SELECT i, i, i % 100, i FROM (SELECT generate_series(1, 1000) i) t;
+INSERT INTO s1.t2 SELECT i, i, i % 10, i FROM (SELECT generate_series(1, 100) i) t;
+INSERT INTO s2.t1 SELECT i, i, i % 10, i FROM (SELECT generate_series(1, 100) i) t;
+INSERT INTO s1.p1c1 SELECT i, i, i % 10, i FROM (SELECT generate_series(1, 100) i) t;
+INSERT INTO s1.p1c2 SELECT i, i, i % 10, i FROM (SELECT generate_series(101, 200) i) t;
+INSERT INTO s1.p1c3 SELECT i, i, i % 10, i FROM (SELECT generate_series(201, 300) i) t;
+INSERT INTO s1.p2c1c1 SELECT i, i, i % 10, i FROM (SELECT generate_series(1, 50) i) t;
+INSERT INTO s1.p2c1c2 SELECT i, i, i % 10, i FROM (SELECT generate_series(51, 100) i) t;
+INSERT INTO s1.p2c2c1 SELECT i, i, i % 10, i FROM (SELECT generate_series(101, 150) i) t;
+INSERT INTO s1.p2c2c2 SELECT i, i, i % 10, i FROM (SELECT generate_series(151, 200) i) t;
+INSERT INTO s1.p2c3c1 SELECT i, i, i % 10, i FROM (SELECT generate_series(201, 250) i) t;
+INSERT INTO s1.p2c3c2 SELECT i, i, i % 10, i FROM (SELECT generate_series(251, 300) i) t;
+INSERT INTO s1.ti1 SELECT i, i, i % 100, i FROM (SELECT generate_series(1, 1000) i) t;
+CREATE INDEX t1_i ON s1.t1 (c3);
+CREATE INDEX t1_i1 ON s1.t1 (c1);
+CREATE INDEX t2_i1 ON s1.t2 (c1);
+CREATE INDEX t3_i1 ON s1.t3 (c1);
+CREATE INDEX t4_i1 ON s1.t4 (c1);
+CREATE INDEX p1_i ON s1.p1 (c1);
+CREATE INDEX p2_i ON s1.p2 (c1);
+CREATE INDEX p1c1_i ON s1.p1c1 (c1);
+CREATE INDEX p1c2_i ON s1.p1c2 (c1);
+CREATE INDEX p1c3_i ON s1.p1c3 (c1);
+CREATE INDEX p2c1_i ON s1.p2c1 (c1);
+CREATE INDEX p2c2_i ON s1.p2c2 (c1);
+CREATE INDEX p2c3_i ON s1.p2c3 (c1);
+CREATE INDEX p2c1c1_i ON s1.p2c1c1 (c1);
+CREATE INDEX p2c1c2_i ON s1.p2c1c2 (c1);
+CREATE INDEX p2c2c1_i ON s1.p2c2c1 (c1);
+CREATE INDEX p2c2c2_i ON s1.p2c2c2 (c1);
+CREATE INDEX p2c3c1_i ON s1.p2c3c1 (c1);
+CREATE INDEX p2c3c2_i ON s1.p2c3c2 (c1);
+CREATE INDEX ti1_i1 ON s1.ti1 (c2);
+CREATE INDEX ti1_i2 ON s1.ti1 (c2, c4);
+CREATE INDEX ti1_i3 ON s1.ti1 (c2, c4, c4);
+CREATE INDEX ti1_i4 ON s1.ti1 (c2, c4, c4, c4);
+CREATE INDEX ti1_btree ON s1.ti1 USING btree (c1);
+CREATE INDEX ti1_hash ON s1.ti1 USING hash (c1);
+CREATE INDEX ti1_gist ON s1.ti1 USING gist (c1);
+CREATE INDEX ti1_gin ON s1.ti1 USING gin (c1);
+CREATE INDEX ti1_expr ON s1.ti1 ((c1 < 100));
+CREATE INDEX ti1_pred ON s1.ti1 (lower(c4));
+CREATE UNIQUE INDEX ti1_uniq ON s1.ti1 (c1);
+CREATE INDEX ti1_multi ON s1.ti1 (c1, c2, c3, c4);
+CREATE INDEX ti1_ts ON s1.ti1 USING gin(to_tsvector('english', c4));
+CREATE VIEW s1.v1 AS SELECT v1t1.c1, v1t1.c2, v1t1.c3, v1t1.c4 FROM s1.t1 v1t1;
+CREATE VIEW s1.v1_ AS SELECT v1t1_.c1, v1t1_.c2, v1t1_.c3, v1t1_.c4 FROM s1.t1 v1t1_;
+CREATE VIEW s1.v2 AS SELECT v2t1.c1, v2t1.c2, v2t1.c3, v2t1.c4 FROM s1.t1 v2t1 JOIN s1.t2 v2t2 ON(v2t1.c1 = v2t2.c1);
+CREATE VIEW s1.v3 AS SELECT v3t1.c1, v3t1.c2, v3t1.c3, v3t1.c4 FROM s1.t1 v3t1 JOIN s1.t2 v3t2 ON(v3t1.c1 = v3t2.c1) JOIN s1.t3 v3t3 ON(v3t1.c1 = v3t3.c1);
+ANALYZE s1.t1;
+ANALYZE s1.t2;
+ANALYZE s2.t1;
+ANALYZE s1.p1;
+ANALYZE s1.p2;
+ANALYZE s1.p1c1;
+ANALYZE s1.p1c2;
+ANALYZE s1.p1c3;
+ANALYZE s1.p2c1c1;
+ANALYZE s1.p2c1c2;
+ANALYZE s1.p2c2c1;
+ANALYZE s1.p2c2c2;
+ANALYZE s1.p2c3c1;
+ANALYZE s1.p2c3c2;
+ANALYZE s1.ti1;
+CREATE FUNCTION s1.f1 () RETURNS s1.t1 AS $$
+VALUES(1,1,1,'1'), (2,2,2,'2'), (3,3,3,'3')
+$$ LANGUAGE sql;
+CREATE RULE r1 AS ON UPDATE TO s1.r1 DO INSTEAD (
+SELECT max(t1.c1) FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.ctid = '(1,1)' AND t1.c1 = t2.c1 AND t2.ctid = '(1,1)' AND t1.c1 = t3.c1 AND t3.ctid = '(1,1)' AND t1.c1 = t4.c1 AND t4.ctid = '(1,1)';
+);
+CREATE RULE r2 AS ON UPDATE TO s1.r2 DO INSTEAD (
+SELECT max(t1.c1) FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.ctid = '(1,1)' AND t1.c1 = t2.c1 AND t2.ctid = '(1,1)' AND t1.c1 = t3.c1 AND t3.ctid = '(1,1)' AND t1.c1 = t4.c1 AND t4.ctid = '(1,1)';
+SELECT max(t1.c1) FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.ctid = '(1,1)' AND t1.c1 = t2.c1 AND t2.ctid = '(1,1)' AND t1.c1 = t3.c1 AND t3.ctid = '(1,1)' AND t1.c1 = t4.c1 AND t4.ctid = '(1,1)';
+);
+CREATE RULE r3 AS ON UPDATE TO s1.r3 DO INSTEAD (
+SELECT max(t1.c1) FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.ctid = '(1,1)' AND t1.c1 = t2.c1 AND t2.ctid = '(1,1)' AND t1.c1 = t3.c1 AND t3.ctid = '(1,1)' AND t1.c1 = t4.c1 AND t4.ctid = '(1,1)';
+SELECT max(t1.c1) FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.ctid = '(1,1)' AND t1.c1 = t2.c1 AND t2.ctid = '(1,1)' AND t1.c1 = t3.c1 AND t3.ctid = '(1,1)' AND t1.c1 = t4.c1 AND t4.ctid = '(1,1)';
+SELECT max(t1.c1) FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.ctid = '(1,1)' AND t1.c1 = t2.c1 AND t2.ctid = '(1,1)' AND t1.c1 = t3.c1 AND t3.ctid = '(1,1)' AND t1.c1 = t4.c1 AND t4.ctid = '(1,1)';
+);
+CREATE RULE r1_ AS ON UPDATE TO s1.r1_ DO INSTEAD (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)';
+);
+CREATE RULE r2_ AS ON UPDATE TO s1.r2_ DO INSTEAD (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)';
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)';
+);
+CREATE RULE r3_ AS ON UPDATE TO s1.r3_ DO INSTEAD (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)';
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)';
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)';
+);
+CREATE RULE "_RETURN" AS ON SELECT TO s1.r4 DO INSTEAD SELECT r4t1.c1, r4t1.c2, r4t1.c3, r4t1.c4 FROM s1.t1 r4t1;
+CREATE RULE "_RETURN" AS ON SELECT TO s1.r5 DO INSTEAD SELECT r5t1.c1, r5t1.c2, r5t1.c3, r5t1.c4 FROM s1.t1 r5t1;
--- /dev/null
+LOAD 'pg_hint_plan';
+SET search_path TO public;
+SET pg_hint_plan.debug_print TO on;
+SET client_min_messages TO LOG;
+SET pg_hint_plan.enable_hint TO on;
+
+CREATE EXTENSION file_fdw;
+CREATE SERVER file_server FOREIGN DATA WRAPPER file_fdw;
+CREATE USER MAPPING FOR PUBLIC SERVER file_server;
+CREATE FOREIGN TABLE ft1 (id int, val int) SERVER file_server OPTIONS (format 'csv', filename '@abs_srcdir@/data/data.csv');
+
+-- foreign table test
+SELECT * FROM ft1;
+\t
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, ft1 ft_1, ft1 ft_2 WHERE t1.c1 = ft_1.id AND t1.c1 = ft_2.id;
+
+----
+---- No. S-1-5 object type for the hint
+----
+
+-- No. S-1-5-6
+/*+SeqScan(t1)SeqScan(ft_1)SeqScan(ft_2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, ft1 ft_1, ft1 ft_2 WHERE t1.c1 = ft_1.id AND t1.c1 = ft_2.id;
+
+----
+---- No. J-1-6 object type for the hint
+----
+
+-- No. J-1-6-6
+/*+MergeJoin(ft_1 ft_2)Leading(ft_1 ft_2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, ft1 ft_1, ft1 ft_2 WHERE t1.c1 = ft_1.id AND t1.c1 = ft_2.id;
+
+----
+---- No. L-1-6 object type for the hint
+----
+
+-- No. L-1-6-6
+/*+Leading(ft_1 ft_2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, ft1 ft_1, ft1 ft_2 WHERE t1.c1 = ft_1.id AND t1.c1 = ft_2.id;
--- /dev/null
+/*-------------------------------------------------------------------------
+ *
+ * make_join_rel.c
+ * Routines copied from PostgreSQL core distribution.
+ *
+ * src/backend/optimizer/path/joinrels.c
+ * make_join_rel()
+ *
+ * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ *-------------------------------------------------------------------------
+ */
+
+/*
+ * make_join_rel
+ * Find or create a join RelOptInfo that represents the join of
+ * the two given rels, and add to it path information for paths
+ * created with the two rels as outer and inner rel.
+ * (The join rel may already contain paths generated from other
+ * pairs of rels that add up to the same set of base rels.)
+ *
+ * NB: will return NULL if attempted join is not valid. This can happen
+ * when working with outer joins, or with IN or EXISTS clauses that have been
+ * turned into joins.
+ */
+RelOptInfo *
+make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2)
+{
+ Relids joinrelids;
+ SpecialJoinInfo *sjinfo;
+ bool reversed;
+ SpecialJoinInfo sjinfo_data;
+ RelOptInfo *joinrel;
+ List *restrictlist;
+
+ /* We should never try to join two overlapping sets of rels. */
+ Assert(!bms_overlap(rel1->relids, rel2->relids));
+
+ /* Construct Relids set that identifies the joinrel. */
+ joinrelids = bms_union(rel1->relids, rel2->relids);
+
+ /* Check validity and determine join type. */
+ if (!join_is_legal(root, rel1, rel2, joinrelids,
+ &sjinfo, &reversed))
+ {
+ /* invalid join path */
+ bms_free(joinrelids);
+ return NULL;
+ }
+
+ /* Swap rels if needed to match the join info. */
+ if (reversed)
+ {
+ RelOptInfo *trel = rel1;
+
+ rel1 = rel2;
+ rel2 = trel;
+ }
+
+ /*
+ * If it's a plain inner join, then we won't have found anything in
+ * join_info_list. Make up a SpecialJoinInfo so that selectivity
+ * estimation functions will know what's being joined.
+ */
+ if (sjinfo == NULL)
+ {
+ sjinfo = &sjinfo_data;
+ sjinfo->type = T_SpecialJoinInfo;
+ sjinfo->min_lefthand = rel1->relids;
+ sjinfo->min_righthand = rel2->relids;
+ sjinfo->syn_lefthand = rel1->relids;
+ sjinfo->syn_righthand = rel2->relids;
+ sjinfo->jointype = JOIN_INNER;
+ /* we don't bother trying to make the remaining fields valid */
+ sjinfo->lhs_strict = false;
+ sjinfo->delay_upper_joins = false;
+ sjinfo->join_quals = NIL;
+ }
+
+ /*
+ * Find or build the join RelOptInfo, and compute the restrictlist that
+ * goes with this particular joining.
+ */
+ joinrel = build_join_rel(root, joinrelids, rel1, rel2, sjinfo,
+ &restrictlist);
+
+ /*
+ * If we've already proven this join is empty, we needn't consider any
+ * more paths for it.
+ */
+ if (is_dummy_rel(joinrel))
+ {
+ bms_free(joinrelids);
+ return joinrel;
+ }
+
+ /*
+ * Consider paths using each rel as both outer and inner. Depending on
+ * the join type, a provably empty outer or inner rel might mean the join
+ * is provably empty too; in which case throw away any previously computed
+ * paths and mark the join as dummy. (We do it this way since it's
+ * conceivable that dummy-ness of a multi-element join might only be
+ * noticeable for certain construction paths.)
+ *
+ * Also, a provably constant-false join restriction typically means that
+ * we can skip evaluating one or both sides of the join. We do this by
+ * marking the appropriate rel as dummy. For outer joins, a
+ * constant-false restriction that is pushed down still means the whole
+ * join is dummy, while a non-pushed-down one means that no inner rows
+ * will join so we can treat the inner rel as dummy.
+ *
+ * We need only consider the jointypes that appear in join_info_list, plus
+ * JOIN_INNER.
+ */
+ switch (sjinfo->jointype)
+ {
+ case JOIN_INNER:
+ if (is_dummy_rel(rel1) || is_dummy_rel(rel2) ||
+ restriction_is_constant_false(restrictlist, false))
+ {
+ mark_dummy_rel(joinrel);
+ break;
+ }
+ add_paths_to_joinrel(root, joinrel, rel1, rel2,
+ JOIN_INNER, sjinfo,
+ restrictlist);
+ add_paths_to_joinrel(root, joinrel, rel2, rel1,
+ JOIN_INNER, sjinfo,
+ restrictlist);
+ break;
+ case JOIN_LEFT:
+ if (is_dummy_rel(rel1) ||
+ restriction_is_constant_false(restrictlist, true))
+ {
+ mark_dummy_rel(joinrel);
+ break;
+ }
+ if (restriction_is_constant_false(restrictlist, false) &&
+ bms_is_subset(rel2->relids, sjinfo->syn_righthand))
+ mark_dummy_rel(rel2);
+ add_paths_to_joinrel(root, joinrel, rel1, rel2,
+ JOIN_LEFT, sjinfo,
+ restrictlist);
+ add_paths_to_joinrel(root, joinrel, rel2, rel1,
+ JOIN_RIGHT, sjinfo,
+ restrictlist);
+ break;
+ case JOIN_FULL:
+ if ((is_dummy_rel(rel1) && is_dummy_rel(rel2)) ||
+ restriction_is_constant_false(restrictlist, true))
+ {
+ mark_dummy_rel(joinrel);
+ break;
+ }
+ add_paths_to_joinrel(root, joinrel, rel1, rel2,
+ JOIN_FULL, sjinfo,
+ restrictlist);
+ add_paths_to_joinrel(root, joinrel, rel2, rel1,
+ JOIN_FULL, sjinfo,
+ restrictlist);
+
+ /*
+ * If there are join quals that aren't mergeable or hashable, we
+ * may not be able to build any valid plan. Complain here so that
+ * we can give a somewhat-useful error message. (Since we have no
+ * flexibility of planning for a full join, there's no chance of
+ * succeeding later with another pair of input rels.)
+ */
+ if (joinrel->pathlist == NIL)
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("FULL JOIN is only supported with merge-joinable or hash-joinable join conditions")));
+ break;
+ case JOIN_SEMI:
+
+ /*
+ * We might have a normal semijoin, or a case where we don't have
+ * enough rels to do the semijoin but can unique-ify the RHS and
+ * then do an innerjoin (see comments in join_is_legal). In the
+ * latter case we can't apply JOIN_SEMI joining.
+ */
+ if (bms_is_subset(sjinfo->min_lefthand, rel1->relids) &&
+ bms_is_subset(sjinfo->min_righthand, rel2->relids))
+ {
+ if (is_dummy_rel(rel1) || is_dummy_rel(rel2) ||
+ restriction_is_constant_false(restrictlist, false))
+ {
+ mark_dummy_rel(joinrel);
+ break;
+ }
+ add_paths_to_joinrel(root, joinrel, rel1, rel2,
+ JOIN_SEMI, sjinfo,
+ restrictlist);
+ }
+
+ /*
+ * If we know how to unique-ify the RHS and one input rel is
+ * exactly the RHS (not a superset) we can consider unique-ifying
+ * it and then doing a regular join. (The create_unique_path
+ * check here is probably redundant with what join_is_legal did,
+ * but if so the check is cheap because it's cached. So test
+ * anyway to be sure.)
+ */
+ if (bms_equal(sjinfo->syn_righthand, rel2->relids) &&
+ create_unique_path(root, rel2, rel2->cheapest_total_path,
+ sjinfo) != NULL)
+ {
+ if (is_dummy_rel(rel1) || is_dummy_rel(rel2) ||
+ restriction_is_constant_false(restrictlist, false))
+ {
+ mark_dummy_rel(joinrel);
+ break;
+ }
+ add_paths_to_joinrel(root, joinrel, rel1, rel2,
+ JOIN_UNIQUE_INNER, sjinfo,
+ restrictlist);
+ add_paths_to_joinrel(root, joinrel, rel2, rel1,
+ JOIN_UNIQUE_OUTER, sjinfo,
+ restrictlist);
+ }
+ break;
+ case JOIN_ANTI:
+ if (is_dummy_rel(rel1) ||
+ restriction_is_constant_false(restrictlist, true))
+ {
+ mark_dummy_rel(joinrel);
+ break;
+ }
+ if (restriction_is_constant_false(restrictlist, false) &&
+ bms_is_subset(rel2->relids, sjinfo->syn_righthand))
+ mark_dummy_rel(rel2);
+ add_paths_to_joinrel(root, joinrel, rel1, rel2,
+ JOIN_ANTI, sjinfo,
+ restrictlist);
+ break;
+ default:
+ /* other values not expected here */
+ elog(ERROR, "unrecognized join type: %d", (int) sjinfo->jointype);
+ break;
+ }
+
+ bms_free(joinrelids);
+
+ return joinrel;
+}
--- /dev/null
+LOAD 'pg_hint_plan';
+SET search_path TO public;
+SET pg_hint_plan.debug_print TO on;
+SET client_min_messages TO LOG;
+SET pg_hint_plan.enable_hint TO on;
+CREATE EXTENSION file_fdw;
+CREATE SERVER file_server FOREIGN DATA WRAPPER file_fdw;
+CREATE USER MAPPING FOR PUBLIC SERVER file_server;
+CREATE FOREIGN TABLE ft1 (id int, val int) SERVER file_server OPTIONS (format 'csv', filename '@abs_srcdir@/data/data.csv');
+-- foreign table test
+SELECT * FROM ft1;
+ id | val
+----+-----
+ 1 | 1
+ 2 | 2
+ 3 | 3
+ 4 | 4
+ 5 | 5
+ 6 | 6
+ 7 | 7
+ 8 | 8
+ 9 | 9
+ 10 | 10
+(10 rows)
+
+\t
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, ft1 ft_1, ft1 ft_2 WHERE t1.c1 = ft_1.id AND t1.c1 = ft_2.id;
+ Nested Loop
+ Join Filter: (t1.c1 = ft_2.id)
+ -> Nested Loop
+ -> Foreign Scan on ft1 ft_1
+ Foreign File: @abs_srcdir@/data/data.csv
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = ft_1.id)
+ -> Foreign Scan on ft1 ft_2
+ Foreign File: @abs_srcdir@/data/data.csv
+
+----
+---- No. S-1-5 object type for the hint
+----
+-- No. S-1-5-6
+/*+SeqScan(t1)SeqScan(ft_1)SeqScan(ft_2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, ft1 ft_1, ft1 ft_2 WHERE t1.c1 = ft_1.id AND t1.c1 = ft_2.id;
+LOG: pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+SeqScan(ft_1)
+SeqScan(ft_2)
+duplication hint:
+error hint:
+
+ Nested Loop
+ Join Filter: (t1.c1 = ft_2.id)
+ -> Hash Join
+ Hash Cond: (t1.c1 = ft_1.id)
+ -> Seq Scan on t1
+ -> Hash
+ -> Foreign Scan on ft1 ft_1
+ Foreign File: @abs_srcdir@/data/data.csv
+ -> Foreign Scan on ft1 ft_2
+ Foreign File: @abs_srcdir@/data/data.csv
+
+----
+---- No. J-1-6 object type for the hint
+----
+-- No. J-1-6-6
+/*+MergeJoin(ft_1 ft_2)Leading(ft_1 ft_2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, ft1 ft_1, ft1 ft_2 WHERE t1.c1 = ft_1.id AND t1.c1 = ft_2.id;
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(ft_1 ft_2)
+Leading(ft_1 ft_2 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ Nested Loop
+ -> Merge Join
+ Merge Cond: (ft_1.id = ft_2.id)
+ -> Sort
+ Sort Key: ft_1.id
+ -> Foreign Scan on ft1 ft_1
+ Foreign File: @abs_srcdir@/data/data.csv
+ -> Sort
+ Sort Key: ft_2.id
+ -> Foreign Scan on ft1 ft_2
+ Foreign File: @abs_srcdir@/data/data.csv
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = ft_1.id)
+
+----
+---- No. L-1-6 object type for the hint
+----
+-- No. L-1-6-6
+/*+Leading(ft_1 ft_2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, ft1 ft_1, ft1 ft_2 WHERE t1.c1 = ft_1.id AND t1.c1 = ft_2.id;
+LOG: pg_hint_plan:
+used hint:
+Leading(ft_1 ft_2 t1)
+not used hint:
+duplication hint:
+error hint:
+
+ Nested Loop
+ -> Nested Loop
+ Join Filter: (ft_1.id = ft_2.id)
+ -> Foreign Scan on ft1 ft_1
+ Foreign File: @abs_srcdir@/data/data.csv
+ -> Foreign Scan on ft1 ft_2
+ Foreign File: @abs_srcdir@/data/data.csv
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = ft_1.id)
+
--- /dev/null
+/*-------------------------------------------------------------------------
+ *
+ * pg_hint_plan.c
+ * do instructions or hints to the planner using C-style block comments
+ * of the SQL.
+ *
+ * Copyright (c) 2012, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
+ *
+ *-------------------------------------------------------------------------
+ */
+#include "postgres.h"
+#include "commands/prepare.h"
+#include "mb/pg_wchar.h"
+#include "miscadmin.h"
+#include "nodes/nodeFuncs.h"
+#include "optimizer/clauses.h"
+#include "optimizer/cost.h"
+#include "optimizer/geqo.h"
+#include "optimizer/joininfo.h"
+#include "optimizer/pathnode.h"
+#include "optimizer/paths.h"
+#include "optimizer/plancat.h"
+#include "optimizer/planner.h"
+#include "optimizer/prep.h"
+#include "optimizer/restrictinfo.h"
+#include "parser/scansup.h"
+#include "tcop/utility.h"
+#include "utils/lsyscache.h"
+#include "utils/memutils.h"
+#if PG_VERSION_NUM >= 90200
+#include "catalog/pg_class.h"
+#endif
+
+#ifdef PG_MODULE_MAGIC
+PG_MODULE_MAGIC;
+#endif
+
+#if PG_VERSION_NUM < 90100
+#error unsupported PostgreSQL version
+#endif
+
+#define BLOCK_COMMENT_START "/*"
+#define BLOCK_COMMENT_END "*/"
+#define HINT_COMMENT_KEYWORD "+"
+#define HINT_START BLOCK_COMMENT_START HINT_COMMENT_KEYWORD
+#define HINT_END BLOCK_COMMENT_END
+
+/* hint keywords */
+#define HINT_SEQSCAN "SeqScan"
+#define HINT_INDEXSCAN "IndexScan"
+#define HINT_BITMAPSCAN "BitmapScan"
+#define HINT_TIDSCAN "TidScan"
+#define HINT_NOSEQSCAN "NoSeqScan"
+#define HINT_NOINDEXSCAN "NoIndexScan"
+#define HINT_NOBITMAPSCAN "NoBitmapScan"
+#define HINT_NOTIDSCAN "NoTidScan"
+#if PG_VERSION_NUM >= 90200
+#define HINT_INDEXONLYSCAN "IndexOnlyScan"
+#define HINT_NOINDEXONLYSCAN "NoIndexOnlyScan"
+#endif
+#define HINT_NESTLOOP "NestLoop"
+#define HINT_MERGEJOIN "MergeJoin"
+#define HINT_HASHJOIN "HashJoin"
+#define HINT_NONESTLOOP "NoNestLoop"
+#define HINT_NOMERGEJOIN "NoMergeJoin"
+#define HINT_NOHASHJOIN "NoHashJoin"
+#define HINT_LEADING "Leading"
+#define HINT_SET "Set"
+
+#define HINT_ARRAY_DEFAULT_INITSIZE 8
+
+#define parse_ereport(str, detail) \
+ ereport(pg_hint_plan_parse_messages, \
+ (errmsg("hint syntax error at or near \"%s\"", (str)), \
+ errdetail detail))
+
+#define skip_space(str) \
+ while (isspace(*str)) \
+ str++;
+
+enum
+{
+ ENABLE_SEQSCAN = 0x01,
+ ENABLE_INDEXSCAN = 0x02,
+ ENABLE_BITMAPSCAN = 0x04,
+ ENABLE_TIDSCAN = 0x08,
+#if PG_VERSION_NUM >= 90200
+ ENABLE_INDEXONLYSCAN = 0x10
+#endif
+} SCAN_TYPE_BITS;
+
+enum
+{
+ ENABLE_NESTLOOP = 0x01,
+ ENABLE_MERGEJOIN = 0x02,
+ ENABLE_HASHJOIN = 0x04
+} JOIN_TYPE_BITS;
+
+#if PG_VERSION_NUM >= 90200
+#define ENABLE_ALL_SCAN (ENABLE_SEQSCAN | ENABLE_INDEXSCAN | \
+ ENABLE_BITMAPSCAN | ENABLE_TIDSCAN | \
+ ENABLE_INDEXONLYSCAN)
+#else
+#define ENABLE_ALL_SCAN (ENABLE_SEQSCAN | ENABLE_INDEXSCAN | \
+ ENABLE_BITMAPSCAN | ENABLE_TIDSCAN)
+#endif
+#define ENABLE_ALL_JOIN (ENABLE_NESTLOOP | ENABLE_MERGEJOIN | ENABLE_HASHJOIN)
+#define DISABLE_ALL_SCAN 0
+#define DISABLE_ALL_JOIN 0
+
+typedef struct Hint Hint;
+typedef struct HintState HintState;
+
+typedef Hint *(*HintCreateFunction) (const char *hint_str,
+ const char *keyword);
+typedef void (*HintDeleteFunction) (Hint *hint);
+typedef void (*HintDumpFunction) (Hint *hint, StringInfo buf);
+typedef int (*HintCmpFunction) (const Hint *a, const Hint *b);
+typedef const char *(*HintParseFunction) (Hint *hint, HintState *hstate,
+ Query *parse, const char *str);
+
+/* hint types */
+#define NUM_HINT_TYPE 4
+typedef enum HintType
+{
+ HINT_TYPE_SCAN_METHOD,
+ HINT_TYPE_JOIN_METHOD,
+ HINT_TYPE_LEADING,
+ HINT_TYPE_SET
+} HintType;
+
+static const char *HintTypeName[] = {
+ "scan method",
+ "join method",
+ "leading",
+ "set"
+};
+
+/* hint status */
+typedef enum HintStatus
+{
+ HINT_STATE_NOTUSED = 0, /* specified relation not used in query */
+ HINT_STATE_USED, /* hint is used */
+ HINT_STATE_DUPLICATION, /* specified hint duplication */
+ HINT_STATE_ERROR /* execute error (parse error does not include
+ * it) */
+} HintStatus;
+
+#define hint_state_enabled(hint) ((hint)->base.state == HINT_STATE_NOTUSED || \
+ (hint)->base.state == HINT_STATE_USED)
+
+/* common data for all hints. */
+struct Hint
+{
+ const char *hint_str; /* must not do pfree */
+ const char *keyword; /* must not do pfree */
+ HintType type;
+ HintStatus state;
+ HintDeleteFunction delete_func;
+ HintDumpFunction dump_func;
+ HintCmpFunction cmp_func;
+ HintParseFunction parser_func;
+};
+
+/* scan method hints */
+typedef struct ScanMethodHint
+{
+ Hint base;
+ char *relname;
+ List *indexnames;
+ unsigned char enforce_mask;
+} ScanMethodHint;
+
+/* join method hints */
+typedef struct JoinMethodHint
+{
+ Hint base;
+ int nrels;
+ char **relnames;
+ unsigned char enforce_mask;
+ Relids joinrelids;
+} JoinMethodHint;
+
+/* join order hints */
+typedef struct LeadingHint
+{
+ Hint base;
+ List *relations; /* relation names specified in Leading hint */
+} LeadingHint;
+
+/* change a run-time parameter hints */
+typedef struct SetHint
+{
+ Hint base;
+ char *name; /* name of variable */
+ char *value;
+} SetHint;
+
+/*
+ * Describes a context of hint processing.
+ */
+struct HintState
+{
+ char *hint_str; /* original hint string */
+
+ /* all hint */
+ int nall_hints; /* # of valid all hints */
+ int max_all_hints; /* # of slots for all hints */
+ Hint **all_hints; /* parsed all hints */
+
+ /* # of each hints */
+ int num_hints[NUM_HINT_TYPE];
+
+ /* for scan method hints */
+ ScanMethodHint **scan_hints; /* parsed scan hints */
+ int init_scan_mask; /* initial value scan parameter */
+ Index parent_relid; /* inherit parent table relid */
+ ScanMethodHint *parent_hint; /* inherit parent table scan hint */
+
+ /* for join method hints */
+ JoinMethodHint **join_hints; /* parsed join hints */
+ int init_join_mask; /* initial value join parameter */
+ List **join_hint_level;
+
+ /* for Leading hint */
+ LeadingHint *leading_hint; /* parsed last specified Leading hint */
+
+ /* for Set hints */
+ SetHint **set_hints; /* parsed Set hints */
+ GucContext context; /* which GUC parameters can we set? */
+};
+
+/*
+ * Describes a hint parser module which is bound with particular hint keyword.
+ */
+typedef struct HintParser
+{
+ char *keyword;
+ HintCreateFunction create_func;
+} HintParser;
+
+/* Module callbacks */
+void _PG_init(void);
+void _PG_fini(void);
+
+static void push_hint(HintState *hstate);
+static void pop_hint(void);
+
+static void pg_hint_plan_ProcessUtility(Node *parsetree,
+ const char *queryString,
+ ParamListInfo params, bool isTopLevel,
+ DestReceiver *dest,
+ char *completionTag);
+static PlannedStmt *pg_hint_plan_planner(Query *parse, int cursorOptions,
+ ParamListInfo boundParams);
+static void pg_hint_plan_get_relation_info(PlannerInfo *root,
+ Oid relationObjectId,
+ bool inhparent, RelOptInfo *rel);
+static RelOptInfo *pg_hint_plan_join_search(PlannerInfo *root,
+ int levels_needed,
+ List *initial_rels);
+
+static Hint *ScanMethodHintCreate(const char *hint_str, const char *keyword);
+static void ScanMethodHintDelete(ScanMethodHint *hint);
+static void ScanMethodHintDump(ScanMethodHint *hint, StringInfo buf);
+static int ScanMethodHintCmp(const ScanMethodHint *a, const ScanMethodHint *b);
+static const char *ScanMethodHintParse(ScanMethodHint *hint, HintState *hstate,
+ Query *parse, const char *str);
+static Hint *JoinMethodHintCreate(const char *hint_str, const char *keyword);
+static void JoinMethodHintDelete(JoinMethodHint *hint);
+static void JoinMethodHintDump(JoinMethodHint *hint, StringInfo buf);
+static int JoinMethodHintCmp(const JoinMethodHint *a, const JoinMethodHint *b);
+static const char *JoinMethodHintParse(JoinMethodHint *hint, HintState *hstate,
+ Query *parse, const char *str);
+static Hint *LeadingHintCreate(const char *hint_str, const char *keyword);
+static void LeadingHintDelete(LeadingHint *hint);
+static void LeadingHintDump(LeadingHint *hint, StringInfo buf);
+static int LeadingHintCmp(const LeadingHint *a, const LeadingHint *b);
+static const char *LeadingHintParse(LeadingHint *hint, HintState *hstate,
+ Query *parse, const char *str);
+static Hint *SetHintCreate(const char *hint_str, const char *keyword);
+static void SetHintDelete(SetHint *hint);
+static void SetHintDump(SetHint *hint, StringInfo buf);
+static int SetHintCmp(const SetHint *a, const SetHint *b);
+static const char *SetHintParse(SetHint *hint, HintState *hstate, Query *parse,
+ const char *str);
+
+RelOptInfo *pg_hint_plan_standard_join_search(PlannerInfo *root,
+ int levels_needed,
+ List *initial_rels);
+void pg_hint_plan_join_search_one_level(PlannerInfo *root, int level);
+static void make_rels_by_clause_joins(PlannerInfo *root, RelOptInfo *old_rel,
+ ListCell *other_rels);
+static void make_rels_by_clauseless_joins(PlannerInfo *root,
+ RelOptInfo *old_rel,
+ ListCell *other_rels);
+static bool has_join_restriction(PlannerInfo *root, RelOptInfo *rel);
+static void set_append_rel_pathlist(PlannerInfo *root, RelOptInfo *rel,
+ Index rti, RangeTblEntry *rte);
+#if PG_VERSION_NUM >= 90200
+static void generate_mergeappend_paths(PlannerInfo *root, RelOptInfo *rel,
+ List *live_childrels,
+ List *all_child_pathkeys);
+#endif
+static List *accumulate_append_subpath(List *subpaths, Path *path);
+#if PG_VERSION_NUM < 90200
+static void set_dummy_rel_pathlist(RelOptInfo *rel);
+#endif
+RelOptInfo *pg_hint_plan_make_join_rel(PlannerInfo *root, RelOptInfo *rel1,
+ RelOptInfo *rel2);
+
+/* GUC variables */
+static bool pg_hint_plan_enable_hint = true;
+static bool pg_hint_plan_debug_print = false;
+static int pg_hint_plan_parse_messages = INFO;
+
+static const struct config_enum_entry parse_messages_level_options[] = {
+ {"debug", DEBUG2, true},
+ {"debug5", DEBUG5, false},
+ {"debug4", DEBUG4, false},
+ {"debug3", DEBUG3, false},
+ {"debug2", DEBUG2, false},
+ {"debug1", DEBUG1, false},
+ {"log", LOG, false},
+ {"info", INFO, false},
+ {"notice", NOTICE, false},
+ {"warning", WARNING, false},
+ {"error", ERROR, false},
+ /*
+ * {"fatal", FATAL, true},
+ * {"panic", PANIC, true},
+ */
+ {NULL, 0, false}
+};
+
+/* Saved hook values in case of unload */
+static ProcessUtility_hook_type prev_ProcessUtility = NULL;
+static planner_hook_type prev_planner = NULL;
+static get_relation_info_hook_type prev_get_relation_info = NULL;
+static join_search_hook_type prev_join_search = NULL;
+
+/* Hold reference to currently active hint */
+static HintState *current_hint = NULL;
+
+/*
+ * List of hint contexts. We treat the head of the list as the Top of the
+ * context stack, so current_hint always points the first element of this list.
+ */
+static List *HintStateStack = NIL;
+
+/*
+ * Holds statement name during executing EXECUTE command. NULL for other
+ * statements.
+ */
+static char *stmt_name = NULL;
+
+static const HintParser parsers[] = {
+ {HINT_SEQSCAN, ScanMethodHintCreate},
+ {HINT_INDEXSCAN, ScanMethodHintCreate},
+ {HINT_BITMAPSCAN, ScanMethodHintCreate},
+ {HINT_TIDSCAN, ScanMethodHintCreate},
+ {HINT_NOSEQSCAN, ScanMethodHintCreate},
+ {HINT_NOINDEXSCAN, ScanMethodHintCreate},
+ {HINT_NOBITMAPSCAN, ScanMethodHintCreate},
+ {HINT_NOTIDSCAN, ScanMethodHintCreate},
+#if PG_VERSION_NUM >= 90200
+ {HINT_INDEXONLYSCAN, ScanMethodHintCreate},
+ {HINT_NOINDEXONLYSCAN, ScanMethodHintCreate},
+#endif
+ {HINT_NESTLOOP, JoinMethodHintCreate},
+ {HINT_MERGEJOIN, JoinMethodHintCreate},
+ {HINT_HASHJOIN, JoinMethodHintCreate},
+ {HINT_NONESTLOOP, JoinMethodHintCreate},
+ {HINT_NOMERGEJOIN, JoinMethodHintCreate},
+ {HINT_NOHASHJOIN, JoinMethodHintCreate},
+ {HINT_LEADING, LeadingHintCreate},
+ {HINT_SET, SetHintCreate},
+ {NULL, NULL}
+};
+
+/*
+ * Module load callbacks
+ */
+void
+_PG_init(void)
+{
+ /* Define custom GUC variables. */
+ DefineCustomBoolVariable("pg_hint_plan.enable_hint",
+ "Force planner to use plans specified in the hint comment preceding to the query.",
+ NULL,
+ &pg_hint_plan_enable_hint,
+ true,
+ PGC_USERSET,
+ 0,
+ NULL,
+ NULL,
+ NULL);
+
+ DefineCustomBoolVariable("pg_hint_plan.debug_print",
+ "Logs results of hint parsing.",
+ NULL,
+ &pg_hint_plan_debug_print,
+ false,
+ PGC_USERSET,
+ 0,
+ NULL,
+ NULL,
+ NULL);
+
+ DefineCustomEnumVariable("pg_hint_plan.parse_messages",
+ "Message level of parse errors.",
+ NULL,
+ &pg_hint_plan_parse_messages,
+ INFO,
+ parse_messages_level_options,
+ PGC_USERSET,
+ 0,
+ NULL,
+ NULL,
+ NULL);
+
+ /* Install hooks. */
+ prev_ProcessUtility = ProcessUtility_hook;
+ ProcessUtility_hook = pg_hint_plan_ProcessUtility;
+ prev_planner = planner_hook;
+ planner_hook = pg_hint_plan_planner;
+ prev_get_relation_info = get_relation_info_hook;
+ get_relation_info_hook = pg_hint_plan_get_relation_info;
+ prev_join_search = join_search_hook;
+ join_search_hook = pg_hint_plan_join_search;
+}
+
+/*
+ * Module unload callback
+ * XXX never called
+ */
+void
+_PG_fini(void)
+{
+ /* Uninstall hooks. */
+ ProcessUtility_hook = prev_ProcessUtility;
+ planner_hook = prev_planner;
+ get_relation_info_hook = prev_get_relation_info;
+ join_search_hook = prev_join_search;
+}
+
+/*
+ * create and delete functions the hint object
+ */
+
+static Hint *
+ScanMethodHintCreate(const char *hint_str, const char *keyword)
+{
+ ScanMethodHint *hint;
+
+ hint = palloc(sizeof(ScanMethodHint));
+ hint->base.hint_str = hint_str;
+ hint->base.keyword = keyword;
+ hint->base.type = HINT_TYPE_SCAN_METHOD;
+ hint->base.state = HINT_STATE_NOTUSED;
+ hint->base.delete_func = (HintDeleteFunction) ScanMethodHintDelete;
+ hint->base.dump_func = (HintDumpFunction) ScanMethodHintDump;
+ hint->base.cmp_func = (HintCmpFunction) ScanMethodHintCmp;
+ hint->base.parser_func = (HintParseFunction) ScanMethodHintParse;
+ hint->relname = NULL;
+ hint->indexnames = NIL;
+ hint->enforce_mask = 0;
+
+ return (Hint *) hint;
+}
+
+static void
+ScanMethodHintDelete(ScanMethodHint *hint)
+{
+ if (!hint)
+ return;
+
+ if (hint->relname)
+ pfree(hint->relname);
+ list_free_deep(hint->indexnames);
+ pfree(hint);
+}
+
+static Hint *
+JoinMethodHintCreate(const char *hint_str, const char *keyword)
+{
+ JoinMethodHint *hint;
+
+ hint = palloc(sizeof(JoinMethodHint));
+ hint->base.hint_str = hint_str;
+ hint->base.keyword = keyword;
+ hint->base.type = HINT_TYPE_JOIN_METHOD;
+ hint->base.state = HINT_STATE_NOTUSED;
+ hint->base.delete_func = (HintDeleteFunction) JoinMethodHintDelete;
+ hint->base.dump_func = (HintDumpFunction) JoinMethodHintDump;
+ hint->base.cmp_func = (HintCmpFunction) JoinMethodHintCmp;
+ hint->base.parser_func = (HintParseFunction) JoinMethodHintParse;
+ hint->nrels = 0;
+ hint->relnames = NULL;
+ hint->enforce_mask = 0;
+ hint->joinrelids = NULL;
+
+ return (Hint *) hint;
+}
+
+static void
+JoinMethodHintDelete(JoinMethodHint *hint)
+{
+ if (!hint)
+ return;
+
+ if (hint->relnames)
+ {
+ int i;
+
+ for (i = 0; i < hint->nrels; i++)
+ pfree(hint->relnames[i]);
+ pfree(hint->relnames);
+ }
+ bms_free(hint->joinrelids);
+ pfree(hint);
+}
+
+static Hint *
+LeadingHintCreate(const char *hint_str, const char *keyword)
+{
+ LeadingHint *hint;
+
+ hint = palloc(sizeof(LeadingHint));
+ hint->base.hint_str = hint_str;
+ hint->base.keyword = keyword;
+ hint->base.type = HINT_TYPE_LEADING;
+ hint->base.state = HINT_STATE_NOTUSED;
+ hint->base.delete_func = (HintDeleteFunction)LeadingHintDelete;
+ hint->base.dump_func = (HintDumpFunction) LeadingHintDump;
+ hint->base.cmp_func = (HintCmpFunction) LeadingHintCmp;
+ hint->base.parser_func = (HintParseFunction) LeadingHintParse;
+ hint->relations = NIL;
+
+ return (Hint *) hint;
+}
+
+static void
+LeadingHintDelete(LeadingHint *hint)
+{
+ if (!hint)
+ return;
+
+ list_free_deep(hint->relations);
+ pfree(hint);
+}
+
+static Hint *
+SetHintCreate(const char *hint_str, const char *keyword)
+{
+ SetHint *hint;
+
+ hint = palloc(sizeof(SetHint));
+ hint->base.hint_str = hint_str;
+ hint->base.keyword = keyword;
+ hint->base.type = HINT_TYPE_SET;
+ hint->base.state = HINT_STATE_NOTUSED;
+ hint->base.delete_func = (HintDeleteFunction) SetHintDelete;
+ hint->base.dump_func = (HintDumpFunction) SetHintDump;
+ hint->base.cmp_func = (HintCmpFunction) SetHintCmp;
+ hint->base.parser_func = (HintParseFunction) SetHintParse;
+ hint->name = NULL;
+ hint->value = NULL;
+
+ return (Hint *) hint;
+}
+
+static void
+SetHintDelete(SetHint *hint)
+{
+ if (!hint)
+ return;
+
+ if (hint->name)
+ pfree(hint->name);
+ if (hint->value)
+ pfree(hint->value);
+ pfree(hint);
+}
+
+static HintState *
+HintStateCreate(void)
+{
+ HintState *hstate;
+
+ hstate = palloc(sizeof(HintState));
+ hstate->hint_str = NULL;
+ hstate->nall_hints = 0;
+ hstate->max_all_hints = 0;
+ hstate->all_hints = NULL;
+ memset(hstate->num_hints, 0, sizeof(hstate->num_hints));
+ hstate->scan_hints = NULL;
+ hstate->init_scan_mask = 0;
+ hstate->parent_relid = 0;
+ hstate->parent_hint = NULL;
+ hstate->join_hints = NULL;
+ hstate->init_join_mask = 0;
+ hstate->join_hint_level = NULL;
+ hstate->leading_hint = NULL;
+ hstate->context = superuser() ? PGC_SUSET : PGC_USERSET;
+ hstate->set_hints = NULL;
+
+ return hstate;
+}
+
+static void
+HintStateDelete(HintState *hstate)
+{
+ int i;
+
+ if (!hstate)
+ return;
+
+ if (hstate->hint_str)
+ pfree(hstate->hint_str);
+
+ for (i = 0; i < hstate->num_hints[HINT_TYPE_SCAN_METHOD]; i++)
+ hstate->all_hints[i]->delete_func(hstate->all_hints[i]);
+ if (hstate->all_hints)
+ pfree(hstate->all_hints);
+}
+
+/*
+ * dump functions
+ */
+
+static void
+dump_quote_value(StringInfo buf, const char *value)
+{
+ bool need_quote = false;
+ const char *str;
+
+ for (str = value; *str != '\0'; str++)
+ {
+ if (isspace(*str) || *str == ')' || *str == '"')
+ {
+ need_quote = true;
+ appendStringInfoCharMacro(buf, '"');
+ break;
+ }
+ }
+
+ for (str = value; *str != '\0'; str++)
+ {
+ if (*str == '"')
+ appendStringInfoCharMacro(buf, '"');
+
+ appendStringInfoCharMacro(buf, *str);
+ }
+
+ if (need_quote)
+ appendStringInfoCharMacro(buf, '"');
+}
+
+static void
+ScanMethodHintDump(ScanMethodHint *hint, StringInfo buf)
+{
+ ListCell *l;
+
+ appendStringInfo(buf, "%s(", hint->base.keyword);
+ dump_quote_value(buf, hint->relname);
+ foreach(l, hint->indexnames)
+ {
+ appendStringInfoCharMacro(buf, ' ');
+ dump_quote_value(buf, (char *) lfirst(l));
+ }
+ appendStringInfoString(buf, ")\n");
+}
+
+static void
+JoinMethodHintDump(JoinMethodHint *hint, StringInfo buf)
+{
+ int i;
+
+ appendStringInfo(buf, "%s(", hint->base.keyword);
+ dump_quote_value(buf, hint->relnames[0]);
+ for (i = 1; i < hint->nrels; i++)
+ {
+ appendStringInfoCharMacro(buf, ' ');
+ dump_quote_value(buf, hint->relnames[i]);
+ }
+ appendStringInfoString(buf, ")\n");
+
+}
+
+static void
+LeadingHintDump(LeadingHint *hint, StringInfo buf)
+{
+ bool is_first;
+ ListCell *l;
+
+ appendStringInfo(buf, "%s(", HINT_LEADING);
+ is_first = true;
+ foreach(l, hint->relations)
+ {
+ if (is_first)
+ is_first = false;
+ else
+ appendStringInfoCharMacro(buf, ' ');
+
+ dump_quote_value(buf, (char *) lfirst(l));
+ }
+
+ appendStringInfoString(buf, ")\n");
+}
+
+static void
+SetHintDump(SetHint *hint, StringInfo buf)
+{
+ appendStringInfo(buf, "%s(", HINT_SET);
+ dump_quote_value(buf, hint->name);
+ appendStringInfoCharMacro(buf, ' ');
+ dump_quote_value(buf, hint->value);
+ appendStringInfo(buf, ")\n");
+}
+
+static void
+all_hint_dump(HintState *hstate, StringInfo buf, const char *title,
+ HintStatus state)
+{
+ int i;
+
+ appendStringInfo(buf, "%s:\n", title);
+ for (i = 0; i < hstate->nall_hints; i++)
+ {
+ if (hstate->all_hints[i]->state != state)
+ continue;
+
+ hstate->all_hints[i]->dump_func(hstate->all_hints[i], buf);
+ }
+}
+
+static void
+HintStateDump(HintState *hstate)
+{
+ StringInfoData buf;
+
+ if (!hstate)
+ {
+ elog(LOG, "pg_hint_plan:\nno hint");
+ return;
+ }
+
+ initStringInfo(&buf);
+
+ appendStringInfoString(&buf, "pg_hint_plan:\n");
+ all_hint_dump(hstate, &buf, "used hint", HINT_STATE_USED);
+ all_hint_dump(hstate, &buf, "not used hint", HINT_STATE_NOTUSED);
+ all_hint_dump(hstate, &buf, "duplication hint", HINT_STATE_DUPLICATION);
+ all_hint_dump(hstate, &buf, "error hint", HINT_STATE_ERROR);
+
+ elog(LOG, "%s", buf.data);
+
+ pfree(buf.data);
+}
+
+/*
+ * compare functions
+ */
+
+static int
+RelnameCmp(const void *a, const void *b)
+{
+ const char *relnamea = *((const char **) a);
+ const char *relnameb = *((const char **) b);
+
+ return strcmp(relnamea, relnameb);
+}
+
+static int
+ScanMethodHintCmp(const ScanMethodHint *a, const ScanMethodHint *b)
+{
+ return RelnameCmp(&a->relname, &b->relname);
+}
+
+static int
+JoinMethodHintCmp(const JoinMethodHint *a, const JoinMethodHint *b)
+{
+ int i;
+
+ if (a->nrels != b->nrels)
+ return a->nrels - b->nrels;
+
+ for (i = 0; i < a->nrels; i++)
+ {
+ int result;
+ if ((result = RelnameCmp(&a->relnames[i], &b->relnames[i])) != 0)
+ return result;
+ }
+
+ return 0;
+}
+
+static int
+LeadingHintCmp(const LeadingHint *a, const LeadingHint *b)
+{
+ return 0;
+}
+
+static int
+SetHintCmp(const SetHint *a, const SetHint *b)
+{
+ return strcmp(a->name, b->name);
+}
+
+static int
+HintCmp(const void *a, const void *b)
+{
+ const Hint *hinta = *((const Hint **) a);
+ const Hint *hintb = *((const Hint **) b);
+
+ if (hinta->type != hintb->type)
+ return hinta->type - hintb->type;
+
+ return hinta->cmp_func(hinta, hintb);
+}
+
+/*
+ * Returns byte offset of hint b from hint a. If hint a was specified before
+ * b, positive value is returned.
+ */
+static int
+HintCmpWithPos(const void *a, const void *b)
+{
+ const Hint *hinta = *((const Hint **) a);
+ const Hint *hintb = *((const Hint **) b);
+ int result;
+
+ result = HintCmp(a, b);
+ if (result == 0)
+ result = hinta->hint_str - hintb->hint_str;
+
+ return result;
+}
+
+/*
+ * parse functions
+ */
+static const char *
+parse_keyword(const char *str, StringInfo buf)
+{
+ skip_space(str);
+
+ while (!isspace(*str) && *str != '(' && *str != '\0')
+ appendStringInfoCharMacro(buf, *str++);
+
+ return str;
+}
+
+static const char *
+skip_opened_parenthesis(const char *str)
+{
+ skip_space(str);
+
+ if (*str != '(')
+ {
+ parse_ereport(str, ("Opening parenthesis is necessary."));
+ return NULL;
+ }
+
+ str++;
+
+ return str;
+}
+
+static const char *
+skip_closed_parenthesis(const char *str)
+{
+ skip_space(str);
+
+ if (*str != ')')
+ {
+ parse_ereport(str, ("Closing parenthesis is necessary."));
+ return NULL;
+ }
+
+ str++;
+
+ return str;
+}
+
+/*
+ * Parse a token from str, and store malloc'd copy into word. A token can be
+ * quoted with '"'. Return value is pointer to unparsed portion of original
+ * string, or NULL if an error occurred.
+ *
+ * Parsed token is truncated within NAMEDATALEN-1 bytes, when truncate is true.
+ */
+static const char *
+parse_quote_value(const char *str, char **word, char *value_type, bool truncate)
+{
+ StringInfoData buf;
+ bool in_quote;
+
+ /* Skip leading spaces. */
+ skip_space(str);
+
+ initStringInfo(&buf);
+ if (*str == '"')
+ {
+ str++;
+ in_quote = true;
+ }
+ else
+ in_quote = false;
+
+ while (true)
+ {
+ if (in_quote)
+ {
+ /* Double quotation must be closed. */
+ if (*str == '\0')
+ {
+ pfree(buf.data);
+ parse_ereport(str, ("Unterminated quoted %s.", value_type));
+ return NULL;
+ }
+
+ /*
+ * Skip escaped double quotation.
+ *
+ * We don't allow slash-asterisk and asterisk-slash (delimiters of
+ * block comments) to be an object name, so users must specify
+ * alias for such object names.
+ *
+ * Those special names can be allowed if we care escaped slashes
+ * and asterisks, but we don't.
+ */
+ if (*str == '"')
+ {
+ str++;
+ if (*str != '"')
+ break;
+ }
+ }
+ else if (isspace(*str) || *str == ')' || *str == '"' || *str == '\0')
+ break;
+
+ appendStringInfoCharMacro(&buf, *str++);
+ }
+
+ if (buf.len == 0)
+ {
+ char *type;
+
+ type = pstrdup(value_type);
+ type[0] = toupper(type[0]);
+ parse_ereport(str, ("%s is necessary.", type));
+
+ pfree(buf.data);
+ pfree(type);
+
+ return NULL;
+ }
+
+ /* Truncate name if it's too long */
+ if (truncate)
+ truncate_identifier(buf.data, strlen(buf.data), true);
+
+ *word = buf.data;
+
+ return str;
+}
+
+static void
+parse_hints(HintState *hstate, Query *parse, const char *str)
+{
+ StringInfoData buf;
+ char *head;
+
+ initStringInfo(&buf);
+ while (*str != '\0')
+ {
+ const HintParser *parser;
+
+ /* in error message, we output the comment including the keyword. */
+ head = (char *) str;
+
+ /* parse only the keyword of the hint. */
+ resetStringInfo(&buf);
+ str = parse_keyword(str, &buf);
+
+ for (parser = parsers; parser->keyword != NULL; parser++)
+ {
+ char *keyword = parser->keyword;
+ Hint *hint;
+
+ if (strcasecmp(buf.data, keyword) != 0)
+ continue;
+
+ hint = parser->create_func(head, keyword);
+
+ /* parser of each hint does parse in a parenthesis. */
+ if ((str = skip_opened_parenthesis(str)) == NULL ||
+ (str = hint->parser_func(hint, hstate, parse, str)) == NULL ||
+ (str = skip_closed_parenthesis(str)) == NULL)
+ {
+ hint->delete_func(hint);
+ pfree(buf.data);
+ return;
+ }
+
+ /*
+ * Add hint information into all_hints array. If we don't have
+ * enough space, double the array.
+ */
+ if (hstate->nall_hints == 0)
+ {
+ hstate->max_all_hints = HINT_ARRAY_DEFAULT_INITSIZE;
+ hstate->all_hints = (Hint **)
+ palloc(sizeof(Hint *) * hstate->max_all_hints);
+ }
+ else if (hstate->nall_hints == hstate->max_all_hints)
+ {
+ hstate->max_all_hints *= 2;
+ hstate->all_hints = (Hint **)
+ repalloc(hstate->all_hints,
+ sizeof(Hint *) * hstate->max_all_hints);
+ }
+
+ hstate->all_hints[hstate->nall_hints] = hint;
+ hstate->nall_hints++;
+
+ skip_space(str);
+
+ break;
+ }
+
+ if (parser->keyword == NULL)
+ {
+ parse_ereport(head,
+ ("Unrecognized hint keyword \"%s\".", buf.data));
+ pfree(buf.data);
+ return;
+ }
+ }
+
+ pfree(buf.data);
+}
+
+/*
+ * Do basic parsing of the query head comment.
+ */
+static HintState *
+parse_head_comment(Query *parse)
+{
+ const char *p;
+ char *head;
+ char *tail;
+ int len;
+ int i;
+ HintState *hstate;
+
+ /* get client-supplied query string. */
+ if (stmt_name)
+ {
+ PreparedStatement *entry;
+
+ entry = FetchPreparedStatement(stmt_name, true);
+ p = entry->plansource->query_string;
+ }
+ else
+ p = debug_query_string;
+
+ if (p == NULL)
+ return NULL;
+
+ /* extract query head comment. */
+ len = strlen(HINT_START);
+ skip_space(p);
+ if (strncmp(p, HINT_START, len))
+ return NULL;
+
+ head = (char *) p;
+ p += len;
+ skip_space(p);
+
+ /* find hint end keyword. */
+ if ((tail = strstr(p, HINT_END)) == NULL)
+ {
+ parse_ereport(head, ("Unterminated block comment."));
+ return NULL;
+ }
+
+ /* We don't support nested block comments. */
+ if ((head = strstr(p, BLOCK_COMMENT_START)) != NULL && head < tail)
+ {
+ parse_ereport(head, ("Nested block comments are not supported."));
+ return NULL;
+ }
+
+ /* Make a copy of hint. */
+ len = tail - p;
+ head = palloc(len + 1);
+ memcpy(head, p, len);
+ head[len] = '\0';
+ p = head;
+
+ hstate = HintStateCreate();
+ hstate->hint_str = head;
+
+ /* parse each hint. */
+ parse_hints(hstate, parse, p);
+
+ /* When nothing specified a hint, we free HintState and returns NULL. */
+ if (hstate->nall_hints == 0)
+ {
+ HintStateDelete(hstate);
+ return NULL;
+ }
+
+ /* Sort hints in order of original position. */
+ qsort(hstate->all_hints, hstate->nall_hints, sizeof(Hint *),
+ HintCmpWithPos);
+
+ /*
+ * If we have hints which are specified for an object, mark preceding one
+ * as 'duplicated' to ignore it in planner phase.
+ */
+ for (i = 0; i < hstate->nall_hints; i++)
+ {
+ Hint *cur_hint = hstate->all_hints[i];
+ Hint *next_hint;
+
+ /* Count up hints per hint-type. */
+ hstate->num_hints[cur_hint->type]++;
+
+ /* If we don't have next, nothing to compare. */
+ if (i + 1 >= hstate->nall_hints)
+ break;
+ next_hint = hstate->all_hints[i + 1];
+
+ /*
+ * We need to pass address of hint pointers, because HintCmp has
+ * been designed to be used with qsort.
+ */
+ if (HintCmp(&cur_hint, &next_hint) == 0)
+ {
+ parse_ereport(cur_hint->hint_str,
+ ("Conflict %s hint.", HintTypeName[cur_hint->type]));
+ cur_hint->state = HINT_STATE_DUPLICATION;
+ }
+ }
+
+ /*
+ * Make sure that per-type array pointers point proper position in the
+ * array which consists of all hints.
+ */
+ hstate->scan_hints = (ScanMethodHint **) hstate->all_hints;
+ hstate->join_hints = (JoinMethodHint **) hstate->all_hints +
+ hstate->num_hints[HINT_TYPE_SCAN_METHOD];
+ hstate->leading_hint = (LeadingHint *) hstate->all_hints[
+ hstate->num_hints[HINT_TYPE_SCAN_METHOD] +
+ hstate->num_hints[HINT_TYPE_JOIN_METHOD] +
+ hstate->num_hints[HINT_TYPE_LEADING] - 1];
+ hstate->set_hints = (SetHint **) hstate->all_hints +
+ hstate->num_hints[HINT_TYPE_SCAN_METHOD] +
+ hstate->num_hints[HINT_TYPE_JOIN_METHOD] +
+ hstate->num_hints[HINT_TYPE_LEADING];
+
+ return hstate;
+}
+
+/*
+ * Parse inside of parentheses of scan-method hints.
+ */
+static const char *
+ScanMethodHintParse(ScanMethodHint *hint, HintState *hstate, Query *parse,
+ const char *str)
+{
+ const char *keyword = hint->base.keyword;
+
+ /* Given hint is invalid if relation name can't be parsed. */
+ if ((str = parse_quote_value(str, &hint->relname, "relation name", true))
+ == NULL)
+ return NULL;
+
+ skip_space(str);
+
+ /* Parse index name(s) if given hint accepts. */
+ if (strcmp(keyword, HINT_INDEXSCAN) == 0 ||
+#if PG_VERSION_NUM >= 90200
+ strcmp(keyword, HINT_INDEXONLYSCAN) == 0 ||
+#endif
+ strcmp(keyword, HINT_BITMAPSCAN) == 0)
+ {
+ while (*str != ')' && *str != '\0')
+ {
+ char *indexname;
+
+ str = parse_quote_value(str, &indexname, "index name", true);
+ if (str == NULL)
+ return NULL;
+
+ hint->indexnames = lappend(hint->indexnames, indexname);
+ skip_space(str);
+ }
+ }
+
+ /* Set a bit for specified hint. */
+ if (strcasecmp(keyword, HINT_SEQSCAN) == 0)
+ hint->enforce_mask = ENABLE_SEQSCAN;
+ else if (strcasecmp(keyword, HINT_INDEXSCAN) == 0)
+ hint->enforce_mask = ENABLE_INDEXSCAN;
+ else if (strcasecmp(keyword, HINT_BITMAPSCAN) == 0)
+ hint->enforce_mask = ENABLE_BITMAPSCAN;
+ else if (strcasecmp(keyword, HINT_TIDSCAN) == 0)
+ hint->enforce_mask = ENABLE_TIDSCAN;
+ else if (strcasecmp(keyword, HINT_NOSEQSCAN) == 0)
+ hint->enforce_mask = ENABLE_ALL_SCAN ^ ENABLE_SEQSCAN;
+ else if (strcasecmp(keyword, HINT_NOINDEXSCAN) == 0)
+ hint->enforce_mask = ENABLE_ALL_SCAN ^ ENABLE_INDEXSCAN;
+ else if (strcasecmp(keyword, HINT_NOBITMAPSCAN) == 0)
+ hint->enforce_mask = ENABLE_ALL_SCAN ^ ENABLE_BITMAPSCAN;
+ else if (strcasecmp(keyword, HINT_NOTIDSCAN) == 0)
+ hint->enforce_mask = ENABLE_ALL_SCAN ^ ENABLE_TIDSCAN;
+#if PG_VERSION_NUM >= 90200
+ else if (strcasecmp(keyword, HINT_INDEXONLYSCAN) == 0)
+ hint->enforce_mask = ENABLE_INDEXSCAN | ENABLE_INDEXONLYSCAN;
+ else if (strcasecmp(keyword, HINT_NOINDEXONLYSCAN) == 0)
+ hint->enforce_mask = ENABLE_ALL_SCAN ^ ENABLE_INDEXONLYSCAN;
+#endif
+ else
+ {
+ parse_ereport(str, ("Unrecognized hint keyword \"%s\".", keyword));
+ return NULL;
+ }
+
+ return str;
+}
+
+static const char *
+JoinMethodHintParse(JoinMethodHint *hint, HintState *hstate, Query *parse,
+ const char *str)
+{
+ char *relname;
+ const char *keyword = hint->base.keyword;
+
+ skip_space(str);
+
+ hint->relnames = palloc(sizeof(char *));
+
+ while ((str = parse_quote_value(str, &relname, "relation name", true))
+ != NULL)
+ {
+ hint->nrels++;
+ hint->relnames = repalloc(hint->relnames, sizeof(char *) * hint->nrels);
+ hint->relnames[hint->nrels - 1] = relname;
+
+ skip_space(str);
+ if (*str == ')')
+ break;
+ }
+
+ if (str == NULL)
+ return NULL;
+
+ /* A join hint requires at least two relations to be specified. */
+ if (hint->nrels < 2)
+ {
+ parse_ereport(str,
+ ("%s hint requires at least two relations.",
+ hint->base.keyword));
+ hint->base.state = HINT_STATE_ERROR;
+ }
+
+ /* Sort hints in alphabetical order of relation names. */
+ qsort(hint->relnames, hint->nrels, sizeof(char *), RelnameCmp);
+
+ if (strcasecmp(keyword, HINT_NESTLOOP) == 0)
+ hint->enforce_mask = ENABLE_NESTLOOP;
+ else if (strcasecmp(keyword, HINT_MERGEJOIN) == 0)
+ hint->enforce_mask = ENABLE_MERGEJOIN;
+ else if (strcasecmp(keyword, HINT_HASHJOIN) == 0)
+ hint->enforce_mask = ENABLE_HASHJOIN;
+ else if (strcasecmp(keyword, HINT_NONESTLOOP) == 0)
+ hint->enforce_mask = ENABLE_ALL_JOIN ^ ENABLE_NESTLOOP;
+ else if (strcasecmp(keyword, HINT_NOMERGEJOIN) == 0)
+ hint->enforce_mask = ENABLE_ALL_JOIN ^ ENABLE_MERGEJOIN;
+ else if (strcasecmp(keyword, HINT_NOHASHJOIN) == 0)
+ hint->enforce_mask = ENABLE_ALL_JOIN ^ ENABLE_HASHJOIN;
+ else
+ {
+ parse_ereport(str, ("Unrecognized hint keyword \"%s\".", keyword));
+ return NULL;
+ }
+
+ return str;
+}
+
+static const char *
+LeadingHintParse(LeadingHint *hint, HintState *hstate, Query *parse,
+ const char *str)
+{
+ skip_space(str);
+
+ while (*str != ')')
+ {
+ char *relname;
+
+ if ((str = parse_quote_value(str, &relname, "relation name", true))
+ == NULL)
+ return NULL;
+
+ hint->relations = lappend(hint->relations, relname);
+
+ skip_space(str);
+ }
+
+ /* A Leading hint requires at least two relations to be specified. */
+ if (list_length(hint->relations) < 2)
+ {
+ parse_ereport(hint->base.hint_str,
+ ("%s hint requires at least two relations.",
+ HINT_LEADING));
+ hint->base.state = HINT_STATE_ERROR;
+ }
+
+ return str;
+}
+
+static const char *
+SetHintParse(SetHint *hint, HintState *hstate, Query *parse, const char *str)
+{
+ if ((str = parse_quote_value(str, &hint->name, "parameter name", true))
+ == NULL ||
+ (str = parse_quote_value(str, &hint->value, "parameter value", false))
+ == NULL)
+ return NULL;
+
+ return str;
+}
+
+/*
+ * set GUC parameter functions
+ */
+
+static int
+set_config_option_wrapper(const char *name, const char *value,
+ GucContext context, GucSource source,
+ GucAction action, bool changeVal, int elevel)
+{
+ int result = 0;
+ MemoryContext ccxt = CurrentMemoryContext;
+
+ PG_TRY();
+ {
+#if PG_VERSION_NUM >= 90200
+ result = set_config_option(name, value, context, source,
+ action, changeVal, 0);
+#else
+ result = set_config_option(name, value, context, source,
+ action, changeVal);
+#endif
+ }
+ PG_CATCH();
+ {
+ ErrorData *errdata;
+
+ /* Save error info */
+ MemoryContextSwitchTo(ccxt);
+ errdata = CopyErrorData();
+ FlushErrorState();
+
+ ereport(elevel, (errcode(errdata->sqlerrcode),
+ errmsg("%s", errdata->message),
+ errdata->detail ? errdetail("%s", errdata->detail) : 0,
+ errdata->hint ? errhint("%s", errdata->hint) : 0));
+ FreeErrorData(errdata);
+ }
+ PG_END_TRY();
+
+ return result;
+}
+
+static int
+set_config_options(SetHint **options, int noptions, GucContext context)
+{
+ int i;
+ int save_nestlevel;
+
+ save_nestlevel = NewGUCNestLevel();
+
+ for (i = 0; i < noptions; i++)
+ {
+ SetHint *hint = options[i];
+ int result;
+
+ if (!hint_state_enabled(hint))
+ continue;
+
+ result = set_config_option_wrapper(hint->name, hint->value, context,
+ PGC_S_SESSION, GUC_ACTION_SAVE, true,
+ pg_hint_plan_parse_messages);
+ if (result != 0)
+ hint->base.state = HINT_STATE_USED;
+ else
+ hint->base.state = HINT_STATE_ERROR;
+ }
+
+ return save_nestlevel;
+}
+
+#define SET_CONFIG_OPTION(name, type_bits) \
+ set_config_option_wrapper((name), \
+ (mask & (type_bits)) ? "true" : "false", \
+ context, PGC_S_SESSION, GUC_ACTION_SAVE, true, ERROR)
+
+static void
+set_scan_config_options(unsigned char enforce_mask, GucContext context)
+{
+ unsigned char mask;
+
+ if (enforce_mask == ENABLE_SEQSCAN || enforce_mask == ENABLE_INDEXSCAN ||
+ enforce_mask == ENABLE_BITMAPSCAN || enforce_mask == ENABLE_TIDSCAN
+#if PG_VERSION_NUM >= 90200
+ || enforce_mask == (ENABLE_INDEXSCAN | ENABLE_INDEXONLYSCAN)
+#endif
+ )
+ mask = enforce_mask;
+ else
+ mask = enforce_mask & current_hint->init_scan_mask;
+
+ SET_CONFIG_OPTION("enable_seqscan", ENABLE_SEQSCAN);
+ SET_CONFIG_OPTION("enable_indexscan", ENABLE_INDEXSCAN);
+ SET_CONFIG_OPTION("enable_bitmapscan", ENABLE_BITMAPSCAN);
+ SET_CONFIG_OPTION("enable_tidscan", ENABLE_TIDSCAN);
+#if PG_VERSION_NUM >= 90200
+ SET_CONFIG_OPTION("enable_indexonlyscan", ENABLE_INDEXONLYSCAN);
+#endif
+}
+
+static void
+set_join_config_options(unsigned char enforce_mask, GucContext context)
+{
+ unsigned char mask;
+
+ if (enforce_mask == ENABLE_NESTLOOP || enforce_mask == ENABLE_MERGEJOIN ||
+ enforce_mask == ENABLE_HASHJOIN)
+ mask = enforce_mask;
+ else
+ mask = enforce_mask & current_hint->init_join_mask;
+
+ SET_CONFIG_OPTION("enable_nestloop", ENABLE_NESTLOOP);
+ SET_CONFIG_OPTION("enable_mergejoin", ENABLE_MERGEJOIN);
+ SET_CONFIG_OPTION("enable_hashjoin", ENABLE_HASHJOIN);
+}
+
+/*
+ * pg_hint_plan hook functions
+ */
+
+static void
+pg_hint_plan_ProcessUtility(Node *parsetree, const char *queryString,
+ ParamListInfo params, bool isTopLevel,
+ DestReceiver *dest, char *completionTag)
+{
+ Node *node;
+
+ if (!pg_hint_plan_enable_hint)
+ {
+ if (prev_ProcessUtility)
+ (*prev_ProcessUtility) (parsetree, queryString, params,
+ isTopLevel, dest, completionTag);
+ else
+ standard_ProcessUtility(parsetree, queryString, params,
+ isTopLevel, dest, completionTag);
+
+ return;
+ }
+
+ node = parsetree;
+ if (IsA(node, ExplainStmt))
+ {
+ /*
+ * Draw out parse tree of actual query from Query struct of EXPLAIN
+ * statement.
+ */
+ ExplainStmt *stmt;
+ Query *query;
+
+ stmt = (ExplainStmt *) node;
+
+ Assert(IsA(stmt->query, Query));
+ query = (Query *) stmt->query;
+
+ if (query->commandType == CMD_UTILITY && query->utilityStmt != NULL)
+ node = query->utilityStmt;
+ }
+
+ /*
+ * If the query was a EXECUTE or CREATE TABLE AS EXECUTE, get query string
+ * specified to preceding PREPARE command to use it as source of hints.
+ */
+ if (IsA(node, ExecuteStmt))
+ {
+ ExecuteStmt *stmt;
+
+ stmt = (ExecuteStmt *) node;
+ stmt_name = stmt->name;
+ }
+#if PG_VERSION_NUM >= 90200
+ /*
+ * CREATE AS EXECUTE behavior has changed since 9.2, so we must handle it
+ * specially here.
+ */
+ if (IsA(node, CreateTableAsStmt))
+ {
+ CreateTableAsStmt *stmt;
+ Query *query;
+
+ stmt = (CreateTableAsStmt *) node;
+ Assert(IsA(stmt->query, Query));
+ query = (Query *) stmt->query;
+
+ if (query->commandType == CMD_UTILITY &&
+ IsA(query->utilityStmt, ExecuteStmt))
+ {
+ ExecuteStmt *estmt = (ExecuteStmt *) query->utilityStmt;
+ stmt_name = estmt->name;
+ }
+ }
+#endif
+ if (stmt_name)
+ {
+ PG_TRY();
+ {
+ if (prev_ProcessUtility)
+ (*prev_ProcessUtility) (parsetree, queryString, params,
+ isTopLevel, dest, completionTag);
+ else
+ standard_ProcessUtility(parsetree, queryString, params,
+ isTopLevel, dest, completionTag);
+ }
+ PG_CATCH();
+ {
+ stmt_name = NULL;
+ PG_RE_THROW();
+ }
+ PG_END_TRY();
+
+ stmt_name = NULL;
+
+ return;
+ }
+
+ if (prev_ProcessUtility)
+ (*prev_ProcessUtility) (parsetree, queryString, params,
+ isTopLevel, dest, completionTag);
+ else
+ standard_ProcessUtility(parsetree, queryString, params,
+ isTopLevel, dest, completionTag);
+}
+
+/*
+ * Push a hint into hint stack which is implemented with List struct. Head of
+ * list is top of stack.
+ */
+static void
+push_hint(HintState *hstate)
+{
+ /* Prepend new hint to the list means pushing to stack. */
+ HintStateStack = lcons(hstate, HintStateStack);
+
+ /* Pushed hint is the one which should be used hereafter. */
+ current_hint = hstate;
+}
+
+/* Pop a hint from hint stack. Popped hint is automatically discarded. */
+static void
+pop_hint(void)
+{
+ /* Hint stack must not be empty. */
+ if(HintStateStack == NIL)
+ elog(ERROR, "hint stack is empty");
+
+ /*
+ * Take a hint at the head from the list, and free it. Switch current_hint
+ * to point new head (NULL if the list is empty).
+ */
+ HintStateStack = list_delete_first(HintStateStack);
+ HintStateDelete(current_hint);
+ if(HintStateStack == NIL)
+ current_hint = NULL;
+ else
+ current_hint = (HintState *) lfirst(list_head(HintStateStack));
+}
+
+static PlannedStmt *
+pg_hint_plan_planner(Query *parse, int cursorOptions, ParamListInfo boundParams)
+{
+ int save_nestlevel;
+ PlannedStmt *result;
+ HintState *hstate;
+
+ /*
+ * Use standard planner if pg_hint_plan is disabled. Other hook functions
+ * try to change plan with current_hint if any, so set it to NULL.
+ */
+ if (!pg_hint_plan_enable_hint)
+ {
+ current_hint = NULL;
+
+ if (prev_planner)
+ return (*prev_planner) (parse, cursorOptions, boundParams);
+ else
+ return standard_planner(parse, cursorOptions, boundParams);
+ }
+
+ /* Create hint struct from parse tree. */
+ hstate = parse_head_comment(parse);
+
+ /*
+ * Use standard planner if the statement has not valid hint. Other hook
+ * functions try to change plan with current_hint if any, so set it to
+ * NULL.
+ */
+ if (!hstate)
+ {
+ current_hint = NULL;
+
+ if (prev_planner)
+ return (*prev_planner) (parse, cursorOptions, boundParams);
+ else
+ return standard_planner(parse, cursorOptions, boundParams);
+ }
+
+ /*
+ * Push new hint struct to the hint stack to disable previous hint context.
+ */
+ push_hint(hstate);
+
+ /* Set GUC parameters which are specified with Set hint. */
+ save_nestlevel = set_config_options(current_hint->set_hints,
+ current_hint->num_hints[HINT_TYPE_SET],
+ current_hint->context);
+
+ if (enable_seqscan)
+ current_hint->init_scan_mask |= ENABLE_SEQSCAN;
+ if (enable_indexscan)
+ current_hint->init_scan_mask |= ENABLE_INDEXSCAN;
+ if (enable_bitmapscan)
+ current_hint->init_scan_mask |= ENABLE_BITMAPSCAN;
+ if (enable_tidscan)
+ current_hint->init_scan_mask |= ENABLE_TIDSCAN;
+#if PG_VERSION_NUM >= 90200
+ if (enable_indexonlyscan)
+ current_hint->init_scan_mask |= ENABLE_INDEXONLYSCAN;
+#endif
+ if (enable_nestloop)
+ current_hint->init_join_mask |= ENABLE_NESTLOOP;
+ if (enable_mergejoin)
+ current_hint->init_join_mask |= ENABLE_MERGEJOIN;
+ if (enable_hashjoin)
+ current_hint->init_join_mask |= ENABLE_HASHJOIN;
+
+ /*
+ * Use PG_TRY mechanism to recover GUC parameters and current_hint to the
+ * state when this planner started when error occurred in planner.
+ */
+ PG_TRY();
+ {
+ if (prev_planner)
+ result = (*prev_planner) (parse, cursorOptions, boundParams);
+ else
+ result = standard_planner(parse, cursorOptions, boundParams);
+ }
+ PG_CATCH();
+ {
+ /*
+ * Rollback changes of GUC parameters, and pop current hint context
+ * from hint stack to rewind the state.
+ */
+ AtEOXact_GUC(true, save_nestlevel);
+ pop_hint();
+ PG_RE_THROW();
+ }
+ PG_END_TRY();
+
+ /* Print hint in debug mode. */
+ if (pg_hint_plan_debug_print)
+ HintStateDump(current_hint);
+
+ /*
+ * Rollback changes of GUC parameters, and pop current hint context from
+ * hint stack to rewind the state.
+ */
+ AtEOXact_GUC(true, save_nestlevel);
+ pop_hint();
+
+ return result;
+}
+
+/*
+ * Return scan method hint which matches given aliasname.
+ */
+static ScanMethodHint *
+find_scan_hint(PlannerInfo *root, RelOptInfo *rel)
+{
+ RangeTblEntry *rte;
+ int i;
+
+ /*
+ * We can't apply scan method hint if the relation is:
+ * - not a base relation
+ * - not an ordinary relation (such as join and subquery)
+ */
+ if (rel->reloptkind != RELOPT_BASEREL || rel->rtekind != RTE_RELATION)
+ return NULL;
+
+ rte = root->simple_rte_array[rel->relid];
+
+ /* We can't force scan method of foreign tables */
+ if (rte->relkind == RELKIND_FOREIGN_TABLE)
+ return NULL;
+
+ /* Find scan method hint, which matches given names, from the list. */
+ for (i = 0; i < current_hint->num_hints[HINT_TYPE_SCAN_METHOD]; i++)
+ {
+ ScanMethodHint *hint = current_hint->scan_hints[i];
+
+ /* We ignore disabled hints. */
+ if (!hint_state_enabled(hint))
+ continue;
+
+ if (RelnameCmp(&rte->eref->aliasname, &hint->relname) == 0)
+ return hint;
+ }
+
+ return NULL;
+}
+
+static void
+delete_indexes(ScanMethodHint *hint, RelOptInfo *rel)
+{
+ ListCell *cell;
+ ListCell *prev;
+ ListCell *next;
+
+ /*
+ * We delete all the IndexOptInfo list and prevent you from being usable by
+ * a scan.
+ */
+ if (hint->enforce_mask == ENABLE_SEQSCAN ||
+ hint->enforce_mask == ENABLE_TIDSCAN)
+ {
+ list_free_deep(rel->indexlist);
+ rel->indexlist = NIL;
+ hint->base.state = HINT_STATE_USED;
+
+ return;
+ }
+
+ /*
+ * When a list of indexes is not specified, we just use all indexes.
+ */
+ if (hint->indexnames == NIL)
+ return;
+
+ /*
+ * Leaving only an specified index, we delete it from a IndexOptInfo list
+ * other than it.
+ */
+ prev = NULL;
+ for (cell = list_head(rel->indexlist); cell; cell = next)
+ {
+ IndexOptInfo *info = (IndexOptInfo *) lfirst(cell);
+ char *indexname = get_rel_name(info->indexoid);
+ ListCell *l;
+ bool use_index = false;
+
+ next = lnext(cell);
+
+ foreach(l, hint->indexnames)
+ {
+ if (RelnameCmp(&indexname, &lfirst(l)) == 0)
+ {
+ use_index = true;
+ break;
+ }
+ }
+
+ if (!use_index)
+ rel->indexlist = list_delete_cell(rel->indexlist, cell, prev);
+ else
+ prev = cell;
+
+ pfree(indexname);
+ }
+}
+
+static void
+pg_hint_plan_get_relation_info(PlannerInfo *root, Oid relationObjectId,
+ bool inhparent, RelOptInfo *rel)
+{
+ ScanMethodHint *hint;
+
+ if (prev_get_relation_info)
+ (*prev_get_relation_info) (root, relationObjectId, inhparent, rel);
+
+ /* Do nothing if we don't have valid hint in this context. */
+ if (!current_hint)
+ return;
+
+ if (inhparent)
+ {
+ /* store does relids of parent table. */
+ current_hint->parent_relid = rel->relid;
+ }
+ else if (current_hint->parent_relid != 0)
+ {
+ /*
+ * We use the same GUC parameter if this table is the child table of a
+ * table called pg_hint_plan_get_relation_info just before that.
+ */
+ ListCell *l;
+
+ /* append_rel_list contains all append rels; ignore others */
+ foreach(l, root->append_rel_list)
+ {
+ AppendRelInfo *appinfo = (AppendRelInfo *) lfirst(l);
+
+ /* This rel is child table. */
+ if (appinfo->parent_relid == current_hint->parent_relid &&
+ appinfo->child_relid == rel->relid)
+ {
+ if (current_hint->parent_hint)
+ delete_indexes(current_hint->parent_hint, rel);
+
+ return;
+ }
+ }
+
+ /* This rel is not inherit table. */
+ current_hint->parent_relid = 0;
+ current_hint->parent_hint = NULL;
+ }
+
+ /*
+ * If scan method hint was given, reset GUC parameters which control
+ * planner behavior about choosing scan methods.
+ */
+ if ((hint = find_scan_hint(root, rel)) == NULL)
+ {
+ set_scan_config_options(current_hint->init_scan_mask,
+ current_hint->context);
+ return;
+ }
+ set_scan_config_options(hint->enforce_mask, current_hint->context);
+ hint->base.state = HINT_STATE_USED;
+ if (inhparent)
+ current_hint->parent_hint = hint;
+
+ delete_indexes(hint, rel);
+}
+
+/*
+ * Return index of relation which matches given aliasname, or 0 if not found.
+ * If same aliasname was used multiple times in a query, return -1.
+ */
+static int
+find_relid_aliasname(PlannerInfo *root, char *aliasname, List *initial_rels,
+ const char *str)
+{
+ int i;
+ Index found = 0;
+
+ for (i = 1; i < root->simple_rel_array_size; i++)
+ {
+ ListCell *l;
+
+ if (root->simple_rel_array[i] == NULL)
+ continue;
+
+ Assert(i == root->simple_rel_array[i]->relid);
+
+ if (RelnameCmp(&aliasname,
+ &root->simple_rte_array[i]->eref->aliasname) != 0)
+ continue;
+
+ foreach(l, initial_rels)
+ {
+ RelOptInfo *rel = (RelOptInfo *) lfirst(l);
+
+ if (rel->reloptkind == RELOPT_BASEREL)
+ {
+ if (rel->relid != i)
+ continue;
+ }
+ else
+ {
+ Assert(rel->reloptkind == RELOPT_JOINREL);
+
+ if (!bms_is_member(i, rel->relids))
+ continue;
+ }
+
+ if (found != 0)
+ {
+ parse_ereport(str,
+ ("Relation name \"%s\" is ambiguous.",
+ aliasname));
+ return -1;
+ }
+
+ found = i;
+ break;
+ }
+
+ }
+
+ return found;
+}
+
+/*
+ * Return join hint which matches given joinrelids.
+ */
+static JoinMethodHint *
+find_join_hint(Relids joinrelids)
+{
+ List *join_hint;
+ ListCell *l;
+
+ join_hint = current_hint->join_hint_level[bms_num_members(joinrelids)];
+
+ foreach(l, join_hint)
+ {
+ JoinMethodHint *hint = (JoinMethodHint *) lfirst(l);
+
+ if (bms_equal(joinrelids, hint->joinrelids))
+ return hint;
+ }
+
+ return NULL;
+}
+
+/*
+ * Transform join method hint into handy form.
+ *
+ * - create bitmap of relids from alias names, to make it easier to check
+ * whether a join path matches a join method hint.
+ * - add join method hints which are necessary to enforce join order
+ * specified by Leading hint
+ */
+static void
+transform_join_hints(HintState *hstate, PlannerInfo *root, int nbaserel,
+ List *initial_rels, JoinMethodHint **join_method_hints)
+{
+ int i;
+ int relid;
+ LeadingHint *lhint;
+ Relids joinrelids;
+ int njoinrels;
+ ListCell *l;
+
+ /*
+ * Create bitmap of relids from alias names for each join method hint.
+ * Bitmaps are more handy than strings in join searching.
+ */
+ for (i = 0; i < hstate->num_hints[HINT_TYPE_JOIN_METHOD]; i++)
+ {
+ JoinMethodHint *hint = hstate->join_hints[i];
+ int j;
+
+ if (!hint_state_enabled(hint) || hint->nrels > nbaserel)
+ continue;
+
+ bms_free(hint->joinrelids);
+ hint->joinrelids = NULL;
+ relid = 0;
+ for (j = 0; j < hint->nrels; j++)
+ {
+ char *relname = hint->relnames[j];
+
+ relid = find_relid_aliasname(root, relname, initial_rels,
+ hint->base.hint_str);
+
+ if (relid == -1)
+ hint->base.state = HINT_STATE_ERROR;
+
+ if (relid <= 0)
+ break;
+
+ if (bms_is_member(relid, hint->joinrelids))
+ {
+ parse_ereport(hint->base.hint_str,
+ ("Relation name \"%s\" is duplicated.", relname));
+ hint->base.state = HINT_STATE_ERROR;
+ break;
+ }
+
+ hint->joinrelids = bms_add_member(hint->joinrelids, relid);
+ }
+
+ if (relid <= 0 || hint->base.state == HINT_STATE_ERROR)
+ continue;
+
+ hstate->join_hint_level[hint->nrels] =
+ lappend(hstate->join_hint_level[hint->nrels], hint);
+ }
+
+ /* Do nothing if no Leading hint was supplied. */
+ if (hstate->num_hints[HINT_TYPE_LEADING] == 0)
+ return;
+
+ /* Do nothing if Leading hint is invalid. */
+ lhint = hstate->leading_hint;
+ if (!hint_state_enabled(lhint))
+ return;
+
+ /*
+ * We need join method hints which fit specified join order in every join
+ * level. For example, Leading(A B C) virtually requires following join
+ * method hints, if no join method hint supplied:
+ * - level 1: none
+ * - level 2: NestLoop(A B), MergeJoin(A B), HashJoin(A B)
+ * - level 3: NestLoop(A B C), MergeJoin(A B C), HashJoin(A B C)
+ *
+ * If we already have join method hint which fits specified join order in
+ * that join level, we leave it as-is and don't add new hints.
+ */
+ joinrelids = NULL;
+ njoinrels = 0;
+ foreach(l, lhint->relations)
+ {
+ char *relname = (char *)lfirst(l);
+ JoinMethodHint *hint;
+
+ /*
+ * Find relid of the relation which has given name. If we have the
+ * name given in Leading hint multiple times in the join, nothing to
+ * do.
+ */
+ relid = find_relid_aliasname(root, relname, initial_rels,
+ hstate->hint_str);
+ if (relid == -1)
+ {
+ bms_free(joinrelids);
+ return;
+ }
+ if (relid == 0)
+ continue;
+
+ /* Found relid must not be in joinrelids. */
+ if (bms_is_member(relid, joinrelids))
+ {
+ parse_ereport(lhint->base.hint_str,
+ ("Relation name \"%s\" is duplicated.", relname));
+ lhint->base.state = HINT_STATE_ERROR;
+ bms_free(joinrelids);
+ return;
+ }
+
+ /* Create bitmap of relids for current join level. */
+ joinrelids = bms_add_member(joinrelids, relid);
+ njoinrels++;
+
+ /* We never have join method hint for single relation. */
+ if (njoinrels < 2)
+ continue;
+
+ /*
+ * If we don't have join method hint, create new one for the
+ * join combination with all join methods are enabled.
+ */
+ hint = find_join_hint(joinrelids);
+ if (hint == NULL)
+ {
+ /*
+ * Here relnames is not set, since Relids bitmap is sufficient to
+ * control paths of this query afterward.
+ */
+ hint = (JoinMethodHint *) JoinMethodHintCreate(lhint->base.hint_str,
+ HINT_LEADING);
+ hint->base.state = HINT_STATE_USED;
+ hint->nrels = njoinrels;
+ hint->enforce_mask = ENABLE_ALL_JOIN;
+ hint->joinrelids = bms_copy(joinrelids);
+ }
+
+ join_method_hints[njoinrels] = hint;
+
+ if (njoinrels >= nbaserel)
+ break;
+ }
+
+ bms_free(joinrelids);
+
+ if (njoinrels < 2)
+ return;
+
+ /*
+ * Delete all join hints which have different combination from Leading
+ * hint.
+ */
+ for (i = 2; i <= njoinrels; i++)
+ {
+ list_free(hstate->join_hint_level[i]);
+
+ hstate->join_hint_level[i] = lappend(NIL, join_method_hints[i]);
+ }
+
+ if (hint_state_enabled(lhint))
+ set_join_config_options(DISABLE_ALL_JOIN, current_hint->context);
+
+ lhint->base.state = HINT_STATE_USED;
+
+}
+
+/*
+ * set_plain_rel_pathlist
+ * Build access paths for a plain relation (no subquery, no inheritance)
+ *
+ * This function was copied and edited from set_plain_rel_pathlist() in
+ * src/backend/optimizer/path/allpaths.c
+ */
+static void
+set_plain_rel_pathlist(PlannerInfo *root, RelOptInfo *rel, RangeTblEntry *rte)
+{
+ /* Consider sequential scan */
+#if PG_VERSION_NUM >= 90200
+ add_path(rel, create_seqscan_path(root, rel, NULL));
+#else
+ add_path(rel, create_seqscan_path(root, rel));
+#endif
+
+ /* Consider index scans */
+ create_index_paths(root, rel);
+
+ /* Consider TID scans */
+ create_tidscan_paths(root, rel);
+
+ /* Now find the cheapest of the paths for this rel */
+ set_cheapest(rel);
+}
+
+static void
+rebuild_scan_path(HintState *hstate, PlannerInfo *root, int level,
+ List *initial_rels)
+{
+ ListCell *l;
+
+ foreach(l, initial_rels)
+ {
+ RelOptInfo *rel = (RelOptInfo *) lfirst(l);
+ RangeTblEntry *rte;
+ ScanMethodHint *hint;
+
+ /* Skip relations which we can't choose scan method. */
+ if (rel->reloptkind != RELOPT_BASEREL || rel->rtekind != RTE_RELATION)
+ continue;
+
+ rte = root->simple_rte_array[rel->relid];
+
+ /* We can't force scan method of foreign tables */
+ if (rte->relkind == RELKIND_FOREIGN_TABLE)
+ continue;
+
+ /*
+ * Create scan paths with GUC parameters which are at the beginning of
+ * planner if scan method hint is not specified, otherwise use
+ * specified hints and mark the hint as used.
+ */
+ if ((hint = find_scan_hint(root, rel)) == NULL)
+ set_scan_config_options(hstate->init_scan_mask,
+ hstate->context);
+ else
+ {
+ set_scan_config_options(hint->enforce_mask, hstate->context);
+ hint->base.state = HINT_STATE_USED;
+ }
+
+ list_free_deep(rel->pathlist);
+ rel->pathlist = NIL;
+ if (rte->inh)
+ {
+ /* It's an "append relation", process accordingly */
+ set_append_rel_pathlist(root, rel, rel->relid, rte);
+ }
+ else
+ {
+ set_plain_rel_pathlist(root, rel, rte);
+ }
+ }
+
+ /*
+ * Restore the GUC variables we set above.
+ */
+ set_scan_config_options(hstate->init_scan_mask, hstate->context);
+}
+
+/*
+ * wrapper of make_join_rel()
+ *
+ * call make_join_rel() after changing enable_* parameters according to given
+ * hints.
+ */
+static RelOptInfo *
+make_join_rel_wrapper(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2)
+{
+ Relids joinrelids;
+ JoinMethodHint *hint;
+ RelOptInfo *rel;
+ int save_nestlevel;
+
+ joinrelids = bms_union(rel1->relids, rel2->relids);
+ hint = find_join_hint(joinrelids);
+ bms_free(joinrelids);
+
+ if (!hint)
+ return pg_hint_plan_make_join_rel(root, rel1, rel2);
+
+ save_nestlevel = NewGUCNestLevel();
+
+ set_join_config_options(hint->enforce_mask, current_hint->context);
+
+ rel = pg_hint_plan_make_join_rel(root, rel1, rel2);
+ hint->base.state = HINT_STATE_USED;
+
+ /*
+ * Restore the GUC variables we set above.
+ */
+ AtEOXact_GUC(true, save_nestlevel);
+
+ return rel;
+}
+
+static int
+get_num_baserels(List *initial_rels)
+{
+ int nbaserel = 0;
+ ListCell *l;
+
+ foreach(l, initial_rels)
+ {
+ RelOptInfo *rel = (RelOptInfo *) lfirst(l);
+
+ if (rel->reloptkind == RELOPT_BASEREL)
+ nbaserel++;
+ else if (rel->reloptkind ==RELOPT_JOINREL)
+ nbaserel+= bms_num_members(rel->relids);
+ else
+ {
+ /* other values not expected here */
+ elog(ERROR, "Unrecognized reloptkind type: %d", rel->reloptkind);
+ }
+ }
+
+ return nbaserel;
+}
+
+static RelOptInfo *
+pg_hint_plan_join_search(PlannerInfo *root, int levels_needed,
+ List *initial_rels)
+{
+ JoinMethodHint **join_method_hints;
+ int nbaserel;
+ RelOptInfo *rel;
+ int i;
+
+ /*
+ * Use standard planner (or geqo planner) if pg_hint_plan is disabled or no
+ * valid hint is supplied.
+ */
+ if (!current_hint)
+ {
+ if (prev_join_search)
+ return (*prev_join_search) (root, levels_needed, initial_rels);
+ else if (enable_geqo && levels_needed >= geqo_threshold)
+ return geqo(root, levels_needed, initial_rels);
+ else
+ return standard_join_search(root, levels_needed, initial_rels);
+ }
+
+ /* We apply scan method hint rebuild scan path. */
+ rebuild_scan_path(current_hint, root, levels_needed, initial_rels);
+
+ /*
+ * In the case using GEQO, only scan method hints and Set hints have
+ * effect. Join method and join order is not controllable by hints.
+ */
+ if (enable_geqo && levels_needed >= geqo_threshold)
+ return geqo(root, levels_needed, initial_rels);
+
+ nbaserel = get_num_baserels(initial_rels);
+ current_hint->join_hint_level = palloc0(sizeof(List *) * (nbaserel + 1));
+ join_method_hints = palloc0(sizeof(JoinMethodHint *) * (nbaserel + 1));
+
+ transform_join_hints(current_hint, root, nbaserel, initial_rels,
+ join_method_hints);
+
+ rel = pg_hint_plan_standard_join_search(root, levels_needed, initial_rels);
+
+ for (i = 2; i <= nbaserel; i++)
+ {
+ list_free(current_hint->join_hint_level[i]);
+
+ /* free Leading hint only */
+ if (join_method_hints[i] != NULL &&
+ join_method_hints[i]->enforce_mask == ENABLE_ALL_JOIN)
+ JoinMethodHintDelete(join_method_hints[i]);
+ }
+ pfree(current_hint->join_hint_level);
+ pfree(join_method_hints);
+
+ if (current_hint->num_hints[HINT_TYPE_LEADING] > 0 &&
+ hint_state_enabled(current_hint->leading_hint))
+ set_join_config_options(current_hint->init_join_mask,
+ current_hint->context);
+
+ return rel;
+}
+
+/*
+ * set_rel_pathlist
+ * Build access paths for a base relation
+ *
+ * This function was copied and edited from set_rel_pathlist() in
+ * src/backend/optimizer/path/allpaths.c
+ */
+static void
+set_rel_pathlist(PlannerInfo *root, RelOptInfo *rel,
+ Index rti, RangeTblEntry *rte)
+{
+#if PG_VERSION_NUM >= 90200
+ if (IS_DUMMY_REL(rel))
+ {
+ /* We already proved the relation empty, so nothing more to do */
+ }
+ else if (rte->inh)
+#else
+ if (rte->inh)
+#endif
+ {
+ /* It's an "append relation", process accordingly */
+ set_append_rel_pathlist(root, rel, rti, rte);
+ }
+ else
+ {
+ if (rel->rtekind == RTE_RELATION)
+ {
+ if (rte->relkind == RELKIND_RELATION)
+ {
+ /* Plain relation */
+ set_plain_rel_pathlist(root, rel, rte);
+ }
+ else
+ elog(ERROR, "Unexpected relkind: %c", rte->relkind);
+ }
+ else
+ elog(ERROR, "Unexpected rtekind: %d", (int) rel->rtekind);
+ }
+}
+
+#define standard_join_search pg_hint_plan_standard_join_search
+#define join_search_one_level pg_hint_plan_join_search_one_level
+#define make_join_rel make_join_rel_wrapper
+#include "core.c"
+
+#undef make_join_rel
+#define make_join_rel pg_hint_plan_make_join_rel
+#define add_paths_to_joinrel(root, joinrel, outerrel, innerrel, jointype, sjinfo, restrictlist) \
+do { \
+ ScanMethodHint *hint = NULL; \
+ if ((hint = find_scan_hint((root), (innerrel))) != NULL) \
+ { \
+ set_scan_config_options(hint->enforce_mask, current_hint->context); \
+ hint->base.state = HINT_STATE_USED; \
+ } \
+ add_paths_to_joinrel((root), (joinrel), (outerrel), (innerrel), (jointype), (sjinfo), (restrictlist)); \
+ if (hint != NULL) \
+ set_scan_config_options(current_hint->init_scan_mask, current_hint->context); \
+} while(0)
+#include "make_join_rel.c"
--- /dev/null
+SET search_path TO public;
+
+-- query type 1
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+-- query type 2
+EXPLAIN (COSTS false) SELECT * FROM t1, t4 WHERE t1.val < 10;
+-- query type 3
+EXPLAIN (COSTS false) SELECT * FROM t3, t4 WHERE t3.id = t4.id AND t4.ctid = '(1,1)';
+-- query type 4
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)';
+-- query type 5
+EXPLAIN (COSTS false) SELECT * FROM t1, t3 WHERE t1.val = t3.val;
+-- query type 6
+EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
--- /dev/null
+SET search_path TO public;
+
+CREATE SCHEMA s0;
+
+CREATE TABLE t1 (id int PRIMARY KEY, val int);
+CREATE TABLE t2 (id int PRIMARY KEY, val int);
+CREATE TABLE t3 (id int PRIMARY KEY, val int);
+CREATE TABLE t4 (id int PRIMARY KEY, val int);
+CREATE TABLE p1 (id int PRIMARY KEY, val int);
+CREATE TABLE p1_c1 (LIKE p1 INCLUDING ALL, CHECK (id <= 100)) INHERITS(p1);
+CREATE TABLE p1_c2 (LIKE p1 INCLUDING ALL, CHECK (id > 100 AND id <= 200)) INHERITS(p1);
+CREATE TABLE p1_c3 (LIKE p1 INCLUDING ALL, CHECK (id > 200 AND id <= 300)) INHERITS(p1);
+CREATE TABLE p1_c4 (LIKE p1 INCLUDING ALL, CHECK (id > 300)) INHERITS(p1);
+CREATE TABLE p1_c1_c1 (LIKE p1 INCLUDING ALL, CHECK (id <= 50)) INHERITS(p1_c1);
+CREATE TABLE p1_c1_c2 (LIKE p1 INCLUDING ALL, CHECK (id > 50 AND id <= 100)) INHERITS(p1_c1);
+CREATE TABLE p1_c3_c1 (LIKE p1 INCLUDING ALL, CHECK (id > 200 AND id <= 250)) INHERITS(p1_c3);
+CREATE TABLE p1_c3_c2 (LIKE p1 INCLUDING ALL, CHECK (id > 250 AND id <= 300)) INHERITS(p1_c3);
+CREATE TABLE s0.t1 (id int PRIMARY KEY, val int);
+
+INSERT INTO t1 SELECT i, i % 100 FROM (SELECT generate_series(1, 10000) i) t;
+INSERT INTO t2 SELECT i, i % 10 FROM (SELECT generate_series(1, 1000) i) t;
+INSERT INTO t3 SELECT i, i FROM (SELECT generate_series(1, 100) i) t;
+INSERT INTO t4 SELECT i, i FROM (SELECT generate_series(1, 10) i) t;
+INSERT INTO p1_c1_c1 SELECT i, i % 100 FROM (SELECT generate_series(1, 50) i) t;
+INSERT INTO p1_c1_c2 SELECT i, i % 100 FROM (SELECT generate_series(51, 100) i) t;
+INSERT INTO p1_c2 SELECT i, i % 100 FROM (SELECT generate_series(101, 200) i) t;
+INSERT INTO p1_c3_c1 SELECT i, i % 100 FROM (SELECT generate_series(201, 250) i) t;
+INSERT INTO p1_c3_c2 SELECT i, i % 100 FROM (SELECT generate_series(251, 300) i) t;
+INSERT INTO p1_c4 SELECT i, i % 100 FROM (SELECT generate_series(301, 400) i) t;
+
+CREATE INDEX t1_val ON t1 (val);
+CREATE INDEX t2_val ON t2 (val);
+
+ANALYZE t1;
+ANALYZE t2;
+ANALYZE t3;
+ANALYZE t4;
+ANALYZE p1;
+ANALYZE p1_c1;
+ANALYZE p1_c2;
+
+CREATE VIEW v1 AS SELECT id, val FROM t1;
+CREATE VIEW v2 AS SELECT t1.id t1_id, t1.val t1_val, t2.id t2_id, t2.val t2_val FROM t1, t2 WHERE t1.id = t2.id;
+CREATE VIEW v3 AS SELECT t_1.id t1_id, t_1.val t1_val, t_2.id t2_id, t_2.val t2_val FROM t1 t_1, t2 t_2 WHERE t_1.id = t_2.id;
+CREATE VIEW v4 AS SELECT v_2.t1_id, t_3.id FROM v2 v_2, t3 t_3 WHERE v_2.t1_id = t_3.id;
+
+/*
+ * The following GUC parameters need the setting of the default value to
+ * succeed in regression test.
+ */
+CREATE VIEW settings AS
+SELECT name, setting, category
+ FROM pg_settings
+ WHERE category LIKE 'Query Tuning%'
+ OR name = 'client_min_messages'
+ ORDER BY category, name;
+SELECT * FROM settings;
--- /dev/null
+SET search_path TO public;
+
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.val = t2.val;
+
+LOAD 'pg_hint_plan';
+SET pg_hint_plan.debug_print TO on;
+SET client_min_messages TO LOG;
+
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.val = t2.val;
+
+/*+ Test (t1 t2) */
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+SET pg_hint_plan.enable_hint TO off;
+/*+ Test (t1 t2) */
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+SET pg_hint_plan.enable_hint TO on;
+
+/*Set(enable_indexscan off)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+--+Set(enable_indexscan off)
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+/*+Set(enable_indexscan off) /* nest comment */ */
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+/*+Set(enable_indexscan off)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+/*+ Set(enable_indexscan off) Set(enable_hashjoin off) */
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+
+/*+ Set ( enable_indexscan off ) */
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+/*+
+ Set
+ (
+ enable_indexscan
+ off
+ )
+ */
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+/*+ Set(enable_indexscan off)Set(enable_nestloop off)Set(enable_mergejoin off)
+ Set(enable_seqscan off)
+ */
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+/*+Set(work_mem "1M")*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+/*+Set(work_mem "1MB")*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+/*+Set(work_mem TO "1MB")*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+
+/*+SeqScan(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+/*+SeqScan(t1)IndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+/*+BitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+/*+BitmapScan(t2)NoSeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+/*+NoIndexScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+
+/*+NoBitmapScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t4 WHERE t1.val < 10;
+/*+TidScan(t4)*/
+EXPLAIN (COSTS false) SELECT * FROM t3, t4 WHERE t3.id = t4.id AND t4.ctid = '(1,1)';
+/*+NoTidScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)';
+
+/*+HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+/*+NestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+/*+NoMergeJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+
+/*+MergeJoin(t1 t3)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t3 WHERE t1.val = t3.val;
+/*+NestLoop(t1 t3)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t3 WHERE t1.val = t3.val;
+/*+NoHashJoin(t1 t3)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t3 WHERE t1.val = t3.val;
+
+/*+MergeJoin(t4 t1 t2 t3)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
+/*+HashJoin(t3 t4 t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
+/*+NestLoop(t2 t3 t4 t1) IndexScan(t3)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
+/*+NoNestLoop(t4 t1 t3 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
+
+/*+Leading( */
+EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
+/*+Leading( )*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
+/*+Leading( t3 )*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
+/*+Leading( t3 t4 )*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
+/*+Leading(t3 t4 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
+/*+Leading(t3 t4 t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
+/*+Leading(t3 t4 t1 t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
+/*+Leading(t3 t4 t4)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
+
+EXPLAIN (COSTS false) SELECT * FROM t1, (VALUES(1,1),(2,2),(3,3)) AS t2(id,val) WHERE t1.id = t2.id;
+/*+HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, (VALUES(1,1),(2,2),(3,3)) AS t2(id,val) WHERE t1.id = t2.id;
+/*+HashJoin(t1 *VALUES*)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, (VALUES(1,1),(2,2),(3,3)) AS t2(id,val) WHERE t1.id = t2.id;
+/*+HashJoin(t1 *VALUES*) IndexScan(t1) IndexScan(*VALUES*)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, (VALUES(1,1),(2,2),(3,3)) AS t2(id,val) WHERE t1.id = t2.id;
+
+-- single table scan hint test
+EXPLAIN SELECT (SELECT max(id) FROM t1 v_1 WHERE id < 10), id FROM v1 WHERE v1.id = (SELECT max(id) FROM t1 v_2 WHERE id < 10);
+/*+BitmapScan(v_1)*/
+EXPLAIN SELECT (SELECT max(id) FROM t1 v_1 WHERE id < 10), id FROM v1 WHERE v1.id = (SELECT max(id) FROM t1 v_2 WHERE id < 10);
+/*+BitmapScan(v_2)*/
+EXPLAIN SELECT (SELECT max(id) FROM t1 v_1 WHERE id < 10), id FROM v1 WHERE v1.id = (SELECT max(id) FROM t1 v_2 WHERE id < 10);
+/*+BitmapScan(t1)*/
+EXPLAIN SELECT (SELECT max(id) FROM t1 v_1 WHERE id < 10), id FROM v1 WHERE v1.id = (SELECT max(id) FROM t1 v_2 WHERE id < 10);
+/*+BitmapScan(v_1)BitmapScan(v_2)*/
+EXPLAIN SELECT (SELECT max(id) FROM t1 v_1 WHERE id < 10), id FROM v1 WHERE v1.id = (SELECT max(id) FROM t1 v_2 WHERE id < 10);
+/*+BitmapScan(v_1)BitmapScan(t1)*/
+EXPLAIN SELECT (SELECT max(id) FROM t1 v_1 WHERE id < 10), id FROM v1 WHERE v1.id = (SELECT max(id) FROM t1 v_2 WHERE id < 10);
+/*+BitmapScan(v_2)BitmapScan(t1)*/
+EXPLAIN SELECT (SELECT max(id) FROM t1 v_1 WHERE id < 10), id FROM v1 WHERE v1.id = (SELECT max(id) FROM t1 v_2 WHERE id < 10);
+/*+BitmapScan(v_1)BitmapScan(v_2)BitmapScan(t1)*/
+EXPLAIN SELECT (SELECT max(id) FROM t1 v_1 WHERE id < 10), id FROM v1 WHERE v1.id = (SELECT max(id) FROM t1 v_2 WHERE id < 10);
+
+-- full scan hint pattern test
+EXPLAIN (COSTS false) SELECT * FROM t1 WHERE id < 10 AND ctid = '(1,1)';
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1 WHERE id < 10 AND ctid = '(1,1)';
+/*+IndexScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1 WHERE id < 10 AND ctid = '(1,1)';
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1 WHERE id < 10 AND ctid = '(1,1)';
+/*+TidScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1 WHERE id < 10 AND ctid = '(1,1)';
+/*+NoSeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1 WHERE id < 10 AND ctid = '(1,1)';
+/*+NoIndexScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1 WHERE id < 10 AND ctid = '(1,1)';
+/*+NoBitmapScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1 WHERE id < 10 AND ctid = '(1,1)';
+/*+NoTidScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1 WHERE id < 10 AND ctid = '(1,1)';
+
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+SeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+SeqScan(t1) SeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+SeqScan(t1) IndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+SeqScan(t1) BitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+SeqScan(t1) TidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+SeqScan(t1) NoSeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+SeqScan(t1) NoIndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+SeqScan(t1) NoBitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+SeqScan(t1) NoTidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+
+/*+IndexScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+IndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+IndexScan(t1) SeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+IndexScan(t1) IndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+IndexScan(t1) BitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+IndexScan(t1) TidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+IndexScan(t1) NoSeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+IndexScan(t1) NoIndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+IndexScan(t1) NoBitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+IndexScan(t1) NoTidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+BitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+BitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+BitmapScan(t1) SeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+BitmapScan(t1) IndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+BitmapScan(t1) BitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+BitmapScan(t1) TidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+BitmapScan(t1) NoSeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+BitmapScan(t1) NoIndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+BitmapScan(t1) NoBitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+BitmapScan(t1) NoTidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+
+/*+TidScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+TidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+TidScan(t1) SeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+TidScan(t1) IndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+TidScan(t1) BitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+TidScan(t1) TidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+TidScan(t1) NoSeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+TidScan(t1) NoIndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+TidScan(t1) NoBitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+TidScan(t1) NoTidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+
+/*+NoSeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+NoSeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+NoSeqScan(t1) SeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+NoSeqScan(t1) IndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+NoSeqScan(t1) BitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+NoSeqScan(t1) TidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+NoSeqScan(t1) NoSeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+NoSeqScan(t1) NoIndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+NoSeqScan(t1) NoBitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+NoSeqScan(t1) NoTidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+
+/*+NoIndexScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+NoIndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+NoIndexScan(t1) SeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+NoIndexScan(t1) IndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+NoIndexScan(t1) BitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+NoIndexScan(t1) TidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+NoIndexScan(t1) NoSeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+NoIndexScan(t1) NoIndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+NoIndexScan(t1) NoBitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+NoIndexScan(t1) NoTidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+
+/*+NoBitmapScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+NoBitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+NoBitmapScan(t1) SeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+NoBitmapScan(t1) IndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+NoBitmapScan(t1) BitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+NoBitmapScan(t1) TidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+NoBitmapScan(t1) NoSeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+NoBitmapScan(t1) NoIndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+NoBitmapScan(t1) NoBitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+NoBitmapScan(t1) NoTidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+
+/*+NoTidScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+NoTidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+NoTidScan(t1) SeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+NoTidScan(t1) IndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+NoTidScan(t1) BitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+NoTidScan(t1) TidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+NoTidScan(t1) NoSeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+NoTidScan(t1) NoIndexScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+NoTidScan(t1) NoBitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+/*+NoTidScan(t1) NoTidScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+
+-- additional test
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)' AND t1.id < 10 AND t2.id < 10;
+/*+BitmapScan(t1) BitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)' AND t1.id < 10 AND t2.id < 10;
+
+-- outer join test
+EXPLAIN (COSTS false) SELECT * FROM t1 FULL OUTER JOIN t2 ON (t1.id = t2.id);
+/*+MergeJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1 FULL OUTER JOIN t2 ON (t1.id = t2.id);
+/*+NestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1 FULL OUTER JOIN t2 ON (t1.id = t2.id);
+
+-- inherite table test
+SET constraint_exclusion TO off;
+EXPLAIN (COSTS false) SELECT * FROM p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+SET constraint_exclusion TO on;
+EXPLAIN (COSTS false) SELECT * FROM p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+SET constraint_exclusion TO off;
+/*+SeqScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+/*+IndexScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+/*+BitmapScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+/*+TidScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+SET constraint_exclusion TO on;
+/*+SeqScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+/*+IndexScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+/*+BitmapScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+/*+TidScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+
+SET constraint_exclusion TO off;
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+SET constraint_exclusion TO on;
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+SET constraint_exclusion TO off;
+/*+SeqScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+/*+IndexScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+/*+BitmapScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+/*+TidScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+/*+NestLoop(p1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+/*+MergeJoin(p1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+/*+HashJoin(p1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+SET constraint_exclusion TO on;
+/*+SeqScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+/*+IndexScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+/*+BitmapScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+/*+TidScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+/*+NestLoop(p1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+/*+MergeJoin(p1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+/*+HashJoin(p1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+
+SET constraint_exclusion TO off;
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+SET constraint_exclusion TO on;
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+SET constraint_exclusion TO off;
+/*+SeqScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+/*+IndexScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+/*+BitmapScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+/*+TidScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+/*+NestLoop(p1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+/*+MergeJoin(p1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+/*+HashJoin(p1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+SET constraint_exclusion TO on;
+/*+SeqScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+/*+IndexScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+/*+BitmapScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+/*+TidScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
+/*+NestLoop(p1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+/*+MergeJoin(p1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+/*+HashJoin(p1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+
+SET constraint_exclusion TO off;
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+SET constraint_exclusion TO on;
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+SET constraint_exclusion TO off;
+/*+SeqScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+/*+IndexScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+/*+BitmapScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+/*+TidScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+SET constraint_exclusion TO on;
+/*+SeqScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+/*+IndexScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+/*+BitmapScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+/*+TidScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
+
+-- quote test
+/*+SeqScan("""t1 ) ")IndexScan("t 2 """)HashJoin("""t1 ) "T3"t 2 """)Leading("""t1 ) "T3"t 2 """)Set(application_name"a a a"" a A")*/
+EXPLAIN (COSTS false) SELECT * FROM t1 """t1 ) ", t2 "t 2 """, t3 "T3" WHERE """t1 ) ".id = "t 2 """.id AND """t1 ) ".id = "T3".id;
+
+-- duplicate hint test
+/*+SeqScan(t1)SeqScan(t2)IndexScan(t1)IndexScan(t2)BitmapScan(t1)BitmapScan(t2)TidScan(t1)TidScan(t2)HashJoin(t1 t2)NestLoop(t2 t1)MergeJoin(t1 t2)Leading(t1 t2)Leading(t2 t1)Set(enable_seqscan off)Set(enable_mergejoin on)Set(enable_seqscan on)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
+
+-- sub query Leading hint test
+SET from_collapse_limit TO 100;
+SET geqo_threshold TO 100;
+EXPLAIN (COSTS false)
+WITH c1_1(id) AS (
+SELECT max(t1_5.id) FROM t1 t1_5, t2 t2_5, t3 t3_5 WHERE t1_5.id = t2_5.id AND t2_5.id = t3_5.id
+)
+SELECT t1_1.id, (
+SELECT max(t1_2.id) FROM t1 t1_2, t2 t2_2, t3 t3_2 WHERE t1_2.id = t2_2.id AND t2_2.id = t3_2.id
+) FROM t1 t1_1, t2 t2_1, t3 t3_1, (
+SELECT t1_3.id FROM t1 t1_3, t2 t2_3, t3 t3_3 WHERE t1_3.id = t2_3.id AND t2_3.id = t3_3.id
+) v1_1(id), c1_1 WHERE t1_1.id = t2_1.id AND t2_1.id = t3_1.id AND t2_1.id = v1_1.id AND v1_1.id = c1_1.id AND t1_1.id = (
+SELECT max(t1_4.id) FROM t1 t1_4, t2 t2_4, t3 t3_4 WHERE t1_4.id = t2_4.id AND t2_4.id = t3_4.id
+);
+/*+HashJoin(t1_1 t3_1)MergeJoin(t1_3 t3_3)NestLoop(t1_2 t2_2)NestLoop(t1_4 t2_4)NestLoop(t1_5 t2_5)*/
+EXPLAIN (COSTS false)
+WITH c1_1(id) AS (
+SELECT max(t1_5.id) FROM t1 t1_5, t2 t2_5, t3 t3_5 WHERE t1_5.id = t2_5.id AND t2_5.id = t3_5.id
+)
+SELECT t1_1.id, (
+SELECT max(t1_2.id) FROM t1 t1_2, t2 t2_2, t3 t3_2 WHERE t1_2.id = t2_2.id AND t2_2.id = t3_2.id
+) FROM t1 t1_1, t2 t2_1, t3 t3_1, (
+SELECT t1_3.id FROM t1 t1_3, t2 t2_3, t3 t3_3 WHERE t1_3.id = t2_3.id AND t2_3.id = t3_3.id
+) v1_1(id), c1_1 WHERE t1_1.id = t2_1.id AND t2_1.id = t3_1.id AND t2_1.id = v1_1.id AND v1_1.id = c1_1.id AND t1_1.id = (
+SELECT max(t1_4.id) FROM t1 t1_4, t2 t2_4, t3 t3_4 WHERE t1_4.id = t2_4.id AND t2_4.id = t3_4.id
+);
+/*+HashJoin(t1_1 t3_1)MergeJoin(t1_3 t3_3)NestLoop(t1_2 t2_2)NestLoop(t1_4 t2_4)NestLoop(t1_5 t2_5)Leading(a t1_1 t1_2 t1_4 t1_5)*/
+EXPLAIN (COSTS false)
+WITH c1_1(id) AS (
+SELECT max(t1_5.id) FROM t1 t1_5, t2 t2_5, t3 t3_5 WHERE t1_5.id = t2_5.id AND t2_5.id = t3_5.id
+)
+SELECT t1_1.id, (
+SELECT max(t1_2.id) FROM t1 t1_2, t2 t2_2, t3 t3_2 WHERE t1_2.id = t2_2.id AND t2_2.id = t3_2.id
+) FROM t1 t1_1, t2 t2_1, t3 t3_1, (
+SELECT t1_3.id FROM t1 t1_3, t2 t2_3, t3 t3_3 WHERE t1_3.id = t2_3.id AND t2_3.id = t3_3.id
+) v1_1(id), c1_1 WHERE t1_1.id = t2_1.id AND t2_1.id = t3_1.id AND t2_1.id = v1_1.id AND v1_1.id = c1_1.id AND t1_1.id = (
+SELECT max(t1_4.id) FROM t1 t1_4, t2 t2_4, t3 t3_4 WHERE t1_4.id = t2_4.id AND t2_4.id = t3_4.id
+);
+/*+HashJoin(t1_1 t3_1)MergeJoin(t1_3 t3_3)NestLoop(t1_2 t2_2)NestLoop(t1_4 t2_4)NestLoop(t1_5 t2_5)Leading(a t3_2 t3_5 t2_2 c1_1 t3_4 t3_3 t2_3 t2_4 t1_3 t2_5 t1_2 t3_1 t1_4 t2_1 t1_5 t1_1)*/
+EXPLAIN (COSTS false)
+WITH c1_1(id) AS (
+SELECT max(t1_5.id) FROM t1 t1_5, t2 t2_5, t3 t3_5 WHERE t1_5.id = t2_5.id AND t2_5.id = t3_5.id
+)
+SELECT t1_1.id, (
+SELECT max(t1_2.id) FROM t1 t1_2, t2 t2_2, t3 t3_2 WHERE t1_2.id = t2_2.id AND t2_2.id = t3_2.id
+) FROM t1 t1_1, t2 t2_1, t3 t3_1, (
+SELECT t1_3.id FROM t1 t1_3, t2 t2_3, t3 t3_3 WHERE t1_3.id = t2_3.id AND t2_3.id = t3_3.id
+) v1_1(id), c1_1 WHERE t1_1.id = t2_1.id AND t2_1.id = t3_1.id AND t2_1.id = v1_1.id AND v1_1.id = c1_1.id AND t1_1.id = (
+SELECT max(t1_4.id) FROM t1 t1_4, t2 t2_4, t3 t3_4 WHERE t1_4.id = t2_4.id AND t2_4.id = t3_4.id
+);
+
+SET from_collapse_limit TO 1;
+EXPLAIN (COSTS false)
+WITH c1_1(id) AS (
+SELECT max(t1_5.id) FROM t1 t1_5, t2 t2_5, t3 t3_5 WHERE t1_5.id = t2_5.id AND t2_5.id = t3_5.id
+)
+SELECT t1_1.id, (
+SELECT max(t1_2.id) FROM t1 t1_2, t2 t2_2, t3 t3_2 WHERE t1_2.id = t2_2.id AND t2_2.id = t3_2.id
+) FROM t1 t1_1, t2 t2_1, t3 t3_1, (
+SELECT t1_3.id FROM t1 t1_3, t2 t2_3, t3 t3_3 WHERE t1_3.id = t2_3.id AND t2_3.id = t3_3.id
+) v1_1(id), c1_1 WHERE t1_1.id = t2_1.id AND t2_1.id = t3_1.id AND t2_1.id = v1_1.id AND v1_1.id = c1_1.id AND t1_1.id = (
+SELECT max(t1_4.id) FROM t1 t1_4, t2 t2_4, t3 t3_4 WHERE t1_4.id = t2_4.id AND t2_4.id = t3_4.id
+);
+/*+HashJoin(t1_1 t3_1)MergeJoin(t1_3 t3_3)NestLoop(t1_2 t2_2)NestLoop(t1_4 t2_4)NestLoop(t1_5 t2_5)*/
+EXPLAIN (COSTS false)
+WITH c1_1(id) AS (
+SELECT max(t1_5.id) FROM t1 t1_5, t2 t2_5, t3 t3_5 WHERE t1_5.id = t2_5.id AND t2_5.id = t3_5.id
+)
+SELECT t1_1.id, (
+SELECT max(t1_2.id) FROM t1 t1_2, t2 t2_2, t3 t3_2 WHERE t1_2.id = t2_2.id AND t2_2.id = t3_2.id
+) FROM t1 t1_1, t2 t2_1, t3 t3_1, (
+SELECT t1_3.id FROM t1 t1_3, t2 t2_3, t3 t3_3 WHERE t1_3.id = t2_3.id AND t2_3.id = t3_3.id
+) v1_1(id), c1_1 WHERE t1_1.id = t2_1.id AND t2_1.id = t3_1.id AND t2_1.id = v1_1.id AND v1_1.id = c1_1.id AND t1_1.id = (
+SELECT max(t1_4.id) FROM t1 t1_4, t2 t2_4, t3 t3_4 WHERE t1_4.id = t2_4.id AND t2_4.id = t3_4.id
+);
+/*+HashJoin(t1_1 t3_1)MergeJoin(t1_3 t3_3)NestLoop(t1_2 t2_2)NestLoop(t1_4 t2_4)NestLoop(t1_5 t2_5)Leading(a t1_1 t1_2 t1_4 t1_5)*/
+EXPLAIN (COSTS false)
+WITH c1_1(id) AS (
+SELECT max(t1_5.id) FROM t1 t1_5, t2 t2_5, t3 t3_5 WHERE t1_5.id = t2_5.id AND t2_5.id = t3_5.id
+)
+SELECT t1_1.id, (
+SELECT max(t1_2.id) FROM t1 t1_2, t2 t2_2, t3 t3_2 WHERE t1_2.id = t2_2.id AND t2_2.id = t3_2.id
+) FROM t1 t1_1, t2 t2_1, t3 t3_1, (
+SELECT t1_3.id FROM t1 t1_3, t2 t2_3, t3 t3_3 WHERE t1_3.id = t2_3.id AND t2_3.id = t3_3.id
+) v1_1(id), c1_1 WHERE t1_1.id = t2_1.id AND t2_1.id = t3_1.id AND t2_1.id = v1_1.id AND v1_1.id = c1_1.id AND t1_1.id = (
+SELECT max(t1_4.id) FROM t1 t1_4, t2 t2_4, t3 t3_4 WHERE t1_4.id = t2_4.id AND t2_4.id = t3_4.id
+);
+/*+HashJoin(t1_1 t3_1)MergeJoin(t1_3 t3_3)NestLoop(t1_2 t2_2)NestLoop(t1_4 t2_4)NestLoop(t1_5 t2_5)Leading(a t3_2 t3_5 t2_2 c1_1 t3_4 t3_3 t2_3 t2_4 t1_3 t2_5 t1_2 t3_1 t1_4 t2_1 t1_5 t1_1)*/
+EXPLAIN (COSTS false)
+WITH c1_1(id) AS (
+SELECT max(t1_5.id) FROM t1 t1_5, t2 t2_5, t3 t3_5 WHERE t1_5.id = t2_5.id AND t2_5.id = t3_5.id
+)
+SELECT t1_1.id, (
+SELECT max(t1_2.id) FROM t1 t1_2, t2 t2_2, t3 t3_2 WHERE t1_2.id = t2_2.id AND t2_2.id = t3_2.id
+) FROM t1 t1_1, t2 t2_1, t3 t3_1, (
+SELECT t1_3.id FROM t1 t1_3, t2 t2_3, t3 t3_3 WHERE t1_3.id = t2_3.id AND t2_3.id = t3_3.id
+) v1_1(id), c1_1 WHERE t1_1.id = t2_1.id AND t2_1.id = t3_1.id AND t2_1.id = v1_1.id AND v1_1.id = c1_1.id AND t1_1.id = (
+SELECT max(t1_4.id) FROM t1 t1_4, t2 t2_4, t3 t3_4 WHERE t1_4.id = t2_4.id AND t2_4.id = t3_4.id
+);
+
+-- ambigous error
+EXPLAIN (COSTS false) SELECT * FROM t1, s0.t1, t2 WHERE public.t1.id = s0.t1.id AND public.t1.id = t2.id;
+/*+NestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, s0.t1, t2 WHERE public.t1.id = s0.t1.id AND public.t1.id = t2.id;
+/*+Leading(t1 t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, s0.t1, t2 WHERE public.t1.id = s0.t1.id AND public.t1.id = t2.id;
+
+-- identifier length test
+EXPLAIN (COSTS false) SELECT * FROM t1 "123456789012345678901234567890123456789012345678901234567890123" JOIN t2 ON ("123456789012345678901234567890123456789012345678901234567890123".id = t2.id) JOIN t3 ON (t2.id = t3.id);
+/*+
+Leading(123456789012345678901234567890123456789012345678901234567890123 t2 t3)
+SeqScan(123456789012345678901234567890123456789012345678901234567890123)
+MergeJoin(123456789012345678901234567890123456789012345678901234567890123 t2)
+Set(123456789012345678901234567890123456789012345678901234567890123 1)
+*/
+EXPLAIN (COSTS false) SELECT * FROM t1 "123456789012345678901234567890123456789012345678901234567890123" JOIN t2 ON ("123456789012345678901234567890123456789012345678901234567890123".id = t2.id) JOIN t3 ON (t2.id = t3.id);
+/*+
+Leading(1234567890123456789012345678901234567890123456789012345678901234 t2 t3)
+SeqScan(1234567890123456789012345678901234567890123456789012345678901234)
+MergeJoin(1234567890123456789012345678901234567890123456789012345678901234 t2)
+Set(1234567890123456789012345678901234567890123456789012345678901234 1)
+Set(cursor_tuple_fraction 0.1234567890123456789012345678901234567890123456789012345678901234)
+*/
+EXPLAIN (COSTS false) SELECT * FROM t1 "1234567890123456789012345678901234567890123456789012345678901234" JOIN t2 ON ("1234567890123456789012345678901234567890123456789012345678901234".id = t2.id) JOIN t3 ON (t2.id = t3.id);
+SET "123456789012345678901234567890123456789012345678901234567890123" TO 1;
+SET "1234567890123456789012345678901234567890123456789012345678901234" TO 1;
+SET cursor_tuple_fraction TO 1234567890123456789012345678901234567890123456789012345678901234;
+
+-- multi error
+/*+ Set(enable_seqscan 100)Set(seq_page_cost on)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
--- /dev/null
+LOAD 'pg_hint_plan';
+SET pg_hint_plan.enable_hint TO on;
+SET pg_hint_plan.debug_print TO on;
+SET client_min_messages TO LOG;
+SET search_path TO public;
+
+----
+---- No. A-5-1 hint format
+----
+
+-- No. A-5-1-1
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-5-1-2
+/* +SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-5-1-3
+--+SeqScan(t1)
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-5-1-4
+--+SeqScan(t1)
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-5-1-5
+-- +SeqScan(t1)
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-5-1-6
+--SeqScan(t1)
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-5-1-7
+/*+SeqScan(t1) /* nest comment */ */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-5-1-8
+/* +SeqScan(t1) /* nest comment */ */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-5-1-9
+/*SeqScan(t1) /* nest comment */ */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+----
+---- No. A-5-2 hint position
+----
+
+-- No. A-5-2-1
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-5-2-2
+/* normal comment */
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-5-2-3
+EXPLAIN (COSTS false) SELECT /*+SeqScan(t1)*/ * FROM s1.t1 WHERE t1.c1 = 1;
+
+----
+---- No. A-5-4 hint delimiter
+----
+
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+-- No. A-5-4-1
+-- No. A-5-4-2
+-- No. A-5-4-3
+-- No. A-5-4-4
+-- No. A-5-4-5
+-- No. A-5-4-6
+-- No. A-5-4-7
+/*+Set(enable_indexscan"off")Set(enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-5-4-8
+/*+ Set(enable_indexscan"off")Set(enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-5-4-9
+/*+Set(enable_indexscan"off")Set(enable_bitmapscan"off") */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-5-4-10
+/*+ Set (enable_indexscan"off") Set (enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-5-4-11
+/*+Set ( enable_indexscan"off")Set ( enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-5-4-12
+/*+Set(enable_indexscan"off" ) Set(enable_bitmapscan"off" ) */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-5-4-13
+/*+Set( enable_indexscan "off" )Set( enable_bitmapscan "off" )*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-5-4-14
+/*+ Set ( enable_indexscan "off" ) Set ( enable_bitmapscan "off" ) */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-5-4-15
+/*+ Set(enable_indexscan"off")Set(enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-5-4-16
+/*+Set(enable_indexscan"off")Set(enable_bitmapscan"off") */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-5-4-17
+/*+ Set (enable_indexscan"off") Set (enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-5-4-18
+/*+Set ( enable_indexscan"off")Set ( enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-5-4-19
+/*+Set(enable_indexscan"off" ) Set(enable_bitmapscan"off" ) */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-5-4-20
+/*+Set( enable_indexscan "off" )Set( enable_bitmapscan "off" )*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-5-4-21
+/*+ Set ( enable_indexscan "off" ) Set ( enable_bitmapscan "off" ) */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-5-4-22
+/*+
+Set(enable_indexscan"off")Set(enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-5-4-23
+/*+Set(enable_indexscan"off")Set(enable_bitmapscan"off")
+*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-5-4-24
+/*+
+Set
+(enable_indexscan"off")
+Set
+(enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-5-4-25
+/*+Set
+(
+enable_indexscan"off")Set
+(
+enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-5-4-26
+/*+Set(enable_indexscan"off"
+)
+Set(enable_bitmapscan"off"
+)
+*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-5-4-27
+/*+Set(
+enable_indexscan
+"off"
+)Set(
+enable_bitmapscan
+"off"
+)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-5-4-28
+/*+
+Set
+(
+enable_indexscan
+"off"
+)
+Set
+(
+enable_bitmapscan
+"off"
+)
+*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-5-4-29
+/*+
+ Set(enable_indexscan"off")Set(enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-5-4-30
+/*+Set(enable_indexscan"off")Set(enable_bitmapscan"off")
+ */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-5-4-31
+/*+
+ Set
+ (enable_indexscan"off")
+ Set
+ (enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-5-4-32
+/*+Set
+ (
+ enable_indexscan"off")Set
+ (
+ enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-5-4-33
+/*+Set(enable_indexscan"off"
+ )
+ Set(enable_bitmapscan"off"
+ )
+ */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-5-4-34
+/*+Set(
+ enable_indexscan
+ "off"
+ )Set(
+ enable_bitmapscan
+ "off"
+ )*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-5-4-35
+/*+
+ Set
+ (
+ enable_indexscan
+ "off"
+ )
+ Set
+ (
+ enable_bitmapscan
+ "off"
+ )
+ */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+----
+---- No. A-5-5 hint object pattern
+---- No. A-7-2 message object pattern
+----
+
+-- No. A-5-5-1
+-- No. A-7-2-1
+/*+SeqScan(t)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 t WHERE t.c1 = 1;
+/*+SeqScan(ttt)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 ttt WHERE ttt.c1 = 1;
+/*+SeqScan("t")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 t WHERE t.c1 = 1;
+/*+SeqScan("ttt")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 ttt WHERE ttt.c1 = 1;
+
+-- No. A-5-5-2
+-- No. A-7-2-2
+/*+SeqScan(T)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "T" WHERE "T".c1 = 1;
+/*+SeqScan(TTT)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "TTT" WHERE "TTT".c1 = 1;
+/*+SeqScan("T")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "T" WHERE "T".c1 = 1;
+/*+SeqScan("TTT")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "TTT" WHERE "TTT".c1 = 1;
+
+-- No. A-5-5-3
+-- No. A-7-2-3
+/*+SeqScan(()*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "(" WHERE "(".c1 = 1;
+/*+SeqScan(((()*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "(((" WHERE "(((".c1 = 1;
+/*+SeqScan("(")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "(" WHERE "(".c1 = 1;
+/*+SeqScan("(((")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "(((" WHERE "(((".c1 = 1;
+
+-- No. A-5-5-4
+-- No. A-7-2-4
+/*+SeqScan())*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 ")" WHERE ")".c1 = 1;
+/*+SeqScan(")")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 ")" WHERE ")".c1 = 1;
+/*+SeqScan(")))")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 ")))" WHERE ")))".c1 = 1;
+
+-- No. A-5-5-5
+-- No. A-7-2-5
+/*+SeqScan(")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 """" WHERE """".c1 = 1;
+/*+SeqScan("""")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 """" WHERE """".c1 = 1;
+/*+SeqScan("""""""")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 """""""" WHERE """""""".c1 = 1;
+
+-- No. A-5-5-6
+-- No. A-7-2-6
+/*+SeqScan( )*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 " " WHERE " ".c1 = 1;
+/*+SeqScan(" ")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 " " WHERE " ".c1 = 1;
+/*+SeqScan(" ")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 " " WHERE " ".c1 = 1;
+
+-- No. A-5-5-7
+-- No. A-7-2-7
+/*+SeqScan( )*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 " " WHERE " ".c1 = 1;
+/*+SeqScan(" ")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 " " WHERE " ".c1 = 1;
+/*+SeqScan(" ")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 " " WHERE " ".c1 = 1;
+
+-- No. A-5-5-8
+-- No. A-7-2-8
+/*+SeqScan(
+)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "
+" WHERE "
+".c1 = 1;
+/*+SeqScan("
+")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "
+" WHERE "
+".c1 = 1;
+/*+SeqScan("
+
+
+")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "
+
+
+" WHERE "
+
+
+".c1 = 1;
+
+-- No. A-5-5-9
+-- No. A-7-2-9
+/*+SeqScan(Set)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "Set" WHERE "Set".c1 = 1;
+/*+SeqScan("Set")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "Set" WHERE "Set".c1 = 1;
+/*+SeqScan("Set SeqScan Leading")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "Set SeqScan Leading" WHERE "Set SeqScan Leading".c1 = 1;
+
+-- No. A-5-5-10
+-- No. A-7-2-10
+/*+SeqScan(あ)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 あ WHERE あ.c1 = 1;
+/*+SeqScan(あいう)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 あいう WHERE あいう.c1 = 1;
+/*+SeqScan("あ")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 あ WHERE あ.c1 = 1;
+/*+SeqScan("あいう")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 あいう WHERE あいう.c1 = 1;
+
+-- No. A-5-5-11
+-- No. A-7-2-11
+/*+SeqScan(/**/)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "/**/" WHERE "/**/".c1 = 1;
+/*+SeqScan(/**//**//**/)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "/**//**//**/" WHERE "/**//**//**/".c1 = 1;
+
+-- No. A-5-5-12
+-- No. A-7-2-12
+/*+SeqScan("tT()""
+Set/**/あ")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "tT()""
+Set/**/あ" WHERE "tT()""
+Set/**/あ".c1 = 1;
+--"
+
+/*+SeqScan("tT()""
+Setあ")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "tT()""
+Setあ" WHERE "tT()""
+Setあ".c1 = 1;
+
+----
+---- No. A-5-6 hint parse error
+----
+
+-- No. A-5-6-1
+/*+Set(enable_indexscan off)Set enable_tidscan off)Set(enable_bitmapscan off)SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-5-6-2
+/*+Set(enable_indexscan off)Set(enable_tidscan off Set(enable_bitmapscan off)SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-5-6-3
+/*+Set(enable_indexscan off)Set(enable_tidscan "off)Set(enable_bitmapscan off)SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-5-6-4
+/*+Set(enable_indexscan off)SeqScan("")Set(enable_bitmapscan off)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-5-6-5
+/*+Set(enable_indexscan off)NoSet(enable_tidscan off)Set(enable_bitmapscan off)SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-5-6-6
+/*+Set(enable_indexscan off)"Set"(enable_tidscan off)Set(enable_bitmapscan off)SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-5-6-7
+/*+Set(enable_indexscan off)Set(enable_tidscan /* value */off)Set(enable_bitmapscan off)SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+----
+---- No. A-6-1 original GUC parameter
+----
+
+-- No. A-6-1-1
+SET ROLE super_user;
+SET pg_hint_plan.debug_print TO off;
+SHOW pg_hint_plan.enable_hint;
+SHOW pg_hint_plan.debug_print;
+SHOW pg_hint_plan.parse_messages;
+SET pg_hint_plan.enable_hint TO off;
+SET pg_hint_plan.debug_print TO on;
+SET pg_hint_plan.parse_messages TO error;
+SHOW pg_hint_plan.enable_hint;
+SHOW pg_hint_plan.debug_print;
+SHOW pg_hint_plan.parse_messages;
+RESET pg_hint_plan.enable_hint;
+RESET pg_hint_plan.debug_print;
+RESET pg_hint_plan.parse_messages;
+SHOW pg_hint_plan.enable_hint;
+SHOW pg_hint_plan.debug_print;
+SHOW pg_hint_plan.parse_messages;
+
+-- No. A-6-1-2
+SET ROLE normal_user;
+SHOW pg_hint_plan.enable_hint;
+SHOW pg_hint_plan.debug_print;
+SHOW pg_hint_plan.parse_messages;
+SET pg_hint_plan.enable_hint TO off;
+SET pg_hint_plan.debug_print TO on;
+SET pg_hint_plan.parse_messages TO error;
+SHOW pg_hint_plan.enable_hint;
+SHOW pg_hint_plan.debug_print;
+SHOW pg_hint_plan.parse_messages;
+RESET pg_hint_plan.enable_hint;
+RESET pg_hint_plan.debug_print;
+RESET pg_hint_plan.parse_messages;
+SHOW pg_hint_plan.enable_hint;
+SHOW pg_hint_plan.debug_print;
+SHOW pg_hint_plan.parse_messages;
+
+RESET ROLE;
+
+----
+---- No. A-6-2 original GUC parameter pg_hint_plan.enable_hint
+----
+
+-- No. A-6-2-1
+SET pg_hint_plan.enable_hint TO on;
+SHOW pg_hint_plan.enable_hint;
+/*+Set(enable_indexscan off)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-6-2-2
+SET pg_hint_plan.enable_hint TO off;
+SHOW pg_hint_plan.enable_hint;
+/*+Set(enable_indexscan off)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-6-2-3
+SET pg_hint_plan.enable_hint TO DEFAULT;
+SHOW pg_hint_plan.enable_hint;
+/*+Set(enable_indexscan off)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-6-2-4
+SET pg_hint_plan.enable_hint TO enable;
+SHOW pg_hint_plan.enable_hint;
+
+----
+---- No. A-6-3 original GUC parameter pg_hint_plan.debug_print
+----
+
+-- No. A-6-3-1
+SET pg_hint_plan.debug_print TO on;
+SHOW pg_hint_plan.debug_print;
+/*+Set(enable_indexscan off)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-6-3-2
+SET pg_hint_plan.debug_print TO off;
+SHOW pg_hint_plan.debug_print;
+/*+Set(enable_indexscan off)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-6-3-3
+SET pg_hint_plan.debug_print TO DEFAULT;
+SHOW pg_hint_plan.debug_print;
+/*+Set(enable_indexscan off)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-6-3-4
+SET pg_hint_plan.debug_print TO enable;
+SHOW pg_hint_plan.debug_print;
+
+----
+---- No. A-6-4 original GUC parameter pg_hint_plan.parse_messages
+----
+
+SET client_min_messages TO debug5;
+
+-- No. A-6-4-1
+SET pg_hint_plan.parse_messages TO debug5;
+SHOW pg_hint_plan.parse_messages;
+/*+Set*/SELECT 1;
+SET client_min_messages TO debug4;
+/*+Set*/SELECT 1;
+
+-- No. A-6-4-2
+SET pg_hint_plan.parse_messages TO debug4;
+SHOW pg_hint_plan.parse_messages;
+/*+Set*/SELECT 1;
+SET client_min_messages TO debug3;
+/*+Set*/SELECT 1;
+
+-- No. A-6-4-3
+SET pg_hint_plan.parse_messages TO debug3;
+SHOW pg_hint_plan.parse_messages;
+/*+Set*/SELECT 1;
+SET client_min_messages TO debug2;
+/*+Set*/SELECT 1;
+
+-- No. A-6-4-4
+SET pg_hint_plan.parse_messages TO debug2;
+SHOW pg_hint_plan.parse_messages;
+/*+Set*/SELECT 1;
+SET client_min_messages TO debug1;
+/*+Set*/SELECT 1;
+
+-- No. A-6-4-5
+SET pg_hint_plan.parse_messages TO debug1;
+SHOW pg_hint_plan.parse_messages;
+/*+Set*/SELECT 1;
+SET client_min_messages TO log;
+/*+Set*/SELECT 1;
+
+-- No. A-6-4-6
+SET pg_hint_plan.parse_messages TO log;
+SHOW pg_hint_plan.parse_messages;
+/*+Set*/SELECT 1;
+SET client_min_messages TO info;
+/*+Set*/SELECT 1;
+
+-- No. A-6-4-7
+SET pg_hint_plan.parse_messages TO info;
+SHOW pg_hint_plan.parse_messages;
+/*+Set*/SELECT 1;
+SET client_min_messages TO notice;
+/*+Set*/SELECT 1;
+
+-- No. A-6-4-8
+SET pg_hint_plan.parse_messages TO notice;
+SHOW pg_hint_plan.parse_messages;
+/*+Set*/SELECT 1;
+SET client_min_messages TO warning;
+/*+Set*/SELECT 1;
+
+-- No. A-6-4-9
+SET pg_hint_plan.parse_messages TO warning;
+SHOW pg_hint_plan.parse_messages;
+/*+Set*/SELECT 1;
+SET client_min_messages TO error;
+/*+Set*/SELECT 1;
+
+-- No. A-6-4-10
+SET pg_hint_plan.parse_messages TO error;
+SHOW pg_hint_plan.parse_messages;
+/*+Set*/SELECT 1;
+SET client_min_messages TO fatal;
+/*+Set*/SELECT 1;
+
+-- No. A-6-4-11
+RESET client_min_messages;
+SET pg_hint_plan.parse_messages TO DEFAULT;
+SHOW pg_hint_plan.parse_messages;
+/*+Set*/SELECT 1;
+
+-- No. A-6-4-12
+SET pg_hint_plan.parse_messages TO fatal;
+SHOW pg_hint_plan.parse_messages;
+
+-- No. A-6-4-13
+SET pg_hint_plan.parse_messages TO panic;
+SHOW pg_hint_plan.parse_messages;
+
+-- No. A-6-4-14
+SET pg_hint_plan.parse_messages TO on;
+SHOW pg_hint_plan.parse_messages;
+
+----
+---- No. A-7-1 parse error message output
+----
+
+-- No. A-7-1-1
+/*+"Set"(enable_indexscan on)*/SELECT 1;
+/*+Set()(enable_indexscan on)*/SELECT 1;
+/*+Set(enable_indexscan on*/SELECT 1;
+
+----
+---- No. A-7-3 hint state output
+----
+
+SET pg_hint_plan.debug_print TO on;
+SET client_min_messages TO LOG;
+
+-- No. A-7-3-1
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-7-3-2
+/*+SeqScan(no_table)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. A-7-3-3
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid = '(1,1)';
+/*+TidScan(t1)BitmapScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid = '(1,1)';
+/*+TidScan(t1)BitmapScan(t1)IndexScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid = '(1,1)';
+/*+TidScan(t1)BitmapScan(t1)IndexScan(t1)SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid = '(1,1)';
+
+-- No. A-7-3-4
+/*+Set(enable_indexscan enable)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+----
+---- No. A-8-1 hint state output
+----
+
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+EXPLAIN (COSTS false) EXECUTE p1;
+DEALLOCATE p1;
+
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 < $1;
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+DEALLOCATE p1;
+
+-- No. A-8-1-1
+-- No. A-8-1-2
+/*+SeqScan(t1)*/
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) EXECUTE p1;
+UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) EXECUTE p1;
+DEALLOCATE p1;
+
+/*+BitmapScan(t1)*/
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 < $1;
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+DEALLOCATE p1;
+
+-- No. A-8-1-3
+-- No. A-8-1-4
+/*+SeqScan(t1)*/
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+EXPLAIN (COSTS false) EXECUTE p1;
+UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
+EXPLAIN (COSTS false) EXECUTE p1;
+DEALLOCATE p1;
+
+/*+BitmapScan(t1)*/
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 < $1;
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+DEALLOCATE p1;
+
+-- No. A-8-1-5
+-- No. A-8-1-6
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) EXECUTE p1;
+UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) EXECUTE p1;
+DEALLOCATE p1;
+
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 < $1;
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+DEALLOCATE p1;
+
+-- No. A-8-1-9
+-- No. A-8-1-10
+/*+SeqScan(t1)*/
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1;
+UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1;
+DEALLOCATE p1;
+
+/*+BitmapScan(t1)*/
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 < $1;
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+DEALLOCATE p1;
+
+-- No. A-8-1-11
+-- No. A-8-1-12
+/*+SeqScan(t1)*/
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1;
+UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1;
+DEALLOCATE p1;
+
+/*+BitmapScan(t1)*/
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 < $1;
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+DEALLOCATE p1;
+
+-- No. A-8-1-13
+-- No. A-8-1-14
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1;
+UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1;
+DEALLOCATE p1;
+
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 < $1;
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+DEALLOCATE p1;
+
+----
+---- No. A-8-4 EXECUTE statement name error
+----
+
+-- No. A-8-4-1
+EXECUTE p1;
+SHOW pg_hint_plan.debug_print;
+
+----
+---- No. A-9-5 EXECUTE statement name error
+----
+
+-- No. A-9-5-1
+SELECT pg_stat_statements_reset();
+SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+/*+Set(enable_seqscan off)*/ SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+/*+SeqScan(t1)*/ SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+SELECT s.query, s.calls
+ FROM public.pg_stat_statements s
+ JOIN pg_catalog.pg_database d
+ ON (s.dbid = d.oid)
+ ORDER BY 1;
+
+----
+---- No. A-10-1 duplicate hint
+----
+
+-- No. A-10-1-1
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.ctid = '(1,1)' AND t1.c1 = t2.c1 AND t2.ctid = '(1,1)' AND t1.c1 = t3.c1 AND t3.ctid = '(1,1)' AND t1.c1 = t4.c1 AND t4.ctid = '(1,1)';
+/*+
+Set(enable_tidscan aaa)
+Set(enable_tidscan on)
+Set(enable_tidscan off)
+SeqScan(t4)
+IndexScan(t4)
+BitmapScan(t4)
+TidScan(t4)
+NestLoop(t4 t3)
+MergeJoin(t4 t3)
+HashJoin(t4 t3)
+Leading(t2 t1 t4 t3)
+Leading(t1 t4 t3 t2)
+Leading(t4 t3 t2 t1)
+*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.ctid = '(1,1)' AND t1.c1 = t2.c1 AND t2.ctid = '(1,1)' AND t1.c1 = t3.c1 AND t3.ctid = '(1,1)' AND t1.c1 = t4.c1 AND t4.ctid = '(1,1)';
+
+-- No. A-10-1-2
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.ctid = '(1,1)' AND t1.c1 = t2.c1 AND t2.ctid = '(1,1)' AND t1.c1 = t3.c1 AND t3.ctid = '(1,1)' AND t1.c1 = t4.c1 AND t4.ctid = '(1,1)';
+/*+
+SeqScan(t4)
+Set(enable_tidscan aaa)
+IndexScan(t4)
+NestLoop(t4 t3)
+Leading(t2 t1 t4 t3)
+Set(enable_tidscan on)
+BitmapScan(t4)
+MergeJoin(t4 t3)
+Leading(t1 t4 t3 t2)
+Set(enable_tidscan off)
+TidScan(t4)
+HashJoin(t4 t3)
+Leading(t4 t3 t2 t1)
+*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.ctid = '(1,1)' AND t1.c1 = t2.c1 AND t2.ctid = '(1,1)' AND t1.c1 = t3.c1 AND t3.ctid = '(1,1)' AND t1.c1 = t4.c1 AND t4.ctid = '(1,1)';
+
+----
+---- No. A-10-2 restrict query type
+----
+
+-- No. A-10-2-1
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 FULL OUTER JOIN s1.t2 ON (t1.c1 = t2.c1);
+/*+NestLoop(t1 t2)*/
+EXPLAIN (COSTS true) SELECT * FROM s1.t1 FULL OUTER JOIN s1.t2 ON (t1.c1 = t2.c1);
+
+-- No. A-10-2-2
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c3 = 1;
+/*+IndexScan(t1 t1_i1)*/
+EXPLAIN (COSTS true) SELECT * FROM s1.t1 WHERE t1.c3 = 1;
+
+-- No. A-10-2-3
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+/*+TidScan(t1)*/
+EXPLAIN (COSTS true) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+----
+---- No. A-10-3 VIEW, RULE multi specified
+----
+
+-- No. A-10-3-1
+EXPLAIN (COSTS false) SELECT * FROM s1.v1 v1, s1.v1 v2 WHERE v1.c1 = v2.c1;
+/*+Leading(v1t1 v1t1)HashJoin(v1t1 v1t1)BitmapScan(v1t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.v1 v1, s1.v1 v2 WHERE v1.c1 = v2.c1;
+
+-- No. A-10-3-2
+EXPLAIN (COSTS false) SELECT * FROM s1.v1 v1, s1.v1_ v2 WHERE v1.c1 = v2.c1;
+/*+Leading(v1t1 v1t1_)NestLoop(v1t1 v1t1_)SeqScan(v1t1)BitmapScan(v1t1_)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.v1 v1, s1.v1_ v2 WHERE v1.c1 = v2.c1;
+
+-- No. A-10-3-3
+EXPLAIN (COSTS false) SELECT * FROM s1.r4 t1, s1.r4 t2 WHERE t1.c1 = t2.c1;
+/*+Leading(r4t1 r4t1)HashJoin(r4t1 r4t1)BitmapScan(r4t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.r4 t1, s1.r4 t2 WHERE t1.c1 = t2.c1;
+
+-- No. A-10-3-4
+EXPLAIN (COSTS false) SELECT * FROM s1.r4 t1, s1.r5 t2 WHERE t1.c1 = t2.c1;
+/*+Leading(r4t1 r5t1)NestLoop(r4t1 r5t1)SeqScan(r4t1)BitmapScan(r5t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.r4 t1, s1.r5 t2 WHERE t1.c1 = t2.c1;
+
+----
+---- No. A-11-1 psql command
+----
+
+SELECT count(*) FROM s1.t1 WHERE t1.c1 = 1;
+/*+SeqScan(t1)*/
+SELECT count(*) FROM s1.t1 WHERE t1.c1 = 1;
+-- No. A-11-1-4
+\set FETCH_COUNT 0
+/*+SeqScan(t1)*/
+SELECT count(*) FROM s1.t1 WHERE t1.c1 = 1;
+-- No. A-11-1-5
+\set FETCH_COUNT 1
+/*+SeqScan(t1)*/
+SELECT count(*) FROM s1.t1 WHERE t1.c1 = 1;
+\unset FETCH_COUNT
+
+----
+---- No. A-11-4 PL/pgSQL function
+----
+
+-- No. A-11-4-1
+CREATE OR REPLACE FUNCTION f1() RETURNS SETOF text LANGUAGE plpgsql AS $$
+DECLARE
+ r text;
+BEGIN
+ FOR r IN EXPLAIN SELECT c4 FROM s1.t1 WHERE t1.c1 = 1
+ LOOP
+ RETURN NEXT r; -- return current row of SELECT
+ END LOOP;
+ RETURN;
+END
+$$;
+SELECT f1();
+/*+SeqScan(t1)*/
+SELECT f1();
+
+-- No. A-11-4-2
+/*+SeqScan(t1)*/CREATE OR REPLACE FUNCTION f1() RETURNS SETOF text LANGUAGE plpgsql AS $$
+DECLARE
+ r text;
+BEGIN
+ /*+SeqScan(t1)*/FOR r IN EXPLAIN /*+SeqScan(t1)*/SELECT c4 FROM s1.t1 WHERE t1.c1 = 1
+ LOOP
+ /*+SeqScan(t1)*/RETURN NEXT r; -- return current row of SELECT
+ END LOOP;
+ /*+SeqScan(t1)*/RETURN;
+END
+$$;
+SELECT f1();
+
+----
+---- No. A-12-1 reset of global variable of core at the error
+---- No. A-12-2 reset of global variable of original at the error
+----
+
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+/*+Set(enable_seqscan off)Set(geqo_threshold 100)SeqScan(t1)MergeJoin(t1 t2)NestLoop(t1 t1)*/
+PREPARE p1 AS SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+EXPLAIN (COSTS false) EXECUTE p1;
+
+-- No. A-12-1-1
+-- No. A-12-2-1
+SELECT name, setting FROM settings;
+SET pg_hint_plan.parse_messages TO error;
+/*+Set(enable_seqscan off)Set(geqo_threshold 100)SeqScan(t1)MergeJoin(t1 t2)NestLoop(t1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+SELECT name, setting FROM settings;
+/*+Set(enable_seqscan off)Set(geqo_threshold 100)SeqScan(t1)MergeJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+
+-- No. A-12-1-2
+-- No. A-12-2-2
+SELECT name, setting FROM settings;
+SET pg_hint_plan.parse_messages TO error;
+/*+Set(enable_seqscan off)Set(geqo_threshold 100)SeqScan(t1)MergeJoin(t1 t2)NestLoop(t1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+SELECT name, setting FROM settings;
+EXPLAIN (COSTS false) EXECUTE p1;
+
+-- No. A-12-1-3
+-- No. A-12-2-3
+SELECT name, setting FROM settings;
+SET pg_hint_plan.parse_messages TO error;
+EXPLAIN (COSTS false) EXECUTE p2;
+/*+Set(enable_seqscan off)Set(geqo_threshold 100)SeqScan(t1)MergeJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+EXPLAIN (COSTS false) EXECUTE p1;
+SELECT name, setting FROM settings;
+
+-- No. A-12-1-4
+-- No. A-12-2-4
+SELECT name, setting FROM settings;
+SET pg_hint_plan.parse_messages TO error;
+EXPLAIN (COSTS false) EXECUTE p2;
+EXPLAIN (COSTS false) EXECUTE p1;
+SELECT name, setting FROM settings;
+
+DEALLOCATE p1;
+SET pg_hint_plan.parse_messages TO LOG;
+
+----
+---- No. A-12-3 effective range of the hint
+----
+
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+
+-- No. A-12-3-1
+SET enable_indexscan TO off;
+SET enable_mergejoin TO off;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+SELECT name, setting FROM settings;
+/*+Set(enable_indexscan on)Set(geqo_threshold 100)IndexScan(t2)MergeJoin(t1 t2)Leading(t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+SELECT name, setting FROM settings;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+
+-- No. A-12-3-2
+SET enable_indexscan TO off;
+SET enable_mergejoin TO off;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+SELECT name, setting FROM settings;
+BEGIN;
+/*+Set(enable_indexscan on)Set(geqo_threshold 100)IndexScan(t2)MergeJoin(t1 t2)Leading(t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+COMMIT;
+BEGIN;
+SELECT name, setting FROM settings;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+COMMIT;
+
+-- No. A-12-3-3
+SET enable_indexscan TO off;
+SET enable_mergejoin TO off;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+SELECT name, setting FROM settings;
+/*+Set(enable_indexscan on)Set(geqo_threshold 100)IndexScan(t2)MergeJoin(t1 t2)Leading(t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+\connect
+SET enable_indexscan TO off;
+SET enable_mergejoin TO off;
+LOAD 'pg_hint_plan';
+SELECT name, setting FROM settings;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+
+SET pg_hint_plan.enable_hint TO on;
+SET pg_hint_plan.debug_print TO on;
+SET client_min_messages TO LOG;
+SET search_path TO public;
+RESET enable_indexscan;
+RESET enable_mergejoin;
+
+----
+---- No. A-13 call planner recursively
+----
+
+CREATE OR REPLACE FUNCTION nested_planner(cnt int) RETURNS int AS $$
+DECLARE
+ new_cnt int;
+BEGIN
+ RAISE NOTICE 'nested_planner(%)', cnt;
+
+ /* 再帰終了の判断 */
+ IF cnt <= 1 THEN
+ RETURN 0;
+ END IF;
+
+ EXECUTE '/*+ IndexScan(t_1) */'
+ ' SELECT nested_planner($1) FROM s1.t1 t_1'
+ ' JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)'
+ ' ORDER BY t_1.c1 LIMIT 1'
+ INTO new_cnt USING cnt - 1;
+
+ RETURN new_cnt;
+END;
+$$ LANGUAGE plpgsql IMMUTABLE;
+
+----
+---- No. A-13-2 use hint of main query
+----
+
+--No.13-2-1
+EXPLAIN (COSTS false) SELECT nested_planner(1) FROM s1.t1 t_1 ORDER BY t_1.c1;
+/*+SeqScan(t_1)*/
+EXPLAIN (COSTS false) SELECT nested_planner(1) FROM s1.t1 t_1 ORDER BY t_1.c1;
+
+----
+---- No. A-13-3 output number of times of debugging log
+----
+
+--No.13-3-1
+EXPLAIN (COSTS false) SELECT nested_planner(1) FROM s1.t1 t_1 ORDER BY t_1.c1;
+/*+SeqScan(t_2)*/
+EXPLAIN (COSTS false) SELECT nested_planner(1) FROM s1.t1 t_1 ORDER BY t_1.c1;
+
+--No.13-3-2
+EXPLAIN (COSTS false) SELECT nested_planner(2) FROM s1.t1 t_1 ORDER BY t_1.c1;
+/*+SeqScan(t_2)*/
+EXPLAIN (COSTS false) SELECT nested_planner(2) FROM s1.t1 t_1 ORDER BY t_1.c1;
+
+--No.13-3-3
+EXPLAIN (COSTS false) SELECT nested_planner(5) FROM s1.t1 t_1 ORDER BY t_1.c1;
+/*+SeqScan(t_2)*/
+EXPLAIN (COSTS false) SELECT nested_planner(5) FROM s1.t1 t_1 ORDER BY t_1.c1;
+
+----
+---- No. A-13-4 output of debugging log on hint status
+----
+
+--No.13-4-1
+/*+HashJoin(t_1 t_2)*/
+EXPLAIN (COSTS false)
+ SELECT nested_planner(2) FROM s1.t1 t_1
+ JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+ ORDER BY t_1.c1;
+
+--No.13-4-2
+/*+HashJoin(st_1 st_2)*/
+EXPLAIN (COSTS false)
+ SELECT nested_planner(2) FROM s1.t1 st_1
+ JOIN s1.t2 st_2 ON (st_1.c1 = st_2.c1)
+ ORDER BY st_1.c1;
+
+--No.13-4-3
+/*+HashJoin(t_1 t_2)*/
+EXPLAIN (COSTS false)
+ SELECT nested_planner(2) FROM s1.t1 st_1
+ JOIN s1.t2 st_2 ON (st_1.c1 = st_2.c1)
+ ORDER BY st_1.c1;
+
+--No.13-4-4
+/*+HashJoin(st_1 st_2)*/
+EXPLAIN (COSTS false)
+ SELECT nested_planner(2) FROM s1.t1 t_1
+ JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+ ORDER BY t_1.c1;
+
+--No.13-4-5
+/*+HashJoin(t_1 t_1)*/
+EXPLAIN (COSTS false)
+ SELECT nested_planner(2) FROM s1.t1 t_1
+ ORDER BY t_1.c1;
+
+--No.13-4-6
+CREATE OR REPLACE FUNCTION nested_planner_one_t(cnt int) RETURNS int AS $$
+DECLARE
+ new_cnt int;
+BEGIN
+ RAISE NOTICE 'nested_planner_one_t(%)', cnt;
+
+ IF cnt <= 1 THEN
+ RETURN 0;
+ END IF;
+
+ EXECUTE '/*+ IndexScan(t_1) */'
+ ' SELECT nested_planner_one_t($1) FROM s1.t1 t_1'
+ ' ORDER BY t_1.c1 LIMIT 1'
+ INTO new_cnt USING cnt - 1;
+
+ RETURN new_cnt;
+END;
+$$ LANGUAGE plpgsql IMMUTABLE;
+
+EXPLAIN (COSTS false)
+ SELECT nested_planner_one_t(2) FROM s1.t1 t_1
+ JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+ ORDER BY t_1.c1;
+/*+HashJoin(t_1 t_1)*/
+EXPLAIN (COSTS false)
+ SELECT nested_planner_one_t(2) FROM s1.t1 t_1
+ JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+ ORDER BY t_1.c1;
+
+DROP FUNCTION nested_planner_one_t(int);
+
+--No.13-4-7
+/*+HashJoin(t_1 t_1)*/
+EXPLAIN (COSTS false)
+ SELECT nested_planner(2) FROM s1.t1 t_1
+ JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+ ORDER BY t_1.c1;
+
+--No.13-4-8
+/*+MergeJoin(t_1 t_2)HashJoin(t_1 t_2)*/
+EXPLAIN (COSTS false)
+ SELECT nested_planner(2) FROM s1.t1 t_1
+ JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+ ORDER BY t_1.c1;
--- /dev/null
+LOAD 'pg_hint_plan';
+SET pg_hint_plan.enable_hint TO on;
+SET pg_hint_plan.debug_print TO on;
+SET client_min_messages TO LOG;
+SET search_path TO public;
+
+----
+---- No. G-1-1 RULE definition table
+----
+
+-- No. G-1-1-1
+EXPLAIN (COSTS false) UPDATE s1.r1 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+/*+
+Set(enable_tidscan off)Set(enable_nestloop off)
+*/
+EXPLAIN (COSTS false) UPDATE s1.r1 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+EXPLAIN (COSTS false) UPDATE s1.r1_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+/*+
+Set(enable_tidscan off)Set(enable_nestloop off)
+*/
+EXPLAIN (COSTS false) UPDATE s1.r1_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+
+-- No. G-1-1-2
+EXPLAIN (COSTS false) UPDATE s1.r2 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+/*+
+Set(enable_tidscan off)Set(enable_nestloop off)
+*/
+EXPLAIN (COSTS false) UPDATE s1.r2 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+EXPLAIN (COSTS false) UPDATE s1.r2_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+/*+
+Set(enable_tidscan off)Set(enable_nestloop off)
+*/
+EXPLAIN (COSTS false) UPDATE s1.r2_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+
+-- No. G-1-1-3
+EXPLAIN (COSTS false) UPDATE s1.r3 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+/*+
+Set(enable_tidscan off)Set(enable_nestloop off)
+*/
+EXPLAIN (COSTS false) UPDATE s1.r3 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+EXPLAIN (COSTS false) UPDATE s1.r3_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+/*+
+Set(enable_tidscan off)Set(enable_nestloop off)
+*/
+EXPLAIN (COSTS false) UPDATE s1.r3_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+
+RESET client_min_messages;
+
+----
+---- No. G-2-2 category of GUC parameter and role
+----
+
+-- No. G-2-2-1
+SET ROLE super_user;
+/*+Set(block_size 16384)*/
+SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. G-2-2-2
+/*+Set(archive_mode off)*/
+SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. G-2-2-3
+/*+Set(archive_timeout 0)*/
+SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. G-2-2-4
+/*+Set(log_connections off)*/
+SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. G-2-2-5
+/*+Set(log_min_messages WARNING)*/
+SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+RESET ROLE;
+
+-- No. G-2-2-6
+GRANT ALL ON SCHEMA s1 TO PUBLIC;
+GRANT SELECT ON ALL TABLES IN SCHEMA s1 TO normal_user;
+SET ROLE normal_user;
+/*+Set(log_min_messages WARNING)*/
+SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. G-2-2-7
+/*+Set(enable_seqscan on)*/
+SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+RESET ROLE;
+REVOKE SELECT ON ALL TABLES IN SCHEMA s1 FROM normal_user;
+REVOKE ALL ON SCHEMA s1 FROM PUBLIC;
+
+----
+---- No. G-2-3 conflict set hint
+----
+
+SET client_min_messages TO LOG;
+-- No. G-2-3-1
+/*+Set(enable_indexscan on)Set(enable_indexscan off)*/
+SELECT * FROM s1.t1 WHERE false;
+
+-- No. G-2-3-2
+/*+Set(client_min_messages DEBUG5)Set(client_min_messages WARNING)Set(client_min_messages DEBUG2)*/
+SELECT * FROM s1.t1 WHERE false;
+
+-- No. G-2-3-3
+/*+Set(enable_indexscan on)Set(enable_indexscan o)*/
+SELECT * FROM s1.t1 WHERE false;
+
+-- No. G-2-3-4
+/*+Set(client_min_messages DEBUG5)Set(client_min_messages WARNING)Set(client_min_messages DEBU)*/
+SELECT * FROM s1.t1 WHERE false;
+
+----
+---- No. G-2-4 debug message
+----
+
+-- No. G-2-4-1
+/*+SeqScan(a)IndexScan(a)SeqScan(c)NestLoop(a) */
+SELECT * FROM s1.t1 a, s1.t2 b WHERE false;
--- /dev/null
+LOAD 'pg_hint_plan';
+SET pg_hint_plan.enable_hint TO on;
+SET pg_hint_plan.debug_print TO on;
+SET client_min_messages TO LOG;
+SET search_path TO public;
+
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+
+----
+---- No. J-1-1 specified pattern of the object name
+----
+
+-- No. J-1-1-1
+/*+HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+
+-- No. J-1-1-2
+/*+HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 t_1, s1.t2 t_2 WHERE t_1.c1 = t_2.c1;
+
+-- No. J-1-1-3
+/*+HashJoin(t_1 t_2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 t_1, s1.t2 t_2 WHERE t_1.c1 = t_2.c1;
+
+
+----
+---- No. J-1-2 specified schema name in the hint option
+----
+
+-- No. J-1-2-1
+/*+HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+
+-- No. J-1-2-2
+/*+HashJoin(s1.t1 s1.t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+
+----
+---- No. J-1-3 table doesn't exist in the hint option
+----
+
+-- No. J-1-3-1
+/*+HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+
+-- No. J-1-3-2
+/*+HashJoin(t3 t4)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+
+----
+---- No. J-1-4 conflict table name
+----
+
+-- No. J-1-4-1
+/*+HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+
+-- No. J-1-4-2
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s2.t1 WHERE s1.t1.c1 = s2.t1.c1;
+/*+HashJoin(t1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s2.t1 WHERE s1.t1.c1 = s2.t1.c1;
+/*+HashJoin(s1.t1 s2.t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s2.t1 WHERE s1.t1.c1 = s2.t1.c1;
+
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s2.t1 s2t1 WHERE s1.t1.c1 = s2t1.c1;
+/*+HashJoin(t1 s2t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s2.t1 s2t1 WHERE s1.t1.c1 = s2t1.c1;
+
+-- No. J-1-4-3
+EXPLAIN (COSTS false) SELECT *, (SELECT max(t1.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+/*+HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT *, (SELECT max(t1.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+/*+NestLoop(st1 st2)HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT *, (SELECT max(st1.c1) FROM s1.t1 st1, s1.t2 st2 WHERE st1.c1 = st2.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+
+----
+---- No. J-1-5 conflict table name
+----
+
+-- No. J-1-5-1
+/*+HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+
+-- No. J-1-5-2
+/*+HashJoin(t1 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+
+-- No. J-1-5-3
+/*+HashJoin(t1 t1)HashJoin(t2 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+/*+HashJoin(t1 t2 t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+
+----
+---- No. J-1-6 object type for the hint
+----
+
+-- No. J-1-6-1
+/*+HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+
+-- No. J-1-6-2
+EXPLAIN (COSTS false) SELECT * FROM s1.p1 t1, s1.p1 t2 WHERE t1.c1 = t2.c1;
+/*+NestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.p1 t1, s1.p1 t2 WHERE t1.c1 = t2.c1;
+
+-- No. J-1-6-3
+EXPLAIN (COSTS false) SELECT * FROM s1.ul1 t1, s1.ul1 t2 WHERE t1.c1 = t2.c1;
+/*+NestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ul1 t1, s1.ul1 t2 WHERE t1.c1 = t2.c1;
+
+-- No. J-1-6-4
+CREATE TEMP TABLE tm1 (LIKE s1.t1 INCLUDING ALL);
+EXPLAIN (COSTS false) SELECT * FROM tm1 t1, tm1 t2 WHERE t1.c1 = t2.c1;
+/*+NestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM tm1 t1, tm1 t2 WHERE t1.c1 = t2.c1;
+
+-- No. J-1-6-5
+EXPLAIN (COSTS false) SELECT * FROM pg_catalog.pg_class t1, pg_catalog.pg_class t2 WHERE t1.oid = t2.oid;
+/*+NestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM pg_catalog.pg_class t1, pg_catalog.pg_class t2 WHERE t1.oid = t2.oid;
+
+-- No. J-1-6-6
+-- refer ut-fdw.sql
+
+-- No. J-1-6-7
+EXPLAIN (COSTS false) SELECT * FROM s1.f1() t1, s1.f1() t2 WHERE t1.c1 = t2.c1;
+/*+HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.f1() t1, s1.f1() t2 WHERE t1.c1 = t2.c1;
+
+-- No. J-1-6-8
+EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1'), (2,2,2,'2'), (3,3,3,'3')) AS t1 (c1, c2, c3, c4), s1.t2 WHERE t1.c1 = t2.c1;
+/*+NestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1'), (2,2,2,'2'), (3,3,3,'3')) AS t1 (c1, c2, c3, c4), s1.t2 WHERE t1.c1 = t2.c1;
+/*+NestLoop(*VALUES* t2)*/
+EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1'), (2,2,2,'2'), (3,3,3,'3')) AS t1 (c1, c2, c3, c4), s1.t2 WHERE t1.c1 = t2.c1;
+
+-- No. J-1-6-9
+EXPLAIN (COSTS false) WITH c1(c1) AS (SELECT max(t1.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1) SELECT * FROM s1.t1, c1 WHERE t1.c1 = c1.c1;
+/*+NestLoop(t1 t2)HashJoin(t1 c1)*/
+EXPLAIN (COSTS false) WITH c1(c1) AS (SELECT max(t1.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1) SELECT * FROM s1.t1, c1 WHERE t1.c1 = c1.c1;
+
+-- No. J-1-6-10
+EXPLAIN (COSTS false) SELECT * FROM s1.v1 t1, s1.v1 t2 WHERE t1.c1 = t2.c1;
+/*+NestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.v1 t1, s1.v1 t2 WHERE t1.c1 = t2.c1;
+/*+NestLoop(v1t1 v1t1_)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.v1 t1, s1.v1_ t2 WHERE t1.c1 = t2.c1;
+
+-- No. J-1-6-11
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1 AND t1.c1 = (SELECT max(st1.c1) FROM s1.t1 st1, s1.t2 st2 WHERE st1.c1 = st2.c1);
+/*+MergeJoin(t1 t2)NestLoop(st1 st2)*/
+EXPLAIN (COSTS true) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1 AND t1.c1 = (SELECT max(st1.c1) FROM s1.t1 st1, s1.t2 st2 WHERE st1.c1 = st2.c1);
+
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, (SELECT t2.c1 FROM s1.t2) st2 WHERE t1.c1 = st2.c1;
+/*+HashJoin(t1 st2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, (SELECT t2.c1 FROM s1.t2) st2 WHERE t1.c1 = st2.c1;
+/*+HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, (SELECT t2.c1 FROM s1.t2) st2 WHERE t1.c1 = st2.c1;
+
+----
+---- No. J-2-1 complexity query block
+----
+
+-- No. J-2-1-1
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1), (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+;
+/*+
+Leading(bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2)
+MergeJoin(bmt1 bmt2)HashJoin(bmt1 bmt2 bmt3)NestLoop(bmt1 bmt2 bmt3 bmt4)
+MergeJoin(b1t2 b1t3)HashJoin(b1t2 b1t3 b1t4)NestLoop(b1t2 b1t3 b1t4 b1t1)
+MergeJoin(b2t3 b2t4)HashJoin(b2t3 b2t4 b2t1)NestLoop(b2t3 b2t4 b2t1 b2t2)
+*/
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1), (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+;
+
+-- No. J-2-1-2
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1), (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+), (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+;
+/*+
+Leading(bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2 b3t4 b3t1 b3t2 b3t3)
+MergeJoin(bmt1 bmt2)HashJoin(bmt1 bmt2 bmt3)NestLoop(bmt1 bmt2 bmt3 bmt4)
+MergeJoin(b1t2 b1t3)HashJoin(b1t2 b1t3 b1t4)NestLoop(b1t2 b1t3 b1t4 b1t1)
+MergeJoin(b2t3 b2t4)HashJoin(b2t3 b2t4 b2t1)NestLoop(b2t3 b2t4 b2t1 b2t2)
+MergeJoin(b3t4 b3t1)HashJoin(b3t4 b3t1 b3t2)NestLoop(b3t1 b3t2 b3t3 b3t4)
+*/
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1), (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+), (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+;
+
+-- No. J-2-1-3
+EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, (SELECT ctid, * FROM s1.t3 bmt3) sbmt3, (SELECT ctid, * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = sbmt3.c1 AND sbmt3.ctid = '(1,1)' AND bmt1.c1 = sbmt4.c1 AND sbmt4.ctid = '(1,1)';
+/*+
+Leading(bmt4 bmt3 bmt2 bmt1)
+MergeJoin(bmt4 bmt3)HashJoin(bmt4 bmt3 bmt2)NestLoop(bmt1 bmt2 bmt3 bmt4)
+*/
+EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, (SELECT ctid, * FROM s1.t3 bmt3) sbmt3, (SELECT ctid, * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = sbmt3.c1 AND sbmt3.ctid = '(1,1)' AND bmt1.c1 = sbmt4.c1 AND sbmt4.ctid = '(1,1)';
+
+-- No. J-2-1-4
+EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, (SELECT ctid, * FROM s1.t2 bmt2) sbmt2, (SELECT ctid, * FROM s1.t3 bmt3) sbmt3, (SELECT ctid, * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = sbmt2.c1 AND sbmt2.ctid = '(1,1)' AND bmt1.c1 = sbmt3.c1 AND sbmt3.ctid = '(1,1)' AND bmt1.c1 = sbmt4.c1 AND sbmt4.ctid = '(1,1)';
+/*+
+Leading(bmt4 bmt3 bmt2 bmt1)
+MergeJoin(bmt4 bmt3)HashJoin(bmt4 bmt3 bmt2)NestLoop(bmt1 bmt2 bmt3 bmt4)
+*/
+EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, (SELECT ctid, * FROM s1.t2 bmt2) sbmt2, (SELECT ctid, * FROM s1.t3 bmt3) sbmt3, (SELECT ctid, * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = sbmt2.c1 AND sbmt2.ctid = '(1,1)' AND bmt1.c1 = sbmt3.c1 AND sbmt3.ctid = '(1,1)' AND bmt1.c1 = sbmt4.c1 AND sbmt4.ctid = '(1,1)';
+
+-- No. J-2-1-5
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+ AND bmt1.c1 <> (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+) AND bmt1.c1 <> (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+;
+/*+
+Leading(bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2)
+MergeJoin(bmt1 bmt2)HashJoin(bmt1 bmt2 bmt3)NestLoop(bmt1 bmt2 bmt3 bmt4)
+MergeJoin(b1t2 b1t3)HashJoin(b1t2 b1t3 b1t4)NestLoop(b1t2 b1t3 b1t4 b1t1)
+MergeJoin(b2t3 b2t4)HashJoin(b2t3 b2t4 b2t1)NestLoop(b2t3 b2t4 b2t1 b2t2)
+*/
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+ AND bmt1.c1 <> (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+) AND bmt1.c1 <> (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+;
+
+-- No. J-2-1-6
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+ AND bmt1.c1 <> (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+) AND bmt1.c1 <> (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+) AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+;
+/*+
+Leading(bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2 b3t4 b3t1 b3t2 b3t3)
+MergeJoin(bmt1 bmt2)HashJoin(bmt1 bmt2 bmt3)NestLoop(bmt1 bmt2 bmt3 bmt4)
+MergeJoin(b1t2 b1t3)HashJoin(b1t2 b1t3 b1t4)NestLoop(b1t2 b1t3 b1t4 b1t1)
+MergeJoin(b2t3 b2t4)HashJoin(b2t3 b2t4 b2t1)NestLoop(b2t3 b2t4 b2t1 b2t2)
+MergeJoin(b3t4 b3t1)HashJoin(b3t4 b3t1 b3t2)NestLoop(b3t1 b3t2 b3t3 b3t4)
+*/
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+ AND bmt1.c1 <> (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+) AND bmt1.c1 <> (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+) AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+;
+
+-- No. J-2-1-7
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+, c2 (c1) AS (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
+, c1, c2
+ WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 = c2.c1
+;
+/*+
+Leading(c2 c1 bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2)
+MergeJoin(c2 c1)HashJoin(c2 c1 bmt1)NestLoop(c2 c1 bmt1 bmt2)MergeJoin(c2 c1 bmt1 bmt2 bmt3)HashJoin(c2 c1 bmt1 bmt2 bmt3 bmt4)
+MergeJoin(b1t2 b1t3)HashJoin(b1t2 b1t3 b1t4)NestLoop(b1t2 b1t3 b1t4 b1t1)
+MergeJoin(b2t3 b2t4)HashJoin(b2t3 b2t4 b2t1)NestLoop(b2t3 b2t4 b2t1 b2t2)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+, c2 (c1) AS (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
+, c1, c2
+ WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 = c2.c1
+;
+
+-- No. J-2-1-8
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+, c2 (c1) AS (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+, c3 (c1) AS (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
+, c1, c2, c3
+ WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 = c2.c1
+AND bmt1.c1 = c3.c1
+;
+/*+
+Leading(c3 c2 c1 bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2 b3t4 b3t1 b3t2 b3t3)
+MergeJoin(c3 c2)HashJoin(c3 c2 c1)NestLoop(c3 c2 c1 bmt1)MergeJoin(c3 c2 c1 bmt1 bmt2)HashJoin(c3 c2 c1 bmt1 bmt2 bmt3)NestLoop(c3 c2 c1 bmt1 bmt2 bmt3 bmt4)
+MergeJoin(b1t2 b1t3)HashJoin(b1t2 b1t3 b1t4)NestLoop(b1t2 b1t3 b1t4 b1t1)
+MergeJoin(b2t3 b2t4)HashJoin(b2t3 b2t4 b2t1)NestLoop(b2t3 b2t4 b2t1 b2t2)
+MergeJoin(b3t4 b3t1)HashJoin(b3t4 b3t1 b3t2)NestLoop(b3t1 b3t2 b3t3 b3t4)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+, c2 (c1) AS (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+, c3 (c1) AS (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
+, c1, c2, c3
+ WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 = c2.c1
+AND bmt1.c1 = c3.c1
+;
+
+----
+---- No. J-2-2 the number of the tables per quiry block
+----
+
+-- No. J-2-2-1
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = 1
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = 1
+)
+ FROM s1.t1 bmt1, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = 1
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = 1
+)
+;
+/*+
+Leading(c1 bmt1 b1t1 b2t1 b3t1)
+HashJoin(bmt1 c1)
+HashJoin(b1t1 c1)
+HashJoin(b2t1 c1)
+HashJoin(b3t1 c1)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = 1
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = 1
+)
+ FROM s1.t1 bmt1, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = 1
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = 1
+)
+;
+
+-- No. J-2-2-2
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)'
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)'
+)
+;
+/*+
+Leading(c1 bmt2 b1t2 b2t2 b3t2 bmt1 b1t1 b2t1 b3t1)
+MergeJoin(c1 bmt2)
+HashJoin(c1 bmt1 bmt2)
+MergeJoin(b1t1 b1t2)
+MergeJoin(b2t1 b2t2)
+MergeJoin(b3t1 b3t2)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)'
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)'
+)
+;
+
+-- No. J-2-2-3
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+;
+/*+
+Leading(c1 bmt4 b1t4 b2t4 b3t4 bmt3 b1t3 b2t3 b3t3 bmt2 b1t2 b2t2 b3t2 bmt1 b1t1 b2t1 b3t1)
+MergeJoin(c1 bmt4)
+HashJoin(c1 bmt4 bmt3)
+NestLoop(c1 bmt4 bmt3 bmt2)
+MergeJoin(c1 bmt4 bmt3 bmt2 bmt1)
+HashJoin(b1t4 b1t3)
+NestLoop(b1t4 b1t3 b1t2)
+MergeJoin(b1t4 b1t3 b1t2 b1t1)
+HashJoin(b2t4 b2t3)
+NestLoop(b2t4 b2t3 b2t2)
+MergeJoin(b2t4 b2t3 b2t2 b2t1)
+HashJoin(b3t4 b3t3)
+NestLoop(b3t4 b3t3 b3t2)
+MergeJoin(b3t4 b3t3 b3t2 b3t1)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+;
+
+-- No. J-2-2-4
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = 1
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)'
+)
+;
+/*+
+Leading(c1 bmt4 b1t4 bmt3 b1t3 bmt2 b1t2 bmt1 b1t1 b2t1 b3t1)
+MergeJoin(c1 bmt4)
+HashJoin(c1 bmt4 bmt3)
+NestLoop(c1 bmt4 bmt3 bmt2)
+MergeJoin(c1 bmt4 bmt3 bmt2 bmt1)
+MergeJoin(b1t4 b1t3)
+HashJoin(b1t4 b1t3 b1t2)
+NestLoop(b1t4 b1t3 b1t2 b1t1)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = 1
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)'
+)
+;
+
+----
+---- No. J-2-3 RULE definition table
+----
+
+-- No. J-2-3-1
+EXPLAIN (COSTS false) UPDATE s1.r1 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+/*+
+Leading(t4 t3 t2 t1 r1)
+MergeJoin(t4 t3 t2 t1 r1)
+HashJoin(t4 t3 t2 t1)
+NestLoop(t4 t3 t2)
+MergeJoin(t4 t3)
+*/
+EXPLAIN (COSTS false) UPDATE s1.r1 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+EXPLAIN (COSTS false) UPDATE s1.r1_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+/*+
+Leading(b1t4 b1t3 b1t2 b1t1 r1_)
+MergeJoin(b1t4 b1t3 b1t2 b1t1 r1_)
+HashJoin(b1t4 b1t3 b1t2 b1t1)
+NestLoop(b1t4 b1t3 b1t2)
+MergeJoin(b1t4 b1t3)
+*/
+EXPLAIN (COSTS false) UPDATE s1.r1_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+
+-- No. J-2-3-2
+EXPLAIN (COSTS false) UPDATE s1.r2 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+/*+
+Leading(t4 t3 t2 t1 r2)
+MergeJoin(t4 t3 t2 t1 r2)
+HashJoin(t4 t3 t2 t1)
+NestLoop(t4 t3 t2)
+MergeJoin(t4 t3)
+*/
+EXPLAIN (COSTS false) UPDATE s1.r2 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+EXPLAIN (COSTS false) UPDATE s1.r2_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+/*+Leading(
+b1t1 b1t2 b1t3 b1t4
+b2t1 b2t2 b2t3 b2t4 r2_
+)
+MergeJoin(b1t1 b1t2)
+HashJoin(b1t1 b1t2 b1t3)
+NestLoop(b1t1 b1t2 b1t3 b1t4)
+MergeJoin(b1t1 b1t2 b1t3 b1t4 r2_)
+MergeJoin(b2t1 b2t2)
+HashJoin(b2t1 b2t2 b2t3)
+NestLoop(b2t1 b2t2 b2t3 b2t4)
+MergeJoin(b2t1 b2t2 b2t3 b2t4 r2_)
+*/
+EXPLAIN (COSTS false) UPDATE s1.r2_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+
+-- No. J-2-3-3
+EXPLAIN (COSTS false) UPDATE s1.r3 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+/*+
+Leading(t4 t3 t2 t1 r3)
+MergeJoin(t4 t3 t2 t1 r3)
+HashJoin(t4 t3 t2 t1)
+NestLoop(t4 t3 t2)
+MergeJoin(t4 t3)
+*/
+EXPLAIN (COSTS false) UPDATE s1.r3 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+EXPLAIN (COSTS false) UPDATE s1.r3_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+/*+Leading(
+b1t1 b1t2 b1t3 b1t4
+b2t1 b2t2 b2t3 b2t4
+b3t1 b3t2 b3t3 b3t4 r3_
+)
+MergeJoin(b1t1 b1t2)
+HashJoin(b1t1 b1t2 b1t3)
+NestLoop(b1t1 b1t2 b1t3 b1t4)
+MergeJoin(b1t1 b1t2 b1t3 b1t4 r3_)
+MergeJoin(b2t1 b2t2)
+HashJoin(b2t1 b2t2 b2t3)
+NestLoop(b2t1 b2t2 b2t3 b2t4)
+MergeJoin(b2t1 b2t2 b2t3 b2t4 r3_)
+MergeJoin(b3t1 b3t2)
+HashJoin(b3t1 b3t2 b3t3)
+NestLoop(b3t1 b3t2 b3t3 b3t4)
+MergeJoin(b3t1 b3t2 b3t3 b3t4 r3_)
+*/
+EXPLAIN (COSTS false) UPDATE s1.r3_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+
+----
+---- No. J-2-4 VALUES clause
+----
+
+-- No. J-2-4-1
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+/*+ Leading(t3 t1 t2) HashJoin(t3 t1)NestLoop(t3 t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+/*+ Leading(*VALUES* t1 t2) HashJoin(*VALUES* t1)NestLoop(*VALUES* t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+
+-- No. J-2-4-2
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4), (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t4 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+/*+ Leading(t4 t3 t2 t1) NestLoop(t4 t3)HashJoin(t4 t3 t2)MergeJoin(t4 t3 t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4), (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t4 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+/*+ Leading(*VALUES* t3 t2 t1) NestLoop(t4 t3)HashJoin(*VALUES* t3 t2)MergeJoin(*VALUES* t3 t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4), (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t4 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+
+----
+---- No. J-3-1 join method hint
+----
+
+-- No. J-3-1-1~6
+SET enable_nestloop TO on;
+SET enable_mergejoin TO off;
+SET enable_hashjoin TO off;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+/*+NestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+/*+HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+/*+MergeJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+SET enable_mergejoin TO on;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1 AND t1.ctid = '(1,1)';;
+/*+NoNestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1 AND t1.ctid = '(1,1)';;
+SET enable_mergejoin TO off;
+/*+NoHashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+/*+NoMergeJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+
+-- No. J-3-1-7~12
+SET enable_nestloop TO off;
+SET enable_mergejoin TO off;
+SET enable_hashjoin TO on;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+/*+NestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+/*+HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+/*+MergeJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+/*+NoNestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+/*+NoHashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+/*+NoMergeJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+
+-- No. J-3-1-13~18
+SET enable_nestloop TO off;
+SET enable_mergejoin TO on;
+SET enable_hashjoin TO off;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+/*+NestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+/*+HashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+/*+MergeJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+/*+NoNestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+/*+NoHashJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+/*+NoMergeJoin(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+
+SET enable_nestloop TO on;
+SET enable_mergejoin TO on;
+SET enable_hashjoin TO on;
+
+----
+---- No. J-3-2 join inherit tables
+----
+EXPLAIN (COSTS false) SELECT * FROM s1.p1, s1.p2 WHERE p1.c1 = p2.c1;
+
+-- No. J-3-2-1
+/*+MergeJoin(p1 p2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.p1, s1.p2 WHERE p1.c1 = p2.c1;
+
+-- No. J-3-2-2
+/*+MergeJoin(p1c1 p2c1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.p1, s1.p2 WHERE p1.c1 = p2.c1;
+
+----
+---- No. J-3-3 conflict join method hint
+----
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+
+-- No. J-3-3-1
+/*+HashJoin(t1 t2)NestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+
+-- No. J-3-3-2
+/*+MergeJoin(t1 t2)HashJoin(t1 t2)NestLoop(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+
+-- No. J-3-3-3
+/*+HashJoin(t1 t2)NestLoop(t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+
+-- No. J-3-3-4
+/*+MergeJoin(t2 t1)HashJoin(t1 t2)NestLoop(t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+
+----
+---- No. J-3-4 hint state output
+----
+
+-- No. J-3-4-1
+/*+NestLoop(t1 t2)*/
+SELECT * FROM s1.t1, s1.t2 WHERE false;
+
+-- No. J-3-4-2
+/*+HashJoin(t1 t2)*/
+SELECT * FROM s1.t1, s1.t2 WHERE false;
+
+-- No. J-3-4-3
+/*+MergeJoin(t1 t2)*/
+SELECT * FROM s1.t1, s1.t2 WHERE false;
+
+-- No. J-3-4-4
+/*+NoNestLoop(t1 t2)*/
+SELECT * FROM s1.t1, s1.t2 WHERE false;
+
+-- No. J-3-4-5
+/*+NoHashJoin(t1 t2)*/
+SELECT * FROM s1.t1, s1.t2 WHERE false;
+
+-- No. J-3-4-6
+/*+NoMergeJoin(t1 t2)*/
+SELECT * FROM s1.t1, s1.t2 WHERE false;
+
+-- No. J-3-4-7
+/*+NestLoop()*/
+SELECT * FROM s1.t1 WHERE false;
+
+-- No. J-3-4-8
+/*+NestLoop(t1)*/
+SELECT * FROM s1.t1 WHERE false;
+
+-- No. J-3-4-9
+/*+NestLoop(t1 t2)*/
+SELECT * FROM s1.t1, s1.t2 WHERE false;
+
+-- No. J-3-4-10
+/*+NestLoop(t1 t2 t3)*/
+SELECT * FROM s1.t1, s1.t2, s1.t3 WHERE false;
--- /dev/null
+LOAD 'pg_hint_plan';
+SET pg_hint_plan.enable_hint TO on;
+SET pg_hint_plan.debug_print TO on;
+SET client_min_messages TO LOG;
+SET search_path TO public;
+
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+
+----
+---- No. L-1-1 specified pattern of the object name
+----
+
+-- No. L-1-1-1
+/*+Leading(t4 t2 t3 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+
+-- No. L-1-1-2
+/*+Leading(t4 t2 t3 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 t_1, s1.t2 t_2, s1.t3 t_3, s1.t4 t_4 WHERE t_1.c1 = t_2.c1 AND t_1.c1 = t_3.c1 AND t_1.c1 = t_4.c1;
+
+-- No. L-1-1-3
+/*+Leading(t_4 t_2 t_3 t_1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 t_1, s1.t2 t_2, s1.t3 t_3, s1.t4 t_4 WHERE t_1.c1 = t_2.c1 AND t_1.c1 = t_3.c1 AND t_1.c1 = t_4.c1;
+
+----
+---- No. L-1-2 specified schema name in the hint option
+----
+
+-- No. L-1-2-1
+/*+Leading(t4 t2 t3 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+
+-- No. L-1-2-2
+/*+Leading(s1.t4 s1.t2 s1.t3 s1.t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+
+----
+---- No. L-1-3 table doesn't exist in the hint option
+----
+
+-- No. L-1-3-1
+/*+Leading(t4 t2 t3 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+
+-- No. L-1-3-2
+/*+Leading(t5 t2 t3 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+
+----
+---- No. L-1-4 conflict table name
+----
+
+-- No. L-1-4-1
+/*+Leading(t4 t2 t3 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+
+-- No. L-1-4-2
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s2.t1 WHERE s1.t1.c1 = t2.c1 AND s1.t1.c1 = t3.c1 AND s1.t1.c1 = s2.t1.c1;
+/*+Leading(t1 t2 t3 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s2.t1 WHERE s1.t1.c1 = t2.c1 AND s1.t1.c1 = t3.c1 AND s1.t1.c1 = s2.t1.c1;
+/*+Leading(s1.t1 t2 t3 s2.t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s2.t1 WHERE s1.t1.c1 = t2.c1 AND s1.t1.c1 = t3.c1 AND s1.t1.c1 = s2.t1.c1;
+
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s2.t1 s2t1 WHERE s1.t1.c1 = t2.c1 AND s1.t1.c1 = t3.c1 AND s1.t1.c1 = s2t1.c1;
+/*+Leading(s2t1 t1 t3 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s2.t1 s2t1 WHERE s1.t1.c1 = t2.c1 AND s1.t1.c1 = t3.c1 AND s1.t1.c1 = s2t1.c1;
+
+-- No. L-1-4-3
+EXPLAIN (COSTS false) SELECT *, (SELECT max(t1.c1) FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1) FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+/*+Leading(t4 t2 t3 t1)*/
+EXPLAIN (COSTS false) SELECT *, (SELECT max(t1.c1) FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1) FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+/*+Leading(st1 st2 st3 st4 t4 t2 t3 t1)*/
+EXPLAIN (COSTS false) SELECT *, (SELECT max(st1.c1) FROM s1.t1 st1, s1.t2 st2, s1.t3 st3, s1.t4 st4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1) FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+
+----
+---- No. L-1-5 conflict table name
+----
+
+-- No. L-1-5-1
+/*+Leading(t4 t2 t3 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+
+-- No. L-1-5-2
+/*+Leading(t4 t2 t3 t1 t4)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+/*+Leading(t4 t2 t3 t4)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+
+-- No. L-1-5-3
+/*+Leading(t4 t2 t3 t1 t4 t2 t3 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+/*+Leading(t4 t2 t2 t4)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+
+----
+---- No. L-1-6 object type for the hint
+----
+
+-- No. L-1-6-1
+/*+Leading(t4 t2 t3 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+
+-- No. L-1-6-2
+EXPLAIN (COSTS false) SELECT * FROM s1.p1 t1, s1.p1 t2, s1.p1 t3, s1.p1 t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+/*+Leading(t4 t3 t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.p1 t1, s1.p1 t2, s1.p1 t3, s1.p1 t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+
+-- No. L-1-6-3
+EXPLAIN (COSTS false) SELECT * FROM s1.ul1 t1, s1.ul1 t2, s1.ul1 t3, s1.ul1 t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+/*+Leading(t4 t3 t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ul1 t1, s1.ul1 t2, s1.ul1 t3, s1.ul1 t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+
+-- No. L-1-6-4
+CREATE TEMP TABLE tm1 (LIKE s1.t1 INCLUDING ALL);
+EXPLAIN (COSTS false) SELECT * FROM tm1 t1, tm1 t2, tm1 t3, tm1 t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+/*+Leading(t4 t3 t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM tm1 t1, tm1 t2, tm1 t3, tm1 t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+
+-- No. L-1-6-5
+EXPLAIN (COSTS false) SELECT * FROM pg_catalog.pg_class t1, pg_catalog.pg_class t2, pg_catalog.pg_class t3, pg_catalog.pg_class t4 WHERE t1.oid = t2.oid AND t1.oid = t3.oid AND t1.oid = t4.oid;
+/*+Leading(t4 t3 t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM pg_catalog.pg_class t1, pg_catalog.pg_class t2, pg_catalog.pg_class t3, pg_catalog.pg_class t4 WHERE t1.oid = t2.oid AND t1.oid = t3.oid AND t1.oid = t4.oid;
+
+-- No. L-1-6-6
+-- refer ut-fdw.sql
+
+-- No. L-1-6-7
+EXPLAIN (COSTS false) SELECT * FROM s1.f1() t1, s1.f1() t2, s1.f1() t3, s1.f1() t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+/*+Leading(t4 t3 t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.f1() t1, s1.f1() t2, s1.f1() t3, s1.f1() t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+
+-- No. L-1-6-8
+EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1')) AS t1 (c1, c2, c3, c4), s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+/*+Leading(t4 t3 t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1')) AS t1 (c1, c2, c3, c4), s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+
+-- No. L-1-6-9
+EXPLAIN (COSTS false) WITH c1(c1) AS (SELECT st1.c1 FROM s1.t1 st1, s1.t1 st2, s1.t1 st3, s1.t1 st4 WHERE st1.c1 = st2.c1 AND st1.c1 = st3.c1 AND st1.c1 = st4.c1) SELECT * FROM c1 ct1, c1 ct2, c1 ct3, c1 ct4 WHERE ct1.c1 = ct2.c1 AND ct1.c1 = ct3.c1 AND ct1.c1 = ct4.c1;
+/*+Leading(ct4 ct3 ct2 ct1 st4 st3 st2 st1)*/
+EXPLAIN (COSTS false) WITH c1(c1) AS (SELECT st1.c1 FROM s1.t1 st1, s1.t1 st2, s1.t1 st3, s1.t1 st4 WHERE st1.c1 = st2.c1 AND st1.c1 = st3.c1 AND st1.c1 = st4.c1) SELECT * FROM c1 ct1, c1 ct2, c1 ct3, c1 ct4 WHERE ct1.c1 = ct2.c1 AND ct1.c1 = ct3.c1 AND ct1.c1 = ct4.c1;
+
+-- No. L-1-6-10
+EXPLAIN (COSTS false) SELECT * FROM s1.v1 t1, s1.v1 t2, s1.v1 t3, s1.v1 t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+/*+Leading(t4 t3 t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.v1 t1, s1.v1 t2, s1.v1 t3, s1.v1 t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+EXPLAIN (COSTS false) SELECT * FROM s1.v1 t1, s1.v1_ t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+/*+Leading(t4 v1t1_ v1t1 t3)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.v1 t1, s1.v1_ t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+
+-- No. L-1-6-11
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, (SELECT t4.c1 FROM s1.t4) st4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = st4.c1;
+/*+Leading(st4 t2 t3 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, (SELECT t4.c1 FROM s1.t4) st4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = st4.c1;
+/*+Leading(t4 t2 t3 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, (SELECT t4.c1 FROM s1.t4) st4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = st4.c1;
+
+----
+---- No. L-2-1 complexity query block
+----
+
+-- No. L-2-1-1
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1), (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+;
+/*+
+Leading(bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2)
+*/
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1), (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+;
+
+-- No. L-2-1-2
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1), (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+), (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+;
+/*+
+Leading(bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2 b3t4 b3t1 b3t2 b3t3)
+*/
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1), (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+), (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+;
+
+-- No. L-2-1-3
+EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, (SELECT ctid, * FROM s1.t3 bmt3) sbmt3, (SELECT ctid, * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = sbmt3.c1 AND sbmt3.ctid = '(1,1)' AND bmt1.c1 = sbmt4.c1 AND sbmt4.ctid = '(1,1)';
+/*+
+Leading(bmt4 bmt3 bmt2 bmt1)
+*/
+EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, (SELECT ctid, * FROM s1.t3 bmt3) sbmt3, (SELECT ctid, * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = sbmt3.c1 AND sbmt3.ctid = '(1,1)' AND bmt1.c1 = sbmt4.c1 AND sbmt4.ctid = '(1,1)';
+
+-- No. L-2-1-4
+EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, (SELECT ctid, * FROM s1.t2 bmt2) sbmt2, (SELECT ctid, * FROM s1.t3 bmt3) sbmt3, (SELECT ctid, * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = sbmt2.c1 AND sbmt2.ctid = '(1,1)' AND bmt1.c1 = sbmt3.c1 AND sbmt3.ctid = '(1,1)' AND bmt1.c1 = sbmt4.c1 AND sbmt4.ctid = '(1,1)';
+/*+
+Leading(bmt4 bmt3 bmt2 bmt1)
+*/
+EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, (SELECT ctid, * FROM s1.t2 bmt2) sbmt2, (SELECT ctid, * FROM s1.t3 bmt3) sbmt3, (SELECT ctid, * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = sbmt2.c1 AND sbmt2.ctid = '(1,1)' AND bmt1.c1 = sbmt3.c1 AND sbmt3.ctid = '(1,1)' AND bmt1.c1 = sbmt4.c1 AND sbmt4.ctid = '(1,1)';
+
+-- No. L-2-1-5
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+ AND bmt1.c1 <> (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+) AND bmt1.c1 <> (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+;
+/*+
+Leading(bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2)
+*/
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+ AND bmt1.c1 <> (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+) AND bmt1.c1 <> (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+;
+
+-- No. L-2-1-6
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+ AND bmt1.c1 <> (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+) AND bmt1.c1 <> (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+) AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+;
+/*+
+Leading(bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2 b3t4 b3t1 b3t2 b3t3)
+*/
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+ AND bmt1.c1 <> (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+) AND bmt1.c1 <> (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+) AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+;
+
+-- No. L-2-1-7
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+, c2 (c1) AS (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
+, c1, c2
+ WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 = c2.c1
+;
+/*+
+Leading(c2 c1 bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+, c2 (c1) AS (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
+, c1, c2
+ WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 = c2.c1
+;
+
+-- No. L-2-1-8
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+, c2 (c1) AS (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+, c3 (c1) AS (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
+, c1, c2, c3
+ WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 = c2.c1
+AND bmt1.c1 = c3.c1
+;
+/*+
+Leading(c3 c2 c1 bmt1 bmt2 bmt3 bmt4 b1t2 b1t3 b1t4 b1t1 b2t3 b2t4 b2t1 b2t2 b3t4 b3t1 b3t2 b3t3)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+, c2 (c1) AS (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+, c3 (c1) AS (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
+, c1, c2, c3
+ WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 = c2.c1
+AND bmt1.c1 = c3.c1
+;
+
+----
+---- No. L-2-2 the number of the tables per quiry block
+----
+
+-- No. L-2-2-1
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = 1
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = 1
+)
+ FROM s1.t1 bmt1, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = 1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = 1
+)
+;
+/*+
+Leading(c1 bmt1 b1t1 b2t1 b3t1)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = 1
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = 1
+)
+ FROM s1.t1 bmt1, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = 1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = 1
+)
+;
+
+-- No. L-2-2-2
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)'
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)'
+)
+;
+/*+
+Leading(c1 bmt2 b1t2 b2t2 b3t2 bmt1 b1t1 b2t1 b3t1)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)'
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)'
+)
+;
+
+-- No. L-2-2-3
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+;
+/*+
+Leading(c1 bmt4 b1t4 b2t4 b3t4 bmt3 b1t3 b2t3 b3t3 bmt2 b1t2 b2t2 b3t2 bmt1 b1t1 b2t1 b3t1)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+;
+
+-- No. L-2-2-4
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = 1
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)'
+)
+;
+/*+
+Leading(c1 bmt4 b1t4 bmt3 b1t3 bmt2 b1t2 bmt1 b1t1 b2t1 b3t1)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = 1
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)'
+)
+;
+
+----
+---- No. L-2-3 RULE definition table
+----
+
+-- No. L-2-3-1
+EXPLAIN (COSTS false) UPDATE s1.r1 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+/*+ Leading(t4 t3 t2 t1 r1) */
+EXPLAIN (COSTS false) UPDATE s1.r1 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+EXPLAIN (COSTS false) UPDATE s1.r1_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+/*+ Leading(b1t1 b1t2 b1t3 b1t4 r1_) */
+EXPLAIN (COSTS false) UPDATE s1.r1_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+
+-- No. L-2-3-2
+EXPLAIN (COSTS false) UPDATE s1.r2 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+/*+ Leading(t4 t3 t2 t1 r2) */
+EXPLAIN (COSTS false) UPDATE s1.r2 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+EXPLAIN (COSTS false) UPDATE s1.r2_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+/*+Leading(
+b1t1 b1t2 b1t3 b1t4
+b2t1 b2t2 b2t3 b2t4 r2_
+) */
+EXPLAIN (COSTS false) UPDATE s1.r2_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+
+-- No. L-2-3-3
+EXPLAIN (COSTS false) UPDATE s1.r3 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+/*+ Leading(t4 t3 t2 t1 r3) */
+EXPLAIN (COSTS false) UPDATE s1.r3 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+EXPLAIN (COSTS false) UPDATE s1.r3_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+/*+Leading(
+b1t1 b1t2 b1t3 b1t4
+b2t1 b2t2 b2t3 b2t4
+b3t1 b3t2 b3t3 b3t4 r3_
+) */
+EXPLAIN (COSTS false) UPDATE s1.r3_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+
+----
+---- No. L-2-4 VALUES clause
+----
+
+-- No. L-2-4-1
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+/*+ Leading(t3 t1 t2) */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+/*+ Leading(*VALUES* t1 t2) */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+
+-- No. L-2-4-2
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4), (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t4 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+/*+ Leading(t4 t3 t2 t1) */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4), (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t4 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+/*+ Leading(*VALUES* t3 t2 t1) */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4), (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t4 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+
+----
+---- No. L-3-1 leading the order of table joins
+----
+
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+
+-- No. L-3-1-1
+/*+Leading(t3 t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+
+-- No. L-3-1-2
+/*+Leading(t1 t2 t3)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+
+----
+---- No. L-3-2 GUC parameter to disable hints
+----
+
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+
+-- No. L-3-2-1
+Set geqo_threshold = 3;
+Set geqo_seed = 0;
+/*+Leading(t1 t2 t3)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+Reset geqo_threshold;
+
+-- No. L-3-2-2
+Set geqo_threshold = 4;
+Set geqo_seed = 0;
+/*+Leading(t1 t2 t3)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+Reset geqo_threshold;
+
+-- No. L-3-2-3
+Set from_collapse_limit = 2;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.v2 WHERE t1.c1 = v2.c1;
+/*+Leading(t1 v2t1 v2t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.v2 WHERE t1.c1 = v2.c1;
+Reset from_collapse_limit;
+
+-- No. L-3-2-4
+Set from_collapse_limit = 3;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.v2 WHERE t1.c1 = v2.c1;
+/*+Leading(v2t1 v2t2 t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.v2 WHERE t1.c1 = v2.c1;
+Reset from_collapse_limit;
+
+-- No. L-3-2-5
+Set join_collapse_limit = 2;
+EXPLAIN (COSTS false) SELECT * FROM s1.t3
+ JOIN s1.t2 ON (t3.c1 = t2.c1)
+ JOIN s1.t1 ON (t1.c1 = t3.c1);
+/*+Leading(t1 t2 t3)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t3
+ JOIN s1.t2 ON (t3.c1 = t2.c1)
+ JOIN s1.t1 ON (t1.c1 = t3.c1);
+Reset join_collapse_limit;
+
+-- No. L-3-2-6
+Set join_collapse_limit = 3;
+EXPLAIN (COSTS false) SELECT * FROM s1.t3
+ JOIN s1.t2 ON (t3.c1 = t2.c1)
+ JOIN s1.t1 ON (t1.c1 = t3.c1);
+/*+Leading(t1 t2 t3)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t3
+ JOIN s1.t2 ON (t3.c1 = t2.c1)
+ JOIN s1.t1 ON (t1.c1 = t3.c1);
+Reset join_collapse_limit;
+
+----
+---- No. L-3-3 join between parents or between children
+----
+
+-- No. L-3-3-1
+/*+Leading(t1 t2 t3)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.p2c1 t1
+ JOIN s1.p2c2 t2 ON (t1.c1 = t2.c1)
+ JOIN s1.p2c3 t3 ON (t1.c1 = t3.c1);
+
+-- No. L-3-3-2
+/*+Leading(p2c1c1 p2c2c1 p2c3c1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.p2c1 t1
+ JOIN s1.p2c2 t2 ON (t1.c1 = t2.c1)
+ JOIN s1.p2c3 t3 ON (t1.c1 = t3.c1);
+
+----
+---- No. L-3-4 conflict leading hint
+----
+
+-- No. L-3-4-1
+EXPLAIN (COSTS false) SELECT * FROM s1.t1
+ JOIN s1.t2 ON (t1.c1 = t2.c1)
+ JOIN s1.t3 ON (t1.c1 = t3.c1);
+/*+Leading(t2 t3 t1)Leading(t1 t2 t3)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1
+ JOIN s1.t2 ON (t1.c1 = t2.c1)
+ JOIN s1.t3 ON (t1.c1 = t3.c1);
+
+-- No. L-3-4-2
+/*+Leading(t3 t1 t2)Leading(t2 t3 t1)Leading(t1 t2 t3)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1
+ JOIN s1.t2 ON (t1.c1 = t2.c1)
+ JOIN s1.t3 ON (t1.c1 = t3.c1);
+
+-- No. L-3-4-3
+/*+Leading(t2 t3 t1)Leading()*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1
+ JOIN s1.t2 ON (t1.c1 = t2.c1)
+ JOIN s1.t3 ON (t1.c1 = t3.c1);
+
+-- No. L-3-4-4
+/*+Leading(t3 t1 t2)Leading(t2 t3 t1)Leading()*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1
+ JOIN s1.t2 ON (t1.c1 = t2.c1)
+ JOIN s1.t3 ON (t1.c1 = t3.c1);
+
+----
+---- No. L-3-5 hint state output
+----
+
+-- No. L-3-5-1
+/*+Leading()*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1
+ JOIN s1.t2 ON (t1.c1 = t2.c1)
+ JOIN s1.t3 ON (t1.c1 = t3.c1);
+
+-- No. L-3-5-2
+/*+Leading(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1
+ JOIN s1.t2 ON (t1.c1 = t2.c1)
+ JOIN s1.t3 ON (t1.c1 = t3.c1);
+
+-- No. L-3-5-3
+/*+Leading(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1
+ JOIN s1.t2 ON (t1.c1 = t2.c1)
+ JOIN s1.t3 ON (t1.c1 = t3.c1);
+
+-- No. L-3-5-4
+/*+Leading(t1 t2 t3)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1
+ JOIN s1.t2 ON (t1.c1 = t2.c1)
+ JOIN s1.t3 ON (t1.c1 = t3.c1);
+
--- /dev/null
+LOAD 'pg_hint_plan';
+SET pg_hint_plan.enable_hint TO on;
+SET pg_hint_plan.debug_print TO on;
+SET client_min_messages TO LOG;
+SET search_path TO public;
+
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 >= 1;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c3 < 10;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid = '(1,1)';
+
+----
+---- No. S-1-1 specified pattern of the object name
+----
+
+-- No. S-1-1-1
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. S-1-1-2
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 t_1 WHERE t_1.c1 = 1;
+
+-- No. S-1-1-3
+/*+SeqScan(t_1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 t_1 WHERE t_1.c1 = 1;
+
+----
+---- No. S-1-2 specified schema name in the hint option
+----
+
+-- No. S-1-2-1
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. S-1-2-2
+/*+SeqScan(s1.t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+----
+---- No. S-1-3 table doesn't exist in the hint option
+----
+
+-- No. S-1-3-1
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. S-1-3-2
+/*+SeqScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+----
+---- No. S-1-4 conflict table name
+----
+
+-- No. S-1-4-1
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = 1 AND t1.c1 = t2.c1;
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = 1 AND t1.c1 = t2.c1;
+
+-- No. S-1-4-2
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s2.t1 WHERE s1.t1.c1 = 1 AND s1.t1.c1 = s2.t1.c1;
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s2.t1 WHERE s1.t1.c1 = 1 AND s1.t1.c1 = s2.t1.c1;
+
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s2.t1 s2t1 WHERE s1.t1.c1 = 1 AND s1.t1.c1 = s2t1.c1;
+/*+BitmapScan(s2t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s2.t1 s2t1 WHERE s1.t1.c1 = 1 AND s1.t1.c1 = s2t1.c1;
+
+-- No. S-1-4-3
+EXPLAIN (COSTS false) SELECT (SELECT max(c1) FROM s1.t1 WHERE s1.t1.c1 = 1) FROM s1.t1 WHERE s1.t1.c1 = 1;
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) SELECT (SELECT max(c1) FROM s1.t1 WHERE s1.t1.c1 = 1) FROM s1.t1 WHERE s1.t1.c1 = 1;
+
+/*+BitmapScan(t11)*/
+EXPLAIN (COSTS false) SELECT (SELECT max(c1) FROM s1.t1 t11 WHERE t11.c1 = 1) FROM s1.t1 t12 WHERE t12.c1 = 1;
+/*+BitmapScan(t12)*/
+EXPLAIN (COSTS false) SELECT (SELECT max(c1) FROM s1.t1 t11 WHERE t11.c1 = 1) FROM s1.t1 t12 WHERE t12.c1 = 1;
+
+----
+---- No. S-1-5 object type for the hint
+----
+
+-- No. S-1-5-1
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. S-1-5-2
+EXPLAIN (COSTS false) SELECT * FROM s1.p1 WHERE p1.c1 = 1;
+/*+IndexScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.p1 WHERE p1.c1 = 1;
+
+-- No. S-1-5-3
+EXPLAIN (COSTS false) SELECT * FROM s1.ul1 WHERE ul1.c1 = 1;
+/*+SeqScan(ul1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ul1 WHERE ul1.c1 = 1;
+
+-- No. S-1-5-4
+CREATE TEMP TABLE tm1 (LIKE s1.t1 INCLUDING ALL);
+EXPLAIN (COSTS false) SELECT * FROM tm1 WHERE tm1.c1 = 1;
+/*+SeqScan(tm1)*/
+EXPLAIN (COSTS false) SELECT * FROM tm1 WHERE tm1.c1 = 1;
+
+-- No. S-1-5-5
+EXPLAIN (COSTS false) SELECT * FROM pg_catalog.pg_class WHERE oid = 1;
+/*+SeqScan(pg_class)*/
+EXPLAIN (COSTS false) SELECT * FROM pg_catalog.pg_class WHERE oid = 1;
+
+-- No. S-1-5-6
+-- refer ut-fdw.sql
+
+-- No. S-1-5-7
+EXPLAIN (COSTS false) SELECT * FROM s1.f1() AS ft1 WHERE ft1.c1 = 1;
+/*+SeqScan(ft1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.f1() AS ft1 WHERE ft1.c1 = 1;
+
+-- No. S-1-5-8
+EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1'), (2,2,2,'2'), (3,3,3,'3')) AS val1 (c1, c2, c3, c4) WHERE val1.c1 = 1;
+/*+SeqScan(val1)*/
+EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1'), (2,2,2,'2'), (3,3,3,'3')) AS val1 (c1, c2, c3, c4) WHERE val1.c1 = 1;
+/*+SeqScan(*VALUES*)*/
+EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1'), (2,2,2,'2'), (3,3,3,'3')) AS val1 (c1, c2, c3, c4) WHERE val1.c1 = 1;
+
+-- No. S-1-5-9
+EXPLAIN (COSTS false) WITH c1(c1) AS (SELECT max(c1) FROM s1.t1 WHERE t1.c1 = 1)
+SELECT * FROM s1.t1, c1 WHERE t1.c1 = 1 AND t1.c1 = c1.c1;
+/*+SeqScan(c1)*/
+EXPLAIN (COSTS false) WITH c1(c1) AS (SELECT max(c1) FROM s1.t1 WHERE t1.c1 = 1)
+SELECT * FROM s1.t1, c1 WHERE t1.c1 = 1 AND t1.c1 = c1.c1;
+
+-- No. S-1-5-10
+EXPLAIN (COSTS false) SELECT * FROM s1.v1 WHERE v1.c1 = 1;
+/*+SeqScan(v1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.v1 WHERE v1.c1 = 1;
+
+-- No. S-1-5-11
+EXPLAIN (COSTS false) SELECT * FROM (SELECT * FROM s1.t1 WHERE t1.c1 = 1) AS s1 WHERE s1.c1 = 1;
+/*+SeqScan(s1)*/
+EXPLAIN (COSTS false) SELECT * FROM (SELECT * FROM s1.t1 WHERE t1.c1 = 1) AS s1 WHERE s1.c1 = 1;
+
+----
+---- No. S-2-1 complexity query block
+----
+
+-- No. S-2-1-1
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1), (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
+;
+/*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4)
+TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey)
+*/
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1), (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
+;
+
+-- No. S-2-1-2
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1), (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
+), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.c1 = b2t2.c1 AND b2t1.c1 = b2t3.c1 AND b2t1.c1 = b2t4.c1
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
+;
+/*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4)
+TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey)
+BitmapScan(b2t1 t1_pkey)TidScan(b2t2)SeqScan(b2t3)IndexScan(b2t4 t4_pkey)
+*/
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1), (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
+), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.c1 = b2t2.c1 AND b2t1.c1 = b2t3.c1 AND b2t1.c1 = b2t4.c1
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
+;
+
+-- No. S-2-1-3
+EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, (SELECT * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = sbmt4.c1;
+/*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4)
+*/
+EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, (SELECT * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = sbmt4.c1;
+
+-- No. S-2-1-4
+EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, (SELECT * FROM s1.t3 bmt3) sbmt3, (SELECT * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = sbmt3.c1 AND bmt1.c1 = sbmt4.c1;
+/*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4)
+*/
+EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, (SELECT * FROM s1.t3 bmt3) sbmt3, (SELECT * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = sbmt3.c1 AND bmt1.c1 = sbmt4.c1;
+
+-- No. S-2-1-5
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
+ AND bmt1.c1 <> (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
+)
+;
+/*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4)
+TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey)
+*/
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
+ AND bmt1.c1 <> (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
+)
+;
+
+-- No. S-2-1-6
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
+ AND bmt1.c1 <> (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
+) AND bmt1.c1 <> (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.c1 = b2t2.c1 AND b2t1.c1 = b2t3.c1 AND b2t1.c1 = b2t4.c1
+)
+;
+/*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4)
+TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey)
+BitmapScan(b2t1 t1_pkey)TidScan(b2t2)SeqScan(b2t3)IndexScan(b2t4 t4_pkey)
+*/
+EXPLAIN (COSTS false)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
+ AND bmt1.c1 <> (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
+) AND bmt1.c1 <> (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.c1 = b2t2.c1 AND b2t1.c1 = b2t3.c1 AND b2t1.c1 = b2t4.c1
+)
+;
+
+-- No. S-2-1-7
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
+)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
+, c1
+ WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
+AND bmt1.c1 = c1.c1
+;
+/*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4)
+TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
+)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
+, c1
+ WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
+AND bmt1.c1 = c1.c1
+;
+
+-- No. S-2-1-8
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
+)
+, c2 (c1) AS (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.c1 = b2t2.c1 AND b2t1.c1 = b2t3.c1 AND b2t1.c1 = b2t4.c1
+)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
+, c1, c2
+ WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 = c2.c1
+;
+/*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4)
+TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey)
+BitmapScan(b2t1 t1_pkey)TidScan(b2t2)SeqScan(b2t3)IndexScan(b2t4 t4_pkey)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
+)
+, c2 (c1) AS (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.c1 = b2t2.c1 AND b2t1.c1 = b2t3.c1 AND b2t1.c1 = b2t4.c1
+)
+SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
+, c1, c2
+ WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
+AND bmt1.c1 = c1.c1
+AND bmt1.c1 = c2.c1
+;
+
+----
+---- No. S-2-2 the number of the tables per quiry block
+----
+
+-- No. S-2-2-1
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = 1
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = 1
+)
+ FROM s1.t1 bmt1, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = 1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = 1
+)
+;
+/*+SeqScan(bmt1)
+TidScan(b1t1)
+BitmapScan(b2t1 t1_pkey)
+IndexScan(b3t1 t1_pkey)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = 1
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = 1
+)
+ FROM s1.t1 bmt1, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = 1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = 1
+)
+;
+
+-- No. S-2-2-2
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)'
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)'
+)
+;
+/*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)
+TidScan(b1t1)SeqScan(b1t2)
+BitmapScan(b2t1 t1_pkey)TidScan(b2t2)
+IndexScan(b3t1 t1_pkey)BitmapScan(b3t2 t2_pkey)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)'
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)'
+)
+;
+
+-- No. S-2-2-3
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+;
+/*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4)
+TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey)
+BitmapScan(b2t1 t1_pkey)TidScan(b2t2)SeqScan(b2t3)IndexScan(b2t4 t4_pkey)
+IndexScan(b3t1 t1_pkey)BitmapScan(b3t2 t2_pkey)TidScan(b3t3)SeqScan(b3t4)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
+)
+;
+
+-- No. S-2-2-4
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = 1
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)'
+)
+;
+/*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4)
+TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey)
+BitmapScan(b2t1 t1_pkey)
+IndexScan(b3t1 t1_pkey)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)'
+)
+SELECT max(bmt1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = 1
+)
+ FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)' AND bmt1.c1 = c1.c1
+AND bmt1.c1 <> (
+SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)'
+)
+;
+
+----
+---- No. S-2-3 RULE definition table
+----
+
+-- No. S-2-3-1
+EXPLAIN (COSTS false) UPDATE s1.r1 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+/*+TidScan(t1)SeqScan(t2)IndexScan(t3 t3_pkey)BitmapScan(t4 t4_pkey)
+SeqScan(r1)*/
+EXPLAIN (COSTS false) UPDATE s1.r1 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+EXPLAIN (COSTS false) UPDATE s1.r1_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+/*+TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey)
+SeqScan(r1_)*/
+EXPLAIN (COSTS false) UPDATE s1.r1_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+
+-- No. S-2-3-2
+EXPLAIN (COSTS false) UPDATE s1.r2 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+/*+TidScan(t1)SeqScan(t2)IndexScan(t3 t3_pkey)BitmapScan(t4 t4_pkey)
+SeqScan(r2)*/
+EXPLAIN (COSTS false) UPDATE s1.r2 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+EXPLAIN (COSTS false) UPDATE s1.r2_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+/*+TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey)
+BitmapScan(b2t1 t1_pkey)TidScan(b2t2)SeqScan(b2t3)IndexScan(b2t4 t4_pkey)
+SeqScan(r2_)*/
+EXPLAIN (COSTS false) UPDATE s1.r2_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+
+-- No. S-2-3-3
+EXPLAIN (COSTS false) UPDATE s1.r3 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+/*+TidScan(t1)SeqScan(t2)IndexScan(t3 t3_pkey)BitmapScan(t4 t4_pkey)
+SeqScan(r3)*/
+EXPLAIN (COSTS false) UPDATE s1.r3 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+EXPLAIN (COSTS false) UPDATE s1.r3_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+/*+TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey)
+BitmapScan(b2t1 t1_pkey)TidScan(b2t2)SeqScan(b2t3)IndexScan(b2t4 t4_pkey)
+IndexScan(b3t1 t1_pkey)BitmapScan(b3t2 t2_pkey)TidScan(b3t3)SeqScan(b3t4)
+SeqScan(r3_)*/
+EXPLAIN (COSTS false) UPDATE s1.r3_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
+
+----
+---- No. S-2-4 VALUES clause
+----
+
+-- No. S-2-4-1
+EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1')) AS t1 (c1) WHERE t1.c1 = 1;
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1')) AS t1 (c1) WHERE t1.c1 = 1;
+/*+SeqScan(*VALUES*)*/
+EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1')) AS t1 (c1) WHERE t1.c1 = 1;
+
+-- No. S-2-4-2
+EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1')) AS t1 (c1, c2, c3, c4), (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t2 (c1, c2) WHERE t1.c1 = t2.c1;
+/*+SeqScan(t1 t2)*/
+EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1')) AS t1 (c1, c2, c3, c4), (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t2 (c1, c2) WHERE t1.c1 = t2.c1;
+/*+SeqScan(*VALUES*)*/
+EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1')) AS t1 (c1, c2, c3, c4), (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t2 (c1, c2) WHERE t1.c1 = t2.c1;
+
+----
+---- No. S-3-1 scan method hint
+----
+
+-- No. S-3-1-1
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 >= 1;
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 >= 1;
+
+-- No. S-3-1-2
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. S-3-1-3
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+/*+IndexScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. S-3-1-4
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 >= 1;
+/*+IndexScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 >= 1;
+
+-- No. S-3-1-5
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c3 < 10;
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c3 < 10;
+
+-- No. S-3-1-6
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. S-3-1-7
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid = '(1,1)';
+/*+TidScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid = '(1,1)';
+
+-- No. S-3-1-8
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid IN ('(1,1)', '(2,2)', '(3,3)');
+/*+TidScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid IN ('(1,1)', '(2,2)', '(3,3)');
+
+-- No. S-3-1-9
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 >= 1;
+/*+NoSeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 >= 1;
+
+-- No. S-3-1-10
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+/*+NoSeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. S-3-1-11
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+/*+NoIndexScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. S-3-1-12
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 >= 1;
+/*+NoIndexScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 >= 1;
+
+-- No. S-3-1-13
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c3 < 10;
+/*+NoBitmapScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c3 < 10;
+
+-- No. S-3-1-14
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+/*+NoBitmapScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. S-3-1-15
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid = '(1,1)';
+/*+NoTidScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid = '(1,1)';
+
+-- No. S-3-1-16
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+/*+NoTidScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. S-3-1-17
+EXPLAIN (COSTS false) SELECT c1 FROM s1.t1 WHERE t1.c1 = 1;
+/*+IndexOnlyScan(t1)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. S-3-1-18
+EXPLAIN (COSTS false) SELECT c1 FROM s1.t1 WHERE t1.c1 >= 1;
+/*+IndexOnlyScan(t1)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.t1 WHERE t1.c1 >= 1;
+
+-- No. S-3-1-19
+EXPLAIN (COSTS false) SELECT c1 FROM s1.t1 WHERE t1.c1 = 1;
+/*+NoIndexOnlyScan(t1)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. S-3-1-20
+EXPLAIN (COSTS false) SELECT c1 FROM s1.t1 WHERE t1.c1 >= 1;
+/*+NoIndexOnlyScan(t1)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.t1 WHERE t1.c1 >= 1;
+
+----
+---- No. S-3-3 index name specified
+----
+
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE ti1.c2 = 1 AND ctid = '(1,1)';
+SET enable_tidscan TO off;
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE ti1.c2 = 1 AND ctid = '(1,1)';
+SET enable_indexscan TO off;
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE ti1.c2 = 1 AND ctid = '(1,1)';
+RESET enable_tidscan;
+RESET enable_indexscan;
+
+EXPLAIN (COSTS false) SELECT c2 FROM s1.ti1 WHERE ti1.c2 >= 1;
+
+-- No. S-3-3-1
+/*+IndexScan(ti1 ti1_i3)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE ti1.c2 = 1 AND ctid = '(1,1)';
+
+-- No. S-3-3-2
+/*+IndexScan(ti1 ti1_i3 ti1_i2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE ti1.c2 = 1 AND ctid = '(1,1)';
+
+-- No. S-3-3-3
+/*+IndexScan(ti1 ti1_i4 ti1_i3 ti1_i2 ti1_i1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE ti1.c2 = 1 AND ctid = '(1,1)';
+
+-- No. S-3-3-4
+/*+BitmapScan(ti1 ti1_i3)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE ti1.c2 = 1 AND ctid = '(1,1)';
+
+-- No. S-3-3-5
+/*+BitmapScan(ti1 ti1_i3 ti1_i2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE ti1.c2 = 1 AND ctid = '(1,1)';
+
+-- No. S-3-3-6
+/*+BitmapScan(ti1 ti1_i4 ti1_i3 ti1_i2 ti1_i1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE ti1.c2 = 1 AND ctid = '(1,1)';
+
+-- No. S-3-3-7
+/*+IndexOnlyScan(ti1 ti1_i3)*/
+EXPLAIN (COSTS false) SELECT c2 FROM s1.ti1 WHERE ti1.c2 >= 1;
+
+-- No. S-3-3-8
+/*+IndexOnlyScan(ti1 ti1_i3 ti1_i2)*/
+EXPLAIN (COSTS false) SELECT c2 FROM s1.ti1 WHERE ti1.c2 >= 1;
+
+-- No. S-3-3-9
+/*+IndexOnlyScan(ti1 ti1_i4 ti1_i3 ti1_i2 ti1_i1)*/
+EXPLAIN (COSTS false) SELECT c2 FROM s1.ti1 WHERE ti1.c2 >= 1;
+
+----
+---- No. S-3-4 index type
+----
+
+\d s1.ti1
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+
+-- No. S-3-4-1
+/*+IndexScan(ti1 ti1_btree)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+
+-- No. S-3-4-2
+/*+IndexScan(ti1 ti1_hash)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+
+-- No. S-3-4-3
+/*+IndexScan(ti1 ti1_gist)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+
+-- No. S-3-4-4
+/*+IndexScan(ti1 ti1_gin)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+
+-- No. S-3-4-5
+/*+IndexScan(ti1 ti1_expr)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+
+-- No. S-3-4-6
+/*+IndexScan(ti1 ti1_pred)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+
+-- No. S-3-4-7
+/*+IndexScan(ti1 ti1_uniq)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+
+-- No. S-3-4-8
+/*+IndexScan(ti1 ti1_multi)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+
+-- No. S-3-4-9
+/*+IndexScan(ti1 ti1_ts)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+
+-- No. S-3-4-10
+/*+IndexScan(ti1 ti1_pkey)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+
+-- No. S-3-4-11
+/*+IndexScan(ti1 ti1_c2_key)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+
+-- No. S-3-4-12
+/*+BitmapScan(ti1 ti1_btree)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+
+-- No. S-3-4-13
+/*+BitmapScan(ti1 ti1_hash)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+
+-- No. S-3-4-14
+/*+BitmapScan(ti1 ti1_gist)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+
+-- No. S-3-4-15
+/*+BitmapScan(ti1 ti1_gin)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+
+-- No. S-3-4-16
+/*+BitmapScan(ti1 ti1_expr)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+
+-- No. S-3-4-17
+/*+BitmapScan(ti1 ti1_pred)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+
+-- No. S-3-4-18
+/*+BitmapScan(ti1 ti1_uniq)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+
+-- No. S-3-4-19
+/*+BitmapScan(ti1 ti1_multi)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+
+-- No. S-3-4-20
+/*+BitmapScan(ti1 ti1_ts)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+
+-- No. S-3-4-10
+/*+BitmapScan(ti1 ti1_pkey)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+
+-- No. S-3-4-11
+/*+BitmapScan(ti1 ti1_c2_key)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
+
+-- No. S-3-4-23
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 >= 1;
+/*+IndexOnlyScan(ti1 ti1_btree)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 >= 1;
+
+-- No. S-3-4-24
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 = 1;
+/*+IndexOnlyScan(ti1 ti1_hash)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 = 1;
+
+-- No. S-3-4-25
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 < 1;
+/*+IndexOnlyScan(ti1 ti1_gist)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 < 1;
+
+-- No. S-3-4-26
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 = 1;
+/*+IndexOnlyScan(ti1 ti1_gin)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 = 1;
+
+-- No. S-3-4-27
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 < 100;
+/*+IndexOnlyScan(ti1 ti1_expr)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 < 100;
+
+-- No. S-3-4-28
+EXPLAIN (COSTS false) SELECT c4 FROM s1.ti1 WHERE lower(c4) >= '1';
+/*+IndexOnlyScan(ti1 ti1_pred)*/
+EXPLAIN (COSTS false) SELECT c4 FROM s1.ti1 WHERE lower(c4) >= '1';
+
+-- No. S-3-4-29
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 >= 1;
+/*+IndexOnlyScan(ti1 ti1_uniq)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 >= 1;
+
+-- No. S-3-4-30
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 >= 1;
+/*+IndexOnlyScan(ti1 ti1_multi)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 >= 1;
+
+-- No. S-3-4-31
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE to_tsvector('english', c4) @@ 'a & b';
+/*+IndexOnlyScan(ti1 ti1_ts)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE to_tsvector('english', c4) @@ 'a & b';
+
+-- No. S-3-4-32
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 >= 1;
+/*+IndexOnlyScan(ti1 ti1_pkey)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 >= 1;
+
+-- No. S-3-4-33
+EXPLAIN (COSTS false) SELECT c2 FROM s1.ti1 WHERE c2 >= 1;
+/*+IndexOnlyScan(ti1 ti1_c2_key)*/
+EXPLAIN (COSTS false) SELECT c2 FROM s1.ti1 WHERE c2 >= 1;
+
+----
+---- No. S-3-5 not used index
+----
+
+-- No. S-3-5-1
+/*+IndexScan(ti1 ti1_pred)*/
+EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100;
+
+-- No. S-3-5-2
+/*+BitmapScan(ti1 ti1_pred)*/
+EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100;
+
+-- No. S-3-5-3
+/*+IndexOnlyScan(ti1 ti1_pred)*/
+EXPLAIN (COSTS true) SELECT c1 FROM s1.ti1 WHERE c1 = 100;
+
+----
+---- No. S-3-6 not exist index
+----
+
+-- No. S-3-6-1
+/*+IndexScan(ti1 not_exist)*/
+EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100;
+
+-- No. S-3-6-2
+/*+BitmapScan(ti1 not_exist)*/
+EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100;
+
+-- No. S-3-6-3
+/*+IndexOnlyScan(ti1 not_exist)*/
+EXPLAIN (COSTS true) SELECT c1 FROM s1.ti1 WHERE c1 = 100;
+
+----
+---- No. S-3-7 query structure
+----
+
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1 AND t1.ctid = '(1,1)';
+
+-- No. S-3-7-1
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE c1 = 100;
+
+-- No. S-3-7-2
+/*+SeqScan(t1)BitmapScan(t2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1 AND t1.ctid = '(1,1)';
+
+-- No. S-3-7-3
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1 AND t1.ctid = '(1,1)';
+
+----
+---- No. S-3-8 query structure
+----
+
+-- No. S-3-8-1
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1 WHERE b1t1.c1 = 1)
+SELECT max(b3t1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.c1 = 1
+ ) FROM s1.t1 b3t1 WHERE b3t1.c1 = (
+SELECT max(b4t1.c1) FROM s1.t1 b4t1 WHERE b4t1.c1 = 1);
+/*+SeqScan(b1t1)IndexScan(b2t1 t1_pkey)BitmapScan(b3t1 t1_pkey)TidScan(b4t1)
+*/
+EXPLAIN (COSTS false)
+WITH c1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1 WHERE b1t1.c1 = 1)
+SELECT max(b3t1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.c1 = 1
+ ) FROM s1.t1 b3t1 WHERE b3t1.c1 = (
+SELECT max(b4t1.c1) FROM s1.t1 b4t1 WHERE b4t1.c1 = 1);
+
+-- No. S-3-8-2
+EXPLAIN (COSTS false)
+WITH cte1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1 JOIN s1.t2 b1t2 ON(b1t1.c1 = b1t2.c1) WHERE b1t1.c1 = 1)
+SELECT max(b3t1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 JOIN s1.t2 b2t2 ON(b2t1.c1 = b2t2.c1) WHERE b2t1.c1 = 1
+ ) FROM s1.t1 b3t1 JOIN s1.t2 b3t2 ON(b3t1.c1 = b3t2.c1) JOIN cte1 ON(b3t1.c1 = cte1.c1) WHERE b3t1.c1 = (
+SELECT max(b4t1.c1) FROM s1.t1 b4t1 JOIN s1.t2 b4t2 ON(b4t1.c1 = b4t2.c1) WHERE b4t1.c1 = 1);
+/*+SeqScan(b1t1)IndexScan(b2t1 t1_pkey)BitmapScan(b3t1 t1_pkey)TidScan(b4t1)
+TidScan(b1t2)SeqScan(b2t2)IndexScan(b3t2 t2_pkey)BitmapScan(b4t2 t2_pkey)
+*/
+EXPLAIN (COSTS false)
+WITH cte1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1 JOIN s1.t2 b1t2 ON(b1t1.c1 = b1t2.c1) WHERE b1t1.c1 = 1)
+SELECT max(b3t1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 JOIN s1.t2 b2t2 ON(b2t1.c1 = b2t2.c1) WHERE b2t1.c1 = 1
+ ) FROM s1.t1 b3t1 JOIN s1.t2 b3t2 ON(b3t1.c1 = b3t2.c1) JOIN cte1 ON(b3t1.c1 = cte1.c1) WHERE b3t1.c1 = (
+SELECT max(b4t1.c1) FROM s1.t1 b4t1 JOIN s1.t2 b4t2 ON(b4t1.c1 = b4t2.c1) WHERE b4t1.c1 = 1);
+
+-- No. S-3-8-3
+EXPLAIN (COSTS false)
+WITH cte1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1 JOIN s1.t2 b1t2 ON(b1t1.c1 = b1t2.c1) WHERE b1t1.c1 = 1)
+SELECT max(b3t1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.c1 = 1
+ ) FROM s1.t1 b3t1 JOIN s1.t2 b3t2 ON(b3t1.c1 = b3t2.c1) JOIN cte1 ON(b3t1.c1 = cte1.c1) WHERE b3t1.c1 = (
+SELECT max(b4t1.c1) FROM s1.t1 b4t1 WHERE b4t1.c1 = 1);
+/*+SeqScan(b1t1)IndexScan(b2t1 t1_pkey)BitmapScan(b3t1 t1_pkey)TidScan(b4t1)
+TidScan(b1t2)IndexScan(b3t2 t2_pkey)
+*/
+EXPLAIN (COSTS false)
+WITH cte1 (c1) AS (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1 JOIN s1.t2 b1t2 ON(b1t1.c1 = b1t2.c1) WHERE b1t1.c1 = 1)
+SELECT max(b3t1.c1), (
+SELECT max(b2t1.c1) FROM s1.t1 b2t1 WHERE b2t1.c1 = 1
+ ) FROM s1.t1 b3t1 JOIN s1.t2 b3t2 ON(b3t1.c1 = b3t2.c1) JOIN cte1 ON(b3t1.c1 = cte1.c1) WHERE b3t1.c1 = (
+SELECT max(b4t1.c1) FROM s1.t1 b4t1 WHERE b4t1.c1 = 1);
+
+----
+---- No. S-3-9 inheritance table select type
+----
+
+-- No. S-3-9-1
+EXPLAIN (COSTS false) SELECT * FROM ONLY s1.p1 WHERE c1 = 1;
+/*+IndexScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM ONLY s1.p1 WHERE c1 = 1;
+
+-- No. S-3-9-2
+EXPLAIN (COSTS false) SELECT * FROM s1.p1 WHERE c1 = 1;
+/*+IndexScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.p1 WHERE c1 = 1;
+
+----
+---- No. S-3-10 inheritance table number
+----
+
+-- No. S-3-10-1
+EXPLAIN (COSTS false) SELECT * FROM s1.p1 WHERE c1 = 1;
+/*+IndexScan(p1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.p1 WHERE c1 = 1;
+
+-- No. S-3-10-2
+EXPLAIN (COSTS false) SELECT * FROM s1.p2 WHERE c1 = 1;
+/*+IndexScan(p2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.p2 WHERE c1 = 1;
+
+----
+---- No. S-3-11 inheritance table specified table
+----
+
+EXPLAIN (COSTS false) SELECT * FROM s1.p2 WHERE c1 = 1;
+
+-- No. S-3-11-1
+/*+IndexScan(p2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.p2 WHERE c1 = 1;
+
+-- No. S-3-11-2
+/*+IndexScan(p2c1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.p2 WHERE c1 = 1;
+
+-- No. S-3-11-3
+/*+IndexScan(p2 p2_pkey p2c1_pkey p2c1c1_pkey)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.p2 WHERE c1 = 1;
+
+-- No. S-3-11-4
+/*+IndexScan(p2 p2c1_pkey)*/
+EXPLAIN (COSTS true) SELECT * FROM s1.p2 WHERE c1 = 1;
+
+----
+---- No. S-3-12 specified same table
+----
+
+-- No. S-3-12-1
+/*+IndexScan(ti1) BitmapScan(ti1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+
+-- No. S-3-12-2
+/*+IndexScan(ti1 ti1_pkey) BitmapScan(ti1 ti1_btree)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+
+-- No. S-3-12-3
+/*+BitmapScan(ti1) IndexScan(ti1) BitmapScan(ti1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+
+-- No. S-3-12-4
+/*+BitmapScan(ti1 ti1_hash) IndexScan(ti1 ti1_pkey) BitmapScan(ti1 ti1_btree)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+
+----
+---- No. S-3-13 message output
+----
+
+-- No. S-3-13-1
+/*+SeqScan(ti1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+
+-- No. S-3-13-2
+/*+SeqScan(ti1 ti1_pkey)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+
+-- No. S-3-13-3
+/*+SeqScan(ti1 ti1_pkey ti1_btree)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+
+-- No. S-3-13-4
+/*+IndexScan(ti1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+
+-- No. S-3-13-5
+/*+IndexScan(ti1 ti1_pkey)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+
+-- No. S-3-13-6
+/*+IndexScan(ti1 ti1_pkey ti1_btree)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+
+-- No. S-3-13-7
+/*+BitmapScan(ti1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+
+-- No. S-3-13-8
+/*+BitmapScan(ti1 ti1_pkey)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+
+-- No. S-3-13-9
+/*+BitmapScan(ti1 ti1_pkey ti1_btree)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+
+-- No. S-3-13-10
+/*+TidScan(ti1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+
+-- No. S-3-13-11
+/*+TidScan(ti1 ti1_pkey)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+
+-- No. S-3-13-12
+/*+TidScan(ti1 ti1_pkey ti1_btree)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+
+-- No. S-3-13-13
+/*+NoSeqScan(ti1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+
+-- No. S-3-13-14
+/*+NoSeqScan(ti1 ti1_pkey)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+
+-- No. S-3-13-15
+/*+NoSeqScan(ti1 ti1_pkey ti1_btree)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+
+-- No. S-3-13-16
+/*+NoIndexScan(ti1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+
+-- No. S-3-13-17
+/*+NoIndexScan(ti1 ti1_pkey)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+
+-- No. S-3-13-18
+/*+NoIndexScan(ti1 ti1_pkey ti1_btree)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+
+-- No. S-3-13-19
+/*+NoBitmapScan(ti1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+
+-- No. S-3-13-20
+/*+NoBitmapScan(ti1 ti1_pkey)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+
+-- No. S-3-13-21
+/*+NoBitmapScan(ti1 ti1_pkey ti1_btree)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+
+-- No. S-3-13-22
+/*+NoTidScan(ti1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+
+-- No. S-3-13-23
+/*+NoTidScan(ti1 ti1_pkey)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+
+-- No. S-3-13-24
+/*+NoTidScan(ti1 ti1_pkey ti1_btree)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 = 1 AND ctid = '(1,1)';
+
+-- No. S-3-13-25
+/*+IndexOnlyScan(ti1)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 >= 1;
+
+-- No. S-3-13-26
+/*+IndexOnlyScan(ti1 ti1_pkey)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 >= 1;
+
+-- No. S-3-13-27
+/*+IndexOnlyScan(ti1 ti1_pkey ti1_btree)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 >= 1;
+
+-- No. S-3-13-28
+/*+NoIndexOnlyScan(ti1)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 = 1;
+
+-- No. S-3-13-29
+/*+NoIndexOnlyScan(ti1 ti1_pkey)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 = 1;
+
+-- No. S-3-13-30
+/*+NoIndexOnlyScan(ti1 ti1_pkey ti1_btree)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 = 1;
--- /dev/null
+DROP ROLE IF EXISTS super_user;
+DROP ROLE IF EXISTS normal_user;
--- /dev/null
+SET search_path TO public;
+
+CREATE EXTENSION pg_stat_statements;
+CREATE EXTENSION btree_gist;
+CREATE EXTENSION btree_gin;
+
+CREATE ROLE super_user
+ SUPERUSER
+ NOCREATEDB
+ NOCREATEROLE
+ NOINHERIT
+ NOLOGIN
+ NOREPLICATION
+ CONNECTION LIMIT 1;
+CREATE ROLE normal_user
+ NOSUPERUSER
+ NOCREATEDB
+ NOCREATEROLE
+ NOINHERIT
+ NOLOGIN
+ NOREPLICATION
+ CONNECTION LIMIT 1;
+
+CREATE SCHEMA s1;
+CREATE SCHEMA s2;
+
+CREATE TABLE s1.t1 (c1 int, c2 int, c3 int, c4 text, PRIMARY KEY (c1));
+CREATE TABLE s1.t2 (LIKE s1.t1 INCLUDING ALL);
+CREATE TABLE s1.t3 (LIKE s1.t1 INCLUDING ALL);
+CREATE TABLE s1.t4 (LIKE s1.t1 INCLUDING ALL);
+CREATE TABLE s2.t1 (LIKE s1.t1 INCLUDING ALL);
+CREATE TABLE s1.p1 (LIKE s1.t1 INCLUDING ALL);
+CREATE TABLE s1.p2 (LIKE s1.t1 INCLUDING ALL);
+CREATE TABLE s1.p1c1 (LIKE s1.p1 INCLUDING ALL, CHECK (c1 <= 100)) INHERITS(s1.p1);
+CREATE TABLE s1.p1c2 (LIKE s1.p1 INCLUDING ALL, CHECK (c1 > 100 AND c1 <= 200)) INHERITS(s1.p1);
+CREATE TABLE s1.p1c3 (LIKE s1.p1 INCLUDING ALL, CHECK (c1 > 200)) INHERITS(s1.p1);
+CREATE TABLE s1.p2c1 (LIKE s1.p2 INCLUDING ALL, CHECK (c1 <= 100)) INHERITS(s1.p2);
+CREATE TABLE s1.p2c2 (LIKE s1.p2 INCLUDING ALL, CHECK (c1 > 100 AND c1 <= 200)) INHERITS(s1.p2);
+CREATE TABLE s1.p2c3 (LIKE s1.p2 INCLUDING ALL, CHECK (c1 > 200)) INHERITS(s1.p2);
+CREATE TABLE s1.p2c1c1 (LIKE s1.p2c1 INCLUDING ALL, CHECK (c1 <= 50)) INHERITS(s1.p2c1);
+CREATE TABLE s1.p2c1c2 (LIKE s1.p2c1 INCLUDING ALL, CHECK (c1 > 50 AND c1 <= 100)) INHERITS(s1.p2c1);
+CREATE TABLE s1.p2c2c1 (LIKE s1.p2c2 INCLUDING ALL, CHECK (c1 > 100 AND c1 <= 150)) INHERITS(s1.p2c2);
+CREATE TABLE s1.p2c2c2 (LIKE s1.p2c2 INCLUDING ALL, CHECK (c1 > 150 AND c1 <= 200)) INHERITS(s1.p2c2);
+CREATE TABLE s1.p2c3c1 (LIKE s1.p2c3 INCLUDING ALL, CHECK (c1 > 200 AND c1 <= 250)) INHERITS(s1.p2c3);
+CREATE TABLE s1.p2c3c2 (LIKE s1.p2c3 INCLUDING ALL, CHECK (c1 > 250)) INHERITS(s1.p2c3);
+CREATE TABLE s1.r1 (LIKE s1.t1);
+CREATE TABLE s1.r2 (LIKE s1.t1);
+CREATE TABLE s1.r3 (LIKE s1.t1);
+CREATE TABLE s1.r4 (LIKE s1.t1);
+CREATE TABLE s1.r5 (LIKE s1.t1);
+CREATE TABLE s1.r1_ (LIKE s1.t1);
+CREATE TABLE s1.r2_ (LIKE s1.t1);
+CREATE TABLE s1.r3_ (LIKE s1.t1);
+CREATE TABLE s1.ti1 (c1 int, c2 int, c3 int, c4 text, PRIMARY KEY (c1), UNIQUE (c2));
+CREATE UNLOGGED TABLE s1.ul1 (LIKE s1.t1 INCLUDING ALL);
+
+INSERT INTO s1.t1 SELECT i, i, i % 100, i FROM (SELECT generate_series(1, 1000) i) t;
+INSERT INTO s1.t2 SELECT i, i, i % 10, i FROM (SELECT generate_series(1, 100) i) t;
+INSERT INTO s2.t1 SELECT i, i, i % 10, i FROM (SELECT generate_series(1, 100) i) t;
+INSERT INTO s1.p1c1 SELECT i, i, i % 10, i FROM (SELECT generate_series(1, 100) i) t;
+INSERT INTO s1.p1c2 SELECT i, i, i % 10, i FROM (SELECT generate_series(101, 200) i) t;
+INSERT INTO s1.p1c3 SELECT i, i, i % 10, i FROM (SELECT generate_series(201, 300) i) t;
+INSERT INTO s1.p2c1c1 SELECT i, i, i % 10, i FROM (SELECT generate_series(1, 50) i) t;
+INSERT INTO s1.p2c1c2 SELECT i, i, i % 10, i FROM (SELECT generate_series(51, 100) i) t;
+INSERT INTO s1.p2c2c1 SELECT i, i, i % 10, i FROM (SELECT generate_series(101, 150) i) t;
+INSERT INTO s1.p2c2c2 SELECT i, i, i % 10, i FROM (SELECT generate_series(151, 200) i) t;
+INSERT INTO s1.p2c3c1 SELECT i, i, i % 10, i FROM (SELECT generate_series(201, 250) i) t;
+INSERT INTO s1.p2c3c2 SELECT i, i, i % 10, i FROM (SELECT generate_series(251, 300) i) t;
+INSERT INTO s1.ti1 SELECT i, i, i % 100, i FROM (SELECT generate_series(1, 1000) i) t;
+
+
+CREATE INDEX t1_i ON s1.t1 (c3);
+CREATE INDEX t1_i1 ON s1.t1 (c1);
+CREATE INDEX t2_i1 ON s1.t2 (c1);
+CREATE INDEX t3_i1 ON s1.t3 (c1);
+CREATE INDEX t4_i1 ON s1.t4 (c1);
+CREATE INDEX p1_i ON s1.p1 (c1);
+CREATE INDEX p2_i ON s1.p2 (c1);
+CREATE INDEX p1c1_i ON s1.p1c1 (c1);
+CREATE INDEX p1c2_i ON s1.p1c2 (c1);
+CREATE INDEX p1c3_i ON s1.p1c3 (c1);
+CREATE INDEX p2c1_i ON s1.p2c1 (c1);
+CREATE INDEX p2c2_i ON s1.p2c2 (c1);
+CREATE INDEX p2c3_i ON s1.p2c3 (c1);
+CREATE INDEX p2c1c1_i ON s1.p2c1c1 (c1);
+CREATE INDEX p2c1c2_i ON s1.p2c1c2 (c1);
+CREATE INDEX p2c2c1_i ON s1.p2c2c1 (c1);
+CREATE INDEX p2c2c2_i ON s1.p2c2c2 (c1);
+CREATE INDEX p2c3c1_i ON s1.p2c3c1 (c1);
+CREATE INDEX p2c3c2_i ON s1.p2c3c2 (c1);
+CREATE INDEX ti1_i1 ON s1.ti1 (c2);
+CREATE INDEX ti1_i2 ON s1.ti1 (c2, c4);
+CREATE INDEX ti1_i3 ON s1.ti1 (c2, c4, c4);
+CREATE INDEX ti1_i4 ON s1.ti1 (c2, c4, c4, c4);
+CREATE INDEX ti1_btree ON s1.ti1 USING btree (c1);
+CREATE INDEX ti1_hash ON s1.ti1 USING hash (c1);
+CREATE INDEX ti1_gist ON s1.ti1 USING gist (c1);
+CREATE INDEX ti1_gin ON s1.ti1 USING gin (c1);
+CREATE INDEX ti1_expr ON s1.ti1 ((c1 < 100));
+CREATE INDEX ti1_pred ON s1.ti1 (lower(c4));
+CREATE UNIQUE INDEX ti1_uniq ON s1.ti1 (c1);
+CREATE INDEX ti1_multi ON s1.ti1 (c1, c2, c3, c4);
+CREATE INDEX ti1_ts ON s1.ti1 USING gin(to_tsvector('english', c4));
+
+CREATE VIEW s1.v1 AS SELECT v1t1.c1, v1t1.c2, v1t1.c3, v1t1.c4 FROM s1.t1 v1t1;
+CREATE VIEW s1.v1_ AS SELECT v1t1_.c1, v1t1_.c2, v1t1_.c3, v1t1_.c4 FROM s1.t1 v1t1_;
+CREATE VIEW s1.v2 AS SELECT v2t1.c1, v2t1.c2, v2t1.c3, v2t1.c4 FROM s1.t1 v2t1 JOIN s1.t2 v2t2 ON(v2t1.c1 = v2t2.c1);
+CREATE VIEW s1.v3 AS SELECT v3t1.c1, v3t1.c2, v3t1.c3, v3t1.c4 FROM s1.t1 v3t1 JOIN s1.t2 v3t2 ON(v3t1.c1 = v3t2.c1) JOIN s1.t3 v3t3 ON(v3t1.c1 = v3t3.c1);
+
+ANALYZE s1.t1;
+ANALYZE s1.t2;
+ANALYZE s2.t1;
+ANALYZE s1.p1;
+ANALYZE s1.p2;
+ANALYZE s1.p1c1;
+ANALYZE s1.p1c2;
+ANALYZE s1.p1c3;
+ANALYZE s1.p2c1c1;
+ANALYZE s1.p2c1c2;
+ANALYZE s1.p2c2c1;
+ANALYZE s1.p2c2c2;
+ANALYZE s1.p2c3c1;
+ANALYZE s1.p2c3c2;
+ANALYZE s1.ti1;
+
+CREATE FUNCTION s1.f1 () RETURNS s1.t1 AS $$
+VALUES(1,1,1,'1'), (2,2,2,'2'), (3,3,3,'3')
+$$ LANGUAGE sql;
+
+CREATE RULE r1 AS ON UPDATE TO s1.r1 DO INSTEAD (
+SELECT max(t1.c1) FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.ctid = '(1,1)' AND t1.c1 = t2.c1 AND t2.ctid = '(1,1)' AND t1.c1 = t3.c1 AND t3.ctid = '(1,1)' AND t1.c1 = t4.c1 AND t4.ctid = '(1,1)';
+);
+CREATE RULE r2 AS ON UPDATE TO s1.r2 DO INSTEAD (
+SELECT max(t1.c1) FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.ctid = '(1,1)' AND t1.c1 = t2.c1 AND t2.ctid = '(1,1)' AND t1.c1 = t3.c1 AND t3.ctid = '(1,1)' AND t1.c1 = t4.c1 AND t4.ctid = '(1,1)';
+SELECT max(t1.c1) FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.ctid = '(1,1)' AND t1.c1 = t2.c1 AND t2.ctid = '(1,1)' AND t1.c1 = t3.c1 AND t3.ctid = '(1,1)' AND t1.c1 = t4.c1 AND t4.ctid = '(1,1)';
+);
+CREATE RULE r3 AS ON UPDATE TO s1.r3 DO INSTEAD (
+SELECT max(t1.c1) FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.ctid = '(1,1)' AND t1.c1 = t2.c1 AND t2.ctid = '(1,1)' AND t1.c1 = t3.c1 AND t3.ctid = '(1,1)' AND t1.c1 = t4.c1 AND t4.ctid = '(1,1)';
+SELECT max(t1.c1) FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.ctid = '(1,1)' AND t1.c1 = t2.c1 AND t2.ctid = '(1,1)' AND t1.c1 = t3.c1 AND t3.ctid = '(1,1)' AND t1.c1 = t4.c1 AND t4.ctid = '(1,1)';
+SELECT max(t1.c1) FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.ctid = '(1,1)' AND t1.c1 = t2.c1 AND t2.ctid = '(1,1)' AND t1.c1 = t3.c1 AND t3.ctid = '(1,1)' AND t1.c1 = t4.c1 AND t4.ctid = '(1,1)';
+);
+CREATE RULE r1_ AS ON UPDATE TO s1.r1_ DO INSTEAD (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)';
+);
+CREATE RULE r2_ AS ON UPDATE TO s1.r2_ DO INSTEAD (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)';
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)';
+);
+CREATE RULE r3_ AS ON UPDATE TO s1.r3_ DO INSTEAD (
+SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.ctid = '(1,1)' AND b1t1.c1 = b1t2.c1 AND b1t2.ctid = '(1,1)' AND b1t1.c1 = b1t3.c1 AND b1t3.ctid = '(1,1)' AND b1t1.c1 = b1t4.c1 AND b1t4.ctid = '(1,1)';
+SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)';
+SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)';
+);
+CREATE RULE "_RETURN" AS ON SELECT TO s1.r4 DO INSTEAD SELECT r4t1.c1, r4t1.c2, r4t1.c3, r4t1.c4 FROM s1.t1 r4t1;
+CREATE RULE "_RETURN" AS ON SELECT TO s1.r5 DO INSTEAD SELECT r5t1.c1, r5t1.c2, r5t1.c3, r5t1.c4 FROM s1.t1 r5t1;