Details
-
Task
-
Status: Stalled (View Workflow)
-
Major
-
Resolution: Unresolved
Description
MDEV-19556 adds engine-native record sampling. It also adds code that uses sampling for its primary purpose, that is, to collect histograms.
However, it is fairly difficult to do testing. Looking at the collected histogram, it is hard to tell whether the sampling code has provided each record the same chance of being in the output, etc.
This MDEV is about adding the basic TABLESAMPLE syntax support which allows one to examine the sampled rows directly.
The SQL syntax for TABLESAMPLE feature:
<table factor> ::=
|
<table primary> [ <sample clause> ]
|
|
<sample clause> ::=
|
TABLESAMPLE <sample method> <left paren> <sample percentage> <right paren>
|
[ <repeatable clause> ]
|
|
|
<sample method> ::=
|
BERNOULLI
|
| SYSTEM
|
|
<repeatable clause> ::=
|
REPEATABLE <left paren> <repeat argument> <right paren>
|
|
<sample percentage> ::=
|
<numeric value expression>
|
|
<repeat argument> ::=
|
<numeric value expression>
|
TABLESAMPLE is a reserved word.
We allow only this syntax:
TABLESAMPLE SYSTEM ( number )
|
We allow it only for SELECTs (not for DML).
The optimizer will not use any indexes for the table that uses TABLESAMPLE syntax.
It will also ignore the fact that sampling the table produces fewer rows.
Attachments
Issue Links
- relates to
-
MDEV-19556 Support native storage engine sampling of rows
- Open