Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
036fea4a
提交
036fea4a
authored
4月 21, 2018
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add tests for simple one-column index sorting
上级
a92ab735
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
263 行增加
和
0 行删除
+263
-0
indexes.sql
h2/src/test/org/h2/test/scripts/indexes.sql
+263
-0
没有找到文件。
h2/src/test/org/h2/test/scripts/indexes.sql
浏览文件 @
036fea4a
...
...
@@ -3,6 +3,269 @@
-- Initial Developer: H2 Group
--
-- Test all possible order modes
CREATE
TABLE
TEST
(
A
INT
);
>
ok
INSERT
INTO
TEST
VALUES
(
NULL
),
(
0
),
(
1
);
>
update
count
:
3
-- default
SELECT
A
FROM
TEST
ORDER
BY
A
;
>
A
>
----
>
null
>
0
>
1
>
rows
(
ordered
):
3
CREATE
INDEX
A_IDX
ON
TEST
(
A
);
SELECT
A
FROM
TEST
ORDER
BY
A
;
>
A
>
----
>
null
>
0
>
1
>
rows
(
ordered
):
3
EXPLAIN
SELECT
A
FROM
TEST
ORDER
BY
A
;
>>
SELECT
A
FROM
PUBLIC
.
TEST
/* PUBLIC.A_IDX */
ORDER
BY
1
/* index sorted */
DROP
INDEX
A_IDX
;
>
ok
-- ASC
SELECT
A
FROM
TEST
ORDER
BY
A
ASC
;
>
A
>
----
>
null
>
0
>
1
>
rows
(
ordered
):
3
CREATE
INDEX
A_IDX
ON
TEST
(
A
ASC
);
SELECT
A
FROM
TEST
ORDER
BY
A
ASC
;
>
A
>
----
>
null
>
0
>
1
>
rows
(
ordered
):
3
EXPLAIN
SELECT
A
FROM
TEST
ORDER
BY
A
ASC
;
>>
SELECT
A
FROM
PUBLIC
.
TEST
/* PUBLIC.A_IDX */
ORDER
BY
1
/* index sorted */
DROP
INDEX
A_IDX
;
>
ok
-- ASC NULLS FIRST
SELECT
A
FROM
TEST
ORDER
BY
A
ASC
NULLS
FIRST
;
>
A
>
----
>
null
>
0
>
1
>
rows
(
ordered
):
3
CREATE
INDEX
A_IDX
ON
TEST
(
A
ASC
NULLS
FIRST
);
SELECT
A
FROM
TEST
ORDER
BY
A
ASC
NULLS
FIRST
;
>
A
>
----
>
null
>
0
>
1
>
rows
(
ordered
):
3
EXPLAIN
SELECT
A
FROM
TEST
ORDER
BY
A
ASC
NULLS
FIRST
;
>>
SELECT
A
FROM
PUBLIC
.
TEST
/* PUBLIC.A_IDX */
ORDER
BY
1
NULLS
FIRST
/* index sorted */
DROP
INDEX
A_IDX
;
>
ok
-- ASC NULLS LAST
SELECT
A
FROM
TEST
ORDER
BY
A
ASC
NULLS
LAST
;
>
A
>
----
>
0
>
1
>
null
>
rows
(
ordered
):
3
CREATE
INDEX
A_IDX
ON
TEST
(
A
ASC
NULLS
LAST
);
SELECT
A
FROM
TEST
ORDER
BY
A
ASC
NULLS
LAST
;
>
A
>
----
>
0
>
1
>
null
>
rows
(
ordered
):
3
EXPLAIN
SELECT
A
FROM
TEST
ORDER
BY
A
ASC
NULLS
LAST
;
>>
SELECT
A
FROM
PUBLIC
.
TEST
/* PUBLIC.A_IDX */
ORDER
BY
1
NULLS
LAST
/* index sorted */
DROP
INDEX
A_IDX
;
>
ok
-- DESC
SELECT
A
FROM
TEST
ORDER
BY
A
DESC
;
>
A
>
----
>
1
>
0
>
null
>
rows
(
ordered
):
3
CREATE
INDEX
A_IDX
ON
TEST
(
A
DESC
);
SELECT
A
FROM
TEST
ORDER
BY
A
DESC
;
>
A
>
----
>
1
>
0
>
null
>
rows
(
ordered
):
3
EXPLAIN
SELECT
A
FROM
TEST
ORDER
BY
A
DESC
;
>>
SELECT
A
FROM
PUBLIC
.
TEST
/* PUBLIC.A_IDX */
ORDER
BY
1
DESC
/* index sorted */
DROP
INDEX
A_IDX
;
>
ok
-- DESC NULLS FIRST
SELECT
A
FROM
TEST
ORDER
BY
A
DESC
NULLS
FIRST
;
>
A
>
----
>
null
>
1
>
0
>
rows
(
ordered
):
3
CREATE
INDEX
A_IDX
ON
TEST
(
A
DESC
NULLS
FIRST
);
SELECT
A
FROM
TEST
ORDER
BY
A
DESC
NULLS
FIRST
;
>
A
>
----
>
null
>
1
>
0
>
rows
(
ordered
):
3
EXPLAIN
SELECT
A
FROM
TEST
ORDER
BY
A
DESC
NULLS
FIRST
;
>>
SELECT
A
FROM
PUBLIC
.
TEST
/* PUBLIC.A_IDX */
ORDER
BY
1
DESC
NULLS
FIRST
/* index sorted */
DROP
INDEX
A_IDX
;
>
ok
-- DESC NULLS LAST
SELECT
A
FROM
TEST
ORDER
BY
A
DESC
NULLS
LAST
;
>
A
>
----
>
1
>
0
>
null
>
rows
(
ordered
):
3
CREATE
INDEX
A_IDX
ON
TEST
(
A
DESC
NULLS
LAST
);
SELECT
A
FROM
TEST
ORDER
BY
A
DESC
NULLS
LAST
;
>
A
>
----
>
1
>
0
>
null
>
rows
(
ordered
):
3
EXPLAIN
SELECT
A
FROM
TEST
ORDER
BY
A
DESC
NULLS
LAST
;
>>
SELECT
A
FROM
PUBLIC
.
TEST
/* PUBLIC.A_IDX */
ORDER
BY
1
DESC
NULLS
LAST
/* index sorted */
DROP
INDEX
A_IDX
;
>
ok
-- Index selection
CREATE
INDEX
A_IDX_ASC
ON
TEST
(
A
ASC
);
>
ok
CREATE
INDEX
A_IDX_ASC_NL
ON
TEST
(
A
ASC
NULLS
LAST
);
>
ok
CREATE
INDEX
A_IDX_DESC
ON
TEST
(
A
DESC
);
>
ok
CREATE
INDEX
A_IDX_DESC_NF
ON
TEST
(
A
DESC
NULLS
FIRST
);
>
ok
EXPLAIN
SELECT
A
FROM
TEST
ORDER
BY
A
;
>>
SELECT
A
FROM
PUBLIC
.
TEST
/* PUBLIC.A_IDX_ASC */
ORDER
BY
1
/* index sorted */
EXPLAIN
SELECT
A
FROM
TEST
ORDER
BY
A
ASC
;
>>
SELECT
A
FROM
PUBLIC
.
TEST
/* PUBLIC.A_IDX_ASC */
ORDER
BY
1
/* index sorted */
EXPLAIN
SELECT
A
FROM
TEST
ORDER
BY
A
NULLS
FIRST
;
>>
SELECT
A
FROM
PUBLIC
.
TEST
/* PUBLIC.A_IDX_ASC */
ORDER
BY
1
NULLS
FIRST
/* index sorted */
EXPLAIN
SELECT
A
FROM
TEST
ORDER
BY
A
NULLS
LAST
;
>>
SELECT
A
FROM
PUBLIC
.
TEST
/* PUBLIC.A_IDX_ASC_NL */
ORDER
BY
1
NULLS
LAST
/* index sorted */
EXPLAIN
SELECT
A
FROM
TEST
ORDER
BY
A
DESC
;
>>
SELECT
A
FROM
PUBLIC
.
TEST
/* PUBLIC.A_IDX_DESC */
ORDER
BY
1
DESC
/* index sorted */
EXPLAIN
SELECT
A
FROM
TEST
ORDER
BY
A
DESC
NULLS
FIRST
;
>>
SELECT
A
FROM
PUBLIC
.
TEST
/* PUBLIC.A_IDX_DESC_NF */
ORDER
BY
1
DESC
NULLS
FIRST
/* index sorted */
EXPLAIN
SELECT
A
FROM
TEST
ORDER
BY
A
DESC
NULLS
LAST
;
>>
SELECT
A
FROM
PUBLIC
.
TEST
/* PUBLIC.A_IDX_DESC */
ORDER
BY
1
DESC
NULLS
LAST
/* index sorted */
DROP
INDEX
A_IDX_ASC
;
>
ok
DROP
INDEX
A_IDX_DESC
;
>
ok
CREATE
INDEX
A_IDX_ASC_NF
ON
TEST
(
A
ASC
NULLS
FIRST
);
>
ok
CREATE
INDEX
A_IDX_DESC_NL
ON
TEST
(
A
DESC
NULLS
LAST
);
>
ok
EXPLAIN
SELECT
A
FROM
TEST
ORDER
BY
A
;
>>
SELECT
A
FROM
PUBLIC
.
TEST
/* PUBLIC.A_IDX_ASC_NF */
ORDER
BY
1
/* index sorted */
EXPLAIN
SELECT
A
FROM
TEST
ORDER
BY
A
ASC
;
>>
SELECT
A
FROM
PUBLIC
.
TEST
/* PUBLIC.A_IDX_ASC_NF */
ORDER
BY
1
/* index sorted */
EXPLAIN
SELECT
A
FROM
TEST
ORDER
BY
A
NULLS
FIRST
;
>>
SELECT
A
FROM
PUBLIC
.
TEST
/* PUBLIC.A_IDX_ASC_NF */
ORDER
BY
1
NULLS
FIRST
/* index sorted */
EXPLAIN
SELECT
A
FROM
TEST
ORDER
BY
A
NULLS
LAST
;
>>
SELECT
A
FROM
PUBLIC
.
TEST
/* PUBLIC.A_IDX_ASC_NL */
ORDER
BY
1
NULLS
LAST
/* index sorted */
EXPLAIN
SELECT
A
FROM
TEST
ORDER
BY
A
DESC
;
>>
SELECT
A
FROM
PUBLIC
.
TEST
/* PUBLIC.A_IDX_DESC_NL */
ORDER
BY
1
DESC
/* index sorted */
EXPLAIN
SELECT
A
FROM
TEST
ORDER
BY
A
DESC
NULLS
FIRST
;
>>
SELECT
A
FROM
PUBLIC
.
TEST
/* PUBLIC.A_IDX_DESC_NF */
ORDER
BY
1
DESC
NULLS
FIRST
/* index sorted */
EXPLAIN
SELECT
A
FROM
TEST
ORDER
BY
A
DESC
NULLS
LAST
;
>>
SELECT
A
FROM
PUBLIC
.
TEST
/* PUBLIC.A_IDX_DESC_NL */
ORDER
BY
1
DESC
NULLS
LAST
/* index sorted */
DROP
TABLE
TEST
;
>
ok
-- Other tests
create
table
test
(
a
int
,
b
int
);
>
ok
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论