Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-38992

SQL Standard TABLESAMPLE clause

    XMLWordPrintable

Details

    • New Feature
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • None
    • None

    Description

      The syntax is

      <table factor> ::= <table primary> [ <sample clause> ]
      <sample clause> ::= TABLESAMPLE <sample method> <left paren> <sample percentage> <right paren>
      <sample method> ::= BERNOULLI | SYSTEM
      <sample percentage> ::= <numeric value expression>
      

      The goal is

      • support BERNOULLI
        • internally it'll just be a full rnd_next() table scan
      • support SYSTEM
        • this will either fall back to Bernoulli if the percentage is too high
        • or use a new interface, say, handler::ha_get_random_row() which will use a random dive into a b-tre, which in MyISAM/Aria will use a "reverse records_in_range" approach. Which is skewed, but so is records_in_range(). Fixing both is beyond the scope of this task.

      Implementation order

      1. syntax, only with SYSTEM
      2. handler interface and storage engine implementation for random dives
      3. Bernoulli

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              serg Sergei Golubchik
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.