CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
61 lines
1.8 KiB
Plaintext
61 lines
1.8 KiB
Plaintext
# 2016-07-27
|
|
#
|
|
# The author disclaims copyright to this source code. In place of
|
|
# a legal notice, here is a blessing:
|
|
#
|
|
# May you do good and not evil.
|
|
# May you find forgiveness for yourself and forgive others.
|
|
# May you share freely, never taking more than you give.
|
|
#
|
|
#***********************************************************************
|
|
#
|
|
# Test cases for ORDER BY and LIMIT on an index scan.
|
|
#
|
|
|
|
|
|
set testdir [file dirname $argv0]
|
|
source $testdir/tester.tcl
|
|
|
|
# Performance regression reported at
|
|
# http://www.mail-archive.com/sqlite-users@mailinglists.sqlite.org/msg98615.html
|
|
#
|
|
# Caused by the ORDER BY LIMIT optionation for check-in
|
|
# https://sqlite.org/src/info/bf46179d44843769
|
|
#
|
|
# Fixed on approximately 2016-07-27 by changes that compute a better score
|
|
# for index scans by taking into account WHERE clause constraints that can
|
|
# be handled by the index and do not require a table lookup.
|
|
#
|
|
do_execsql_test 1.0 {
|
|
CREATE TABLE t1(a,b,c,d);
|
|
WITH RECURSIVE c(x) AS (VALUES(0) UNION ALL SELECT x+1 FROM c WHERE x<100)
|
|
INSERT INTO t1(a,b,c,d)
|
|
SELECT x/10, x%10, x%19, x FROM c;
|
|
CREATE INDEX t1abc ON t1(a,b,c);
|
|
SELECT * FROM t1 WHERE c=4 ORDER BY a, b LIMIT 2;
|
|
} {0 4 4 4 2 3 4 23}
|
|
|
|
# Prior to the fix, the following EQP would show a table scan and a sort
|
|
# rather than an index scan.
|
|
#
|
|
do_execsql_test 1.0eqp {
|
|
EXPLAIN QUERY PLAN
|
|
SELECT * FROM t1 WHERE c=4 ORDER BY a, b LIMIT 2;
|
|
} {/SCAN t1 USING INDEX t1abc/}
|
|
|
|
# If we change the index so that it no longer covers the WHERE clause,
|
|
# then we should (correctly) revert to using a table scan.
|
|
#
|
|
do_execsql_test 1.1 {
|
|
DROP INDEX t1abc;
|
|
CREATE INDEX t1abd ON t1(a,b,d);
|
|
SELECT * FROM t1 WHERE c=4 ORDER BY a, b LIMIT 2;
|
|
} {0 4 4 4 2 3 4 23}
|
|
do_execsql_test 1.1eqp {
|
|
EXPLAIN QUERY PLAN
|
|
SELECT * FROM t1 WHERE c=4 ORDER BY a, b LIMIT 2;
|
|
} {~/USING INDEX/}
|
|
|
|
|
|
finish_test
|