Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
ffc0fa20
Commit
ffc0fa20
authored
Jul 16, 2017
by
Sergei Petrunia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-13330: ANALYZE FORMAT=JSON should print time spent in SPs
- More test coverage
parent
c0930fe2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
117 additions
and
1 deletion
+117
-1
mysql-test/r/sp-analyze-stmt.result
mysql-test/r/sp-analyze-stmt.result
+85
-0
mysql-test/t/sp-analyze-stmt.test
mysql-test/t/sp-analyze-stmt.test
+32
-1
No files found.
mysql-test/r/sp-analyze-stmt.result
View file @
ffc0fa20
drop table if exists t0,t1;
drop table if exists t0,t1;
drop view if exists v1;
drop function if exists f1;
drop function if exists f1;
drop function if exists f2;
drop function if exists f2;
create table t0(a int);
create table t0(a int);
...
@@ -46,6 +47,8 @@ ANALYZE
...
@@ -46,6 +47,8 @@ ANALYZE
}
}
}
}
}
}
# This will show only invocations of F3
# F3 invokes F1 and F2 but we do counting "at top level" only
analyze format=json select a, f3(a) from t0;
analyze format=json select a, f3(a) from t0;
ANALYZE
ANALYZE
{
{
...
@@ -103,6 +106,88 @@ ANALYZE
...
@@ -103,6 +106,88 @@ ANALYZE
}
}
}
}
}
}
#
# Test that trigger invocations are counted
#
create table t1 (i int, j int);
create trigger trg1 before insert on t1 for each row
begin
if new.j > 10 then
set new.j := 10;
end if;
end|
analyze format=json insert into t1 select a,a from t0;
ANALYZE
{
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "t0",
"access_type": "ALL",
"r_loops": 1,
"rows": 10,
"r_rows": 10,
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 100
}
},
"r_stored_routines": {
{
"qname": "test.trg1",
"r_count": 10,
"r_total_time_ms": "REPLACED"
}
}
}
drop table t1;
create view v1 as select f1(max(a)) as COL from t0;
analyze format=json select * from v1;
ANALYZE
{
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "<derived2>",
"access_type": "ALL",
"r_loops": 1,
"rows": 10,
"r_rows": 1,
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 100,
"materialized": {
"query_block": {
"select_id": 2,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "t0",
"access_type": "ALL",
"r_loops": 1,
"rows": 10,
"r_rows": 10,
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 100
}
}
}
}
},
"r_stored_routines": {
{
"qname": "test.f1",
"r_count": 1,
"r_total_time_ms": "REPLACED"
}
}
}
drop view v1;
drop table t0;
drop table t0;
drop function f1;
drop function f1;
drop function f2;
drop function f2;
...
...
mysql-test/t/sp-analyze-stmt.test
View file @
ffc0fa20
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
--
disable_warnings
--
disable_warnings
drop
table
if
exists
t0
,
t1
;
drop
table
if
exists
t0
,
t1
;
drop
view
if
exists
v1
;
drop
function
if
exists
f1
;
drop
function
if
exists
f1
;
drop
function
if
exists
f2
;
drop
function
if
exists
f2
;
--
enable_warnings
--
enable_warnings
...
@@ -33,13 +34,43 @@ delimiter ;|
...
@@ -33,13 +34,43 @@ delimiter ;|
--
source
include
/
analyze
-
format
.
inc
--
source
include
/
analyze
-
format
.
inc
analyze
format
=
json
select
a
,
f1
(
a
),
f2
(
a
)
from
t0
;
analyze
format
=
json
select
a
,
f1
(
a
),
f2
(
a
)
from
t0
;
--
echo
# This will show only invocations of F3
--
echo
# F3 invokes F1 and F2 but we do counting "at top level" only
--
source
include
/
analyze
-
format
.
inc
--
source
include
/
analyze
-
format
.
inc
analyze
format
=
json
select
a
,
f3
(
a
)
from
t0
;
analyze
format
=
json
select
a
,
f3
(
a
)
from
t0
;
--
source
include
/
analyze
-
format
.
inc
--
source
include
/
analyze
-
format
.
inc
analyze
format
=
json
select
a
,
f1
(
a
),
f3
(
a
)
from
t0
;
analyze
format
=
json
select
a
,
f1
(
a
),
f3
(
a
)
from
t0
;
# TODO: tests for triggers.
--
echo
#
--
echo
# Test that trigger invocations are counted
--
echo
#
create
table
t1
(
i
int
,
j
int
);
delimiter
|
;
create
trigger
trg1
before
insert
on
t1
for
each
row
begin
if
new
.
j
>
10
then
set
new
.
j
:=
10
;
end
if
;
end
|
delimiter
;
|
--
source
include
/
analyze
-
format
.
inc
analyze
format
=
json
insert
into
t1
select
a
,
a
from
t0
;
drop
table
t1
;
#
# Test how it works with a non-mergeable VIEW:
#
create
view
v1
as
select
f1
(
max
(
a
))
as
COL
from
t0
;
--
source
include
/
analyze
-
format
.
inc
analyze
format
=
json
select
*
from
v1
;
drop
view
v1
;
drop
table
t0
;
drop
table
t0
;
drop
function
f1
;
drop
function
f1
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment