1. 14 3月, 2019 1 次提交
  2. 15 8月, 2018 1 次提交
    • J
      Faithfully parse inheritance-recursion for external tables · 2371cb3b
      Jesse Zhang 提交于
      When SQL standard table inheritance was added in upstream (by commit
      2fb6cc90 in Postgres 7.1), mentioning a table in the FROM clause of a
      query would necessarily mean traversing through the inheritance
      hierarchy. The need to distinguish between the (legacy, less common, but
      legitimate nonetheless) intent of not recursing into child tables gave
      rise to two things: the guc `sql_inheritance` which toggles the default
      semantics of parent tables, and the `ONLY` keyword used in front of
      parent table names to explicitly skip descendant tables.
      
      ORCA doesn't like queries that skip descendant tables: it falls back to
      the legacy planner as soon as it detects that intent.
      
      Way way back in Greenplum-land, when external tables were given a
      separate designation in relstorage (RELSTORAGE_EXTERNAL), we seemed to
      have added code in parser (parse analysis) so that queries on external
      tables *never* recurse into their child tables, regardless of what the
      user specifies -- either via `ONLY` or `*` in the query, or via guc
      `sql_inheritance`. Technically, that process scrubs the range table
      entries to hard-code "do not recurse".
      
      The combination of those two things -- hard coding "do not recurse" in
      the RTE for the analyzed parse tree and ORCA detecting intent of `ONLY`
      through RTE -- led ORCA to *always* fall back to planner when an
      external table is mentioned in the FROM clause. commit 013a6e9d tried
      fixing this by *detecting harder* whether there's an external table.
      
      The behavior of the parse-analyzer hard coding a "do not recurse" in the
      RTE for an external table seems wrong for several reasons:
      
        1. It seems unnecessarily defensive
      
        2. It doesn't seem to belong in the parser.
      
           a. While changing "recurse" back to "do not recurse" abounds, all
           other occurrences happen in the planner as an optimization for
           childless tables.
      
           b. It deprives an optimizer of the actual intent expressed by the
           user: because of this hardcoding, neither ORCA nor planner would
           have a way of knowing whether the user specified `ONLY` in the
           query.
      
           c. It deprives the user of the ability to use child tables with an
           external table, either deliberately or coincidentally.
      
           d. A corollary is that any old views created as `SELECT a,b FROM
           ext_table` will be perpetuated as `SELECT a,b FROM ONLY ext_table`.
      
      This commit removes this defensive setting in the parse analyzer. As a
      consequence, we're able to reinstate the simpler RTE check before commit
      013a6e9d. Queries and new views will include child tables as expected.
      2371cb3b
  3. 07 8月, 2018 1 次提交
    • B
      ORCA should not fallback for external tables · 013a6e9d
      Bhuvnesh Chaudhary 提交于
      The commit a3f7f4d7 introduced a fall back if the query contained ONLY
      in the FROM clause for relations. However, it should exclude external
      tables. For external tables RangeTblEntry::inh is set to false always,
      so the commit causes ORCA to fall back for all external table queries.
      
      This commit fixes the issue by excluding external tables from the check
      of ONLY clause in CTranslatorQueryToDXL::PdxlnFromRelation(), and adds
      relevant test cases.
      013a6e9d
  4. 23 7月, 2018 1 次提交
    • Z
      Enable update on distribution column in legacy planner. · 6be0a32a
      Zhenghua Lyu 提交于
      Before, we cannot update distribution column in legacy planner, because the OLD tuple
      and NEW tuple maybe belong to different segments. We enable this by borrowing ORCA's
      logic, namely, split each update operation into delete and insert. The delete operation is hashed
      by OLD tuple attributes, and insert operation is hashed by NEW tuple attributes. This change
      includes following items:
      * We need push missed OLD attributes to sub plan tree so that that attribute could be passed to top Motion.
      * In addition, if the result relation has oids, we also need to put oid in the targetlist.
      * If result relation is partitioned, we should special treat it because resultRelations is partition tables instead of root table, but that is true for normal Insert.
      * Special treats for update triggers, because trigger cannot be executed across segments.
      * Special treatment in nodeModifyTable, so that it can process Insert/Delete for update purpose.
      * Proper initialization of SplitUpdate.
      
      There are still TODOs:
      * We don't handle cost gracefully, because we add SplitUpdate node after plan generated. Already added a FIXME for this
      * For deletion, we could optimize in just sending distribution columns instead of all columns
      
      
      Author: Xiaoran Wang <xiwang@pivotal.io>
      Author: Max Yang <myang@pivotal.io>
      Author: Shujie Zhang <shzhang@pivotal.io>
      Author: Zhenghua Lyu <zlv@pivotal.io>
      6be0a32a
  5. 23 3月, 2018 1 次提交
  6. 15 5月, 2017 1 次提交
    • V
      Streamline Orca Gucs · 9f2c838b
      Venkatesh Raghavan 提交于
      * Enable analyzing root partitions
      * Ensure that the name of the guc is clear
      * Remove double negation (where possible)
      * Update comments
      * Co-locate gucs that have similar purpose
      * Remove dead gucs
      * Classify them correctly so that they are no longer hidden
      9f2c838b
  7. 02 3月, 2017 1 次提交