*** DRAFT ***

SQLite Requirement Matrix Details
vtab_distinct.html

Index Summary Markup Original


R-59232-02458-58153-59038-51694-12074-46147-53254 tcl slt th3 src

The sqlite3_vtab_distinct() interface returns an integer between 0 and 3.

/* IMP: R-59232-02458 */
# EVIDENCE-OF: R-59232-02458 The sqlite3_vtab_distinct() interface
# returns an integer between 0 and 3.

R-57761-09663-49557-09878-08377-44196-15212-54456 tcl slt th3 src

If the sqlite3_vtab_distinct() interface returns 0, that means that the query planner needs the virtual table to return all rows in the sort order defined by the "nOrderBy" and "aOrderBy" fields of the sqlite3_index_info object.

/* IMP: R-57761-09663 */
# EVIDENCE-OF: R-57761-09663 If the sqlite3_vtab_distinct() interface
# returns 0, that means that the query planner needs the virtual table
# to return all rows in the sort order defined by the "nOrderBy" and
# "aOrderBy" fields of the sqlite3_index_info object.

R-08010-38213-31343-08677-03914-40178-13530-16840 tcl slt th3 src

If the sqlite3_vtab_distinct() interface returns 1, that means that the query planner does not need the rows to be returned in sorted order as long as all rows with the same values in all columns identified by the "aOrderBy" field are adjacent.

/* IMP: R-08010-38213 */
# EVIDENCE-OF: R-08010-38213 If the sqlite3_vtab_distinct() interface
# returns 1, that means that the query planner does not need the rows to
# be returned in sorted order as long as all rows with the same values
# in all columns identified by the "aOrderBy" field are adjacent.

R-08996-44767-00372-61996-62124-13130-39944-08458 tcl slt th3 src

If the sqlite3_vtab_distinct() interface returns 2, that means that the query planner does not need the rows returned in any particular order, as long as rows with the same values in all "aOrderBy" columns are adjacent.

/* IMP: R-08996-44767 */
# EVIDENCE-OF: R-08996-44767 If the sqlite3_vtab_distinct() interface
# returns 2, that means that the query planner does not need the rows
# returned in any particular order, as long as rows with the same values
# in all "aOrderBy" columns are adjacent.

R-58848-61508-37429-19657-25178-16423-23766-44063 tcl slt th3 src

Furthermore, only a single row for each particular combination of values in the columns identified by the "aOrderBy" field needs to be returned.

/* IMP: R-58848-61508 */
# EVIDENCE-OF: R-58848-61508 Furthermore, only a single row for each
# particular combination of values in the columns identified by the
# "aOrderBy" field needs to be returned.

R-57474-41961-20829-16248-57477-10262-25485-49294 tcl slt th3 src

It is always ok for two or more rows with the same values in all "aOrderBy" columns to be returned, as long as all such rows are adjacent.

/* IMP: R-57474-41961 */
# EVIDENCE-OF: R-57474-41961 It is always ok for two or more rows with
# the same values in all "aOrderBy" columns to be returned, as long as
# all such rows are adjacent.

R-11582-07116-64761-46100-27755-27089-47370-58477 tcl slt th3 src

The virtual table may, if it chooses, omit extra rows that have the same value for all columns identified by "aOrderBy".

/* IMP: R-11582-07116 */
# EVIDENCE-OF: R-11582-07116 The virtual table may, if it chooses, omit
# extra rows that have the same value for all columns identified by
# "aOrderBy".

R-08214-18010-33736-07110-47813-14852-27438-16188 tcl slt th3 src

However omitting the extra rows is optional.

/* IMP: R-08214-18010 */
# EVIDENCE-OF: R-08214-18010 However omitting the extra rows is
# optional.

R-52675-02101-02366-27755-19404-45164-56162-18883 tcl slt th3 src

If the sqlite3_vtab_distinct() interface returns 3, that means that the query planner needs only distinct rows but it does need the rows to be sorted.

/* IMP: R-52675-02101 */
# EVIDENCE-OF: R-52675-02101 If the sqlite3_vtab_distinct() interface
# returns 3, that means that the query planner needs only distinct rows
# but it does need the rows to be sorted.

R-00041-06536-06136-27539-15037-63357-02924-13585 tcl slt th3 src

The virtual table implementation is free to omit rows that are identical in all aOrderBy columns, if it wants to, but it is not required to omit any rows.

/* IMP: R-00041-06536 */
# EVIDENCE-OF: R-00041-06536 The virtual table implementation is free to
# omit rows that are identical in all aOrderBy columns, if it wants to,
# but it is not required to omit any rows.

R-32161-57285-33501-27811-08075-48944-37415-27497 tcl slt th3 src

For the purposes of comparing virtual table output values to see if the values are same value for sorting purposes, two NULL values are considered to be the same.

/* IMP: R-32161-57285 */
# EVIDENCE-OF: R-32161-57285 For the purposes of comparing virtual table
# output values to see if the values are same value for sorting
# purposes, two NULL values are considered to be the same.

R-55082-03288-31025-58898-03257-28661-47165-23134 tcl slt th3 src

A virtual table implementation is always free to return rows in any order it wants, as long as the "orderByConsumed" flag is not set.

/* IMP: R-55082-03288 */
# EVIDENCE-OF: R-55082-03288 A virtual table implementation is always
# free to return rows in any order it wants, as long as the
# "orderByConsumed" flag is not set.

R-34581-10147-58030-07537-46530-34726-16682-11736 tcl slt th3 src

When the the "orderByConsumed" flag is unset, the query planner will add extra bytecode to ensure that the final results returned by the SQL query are ordered correctly.

/* IMP: R-34581-10147 */
# EVIDENCE-OF: R-34581-10147 When the the "orderByConsumed" flag is
# unset, the query planner will add extra bytecode to ensure that the
# final results returned by the SQL query are ordered correctly.

R-50007-39580-16025-53191-47811-24920-21111-19074 tcl slt th3 src

Careful use of the sqlite3_vtab_distinct() interface and the "orderByConsumed" flag might help queries against a virtual table to run faster.

/* IMP: R-50007-39580 */
# EVIDENCE-OF: R-50007-39580 Careful use of the sqlite3_vtab_distinct()
# interface and the "orderByConsumed" flag might help queries against a
# virtual table to run faster.