You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (JIRA)" <ji...@apache.org> on 2017/07/06 17:48:00 UTC

[jira] [Commented] (CALCITE-482) Implement sql and planner hints

    [ https://issues.apache.org/jira/browse/CALCITE-482?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16076970#comment-16076970 ] 

Julian Hyde commented on CALCITE-482:
-------------------------------------

The full feature would require:
# extension to the parser to read hints,
# a way of annotating RelNodes with hints,
# changes to SqlToRelConverter propagate hints from the parse tree to the RelNode tree.

For 2, we could add a new "hints" metadata type:

{code}
public class RelMetadataQuery {
  ...

  public Map<String, Object> hints(RelNode rel);
}

public class BuiltInMetadata {
  ...

  public interface Hints extends Metadata {
    Map<String, Object> getHints();

    interface Handler extends MetadataHandler<Hints> {
      Map<String, Object> getHints(RelNode r, RelMetadataQuery mq);
    }
  }

public class RelMdHints implements MetadataHandler<BuiltInMetadata.Hints> {
   ...
}
{code}

The metadata mechanism is very good at caching and propagation, and allows pluggable providers. Making this metadata would allow people to control how hints are propagated as RelNodes are transformed by rules into other RelNodes, and whether hints are inherited from a RelNode's inputs.

> Implement sql and planner hints
> -------------------------------
>
>                 Key: CALCITE-482
>                 URL: https://issues.apache.org/jira/browse/CALCITE-482
>             Project: Calcite
>          Issue Type: Bug
>    Affects Versions: 1.0.0-incubating
>            Reporter: Vladimir Sitnikov
>            Assignee: Julian Hyde
>
> Query optimizer can never be perfect, so it makes sense to implement hints to allow user better control the execution.
> For instance: "never merge this subquery with others" (`/+ no_merge/`), "treat those tables as leading ones" (`/*+ leading */`), etc.
> Hints would enable predictable performance and the planning time would be improved as well.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)