|
性能还是比不上oracle
profile对各个语句计时,包括执行出错的
MariaDB [test]> set profiling=1;
Query OK, 0 rows affected (0.03 sec)
MariaDB [test]> WITH RECURSIVE t as(select 1 a,1 b union all select a+1,b*2 from
t where a<10)select a,sum(a)over(partition by mod(a,2) order by a),mod(a,2) fro
m t;
+----+----------------------------------------------+----------+
| a | sum(a)over(partition by mod(a,2) order by a) | mod(a,2) |
+----+----------------------------------------------+----------+
| 1 | 1 | 1 |
| 2 | 2 | 0 |
| 3 | 4 | 1 |
| 4 | 6 | 0 |
| 5 | 9 | 1 |
| 6 | 12 | 0 |
| 7 | 16 | 1 |
| 8 | 20 | 0 |
| 9 | 25 | 1 |
| 10 | 30 | 0 |
+----+----------------------------------------------+----------+
10 rows in set (0.00 sec)
MariaDB [test]> show profiles;
+----------+------------+-------------------------------------------------------
--------------------------------------------------------------------------------
--------------+
| Query_ID | Duration | Query
|
+----------+------------+-------------------------------------------------------
--------------------------------------------------------------------------------
--------------+
| 1 | 0.00071210 | WITH RECURSIVE t as(select 1 a,1 b union all select a+
1,b*2 from t where a<10)select a,sum(a)over(partition by mod(a,2) order by a),mo
d(a,2) from t |
+----------+------------+-------------------------------------------------------
--------------------------------------------------------------------------------
--------------+
1 row in set (0.01 sec)
MariaDB [test]> WITH RECURSIVE t as(select 1 a,1 b union all select a+1,b*2 from
t where a<1e6)select sum(a) from t;
ERROR 1690 (22003): BIGINT value is out of range in '`t`.`b` * 2'
MariaDB [test]> WITH RECURSIVE t as(select 1 a,1 b union all select a+1,b from t
where a<1e6)select sum(a) from t;
+--------------+
| sum(a) |
+--------------+
| 500000500000 |
+--------------+
1 row in set (7.58 sec)
MariaDB [test]> show profiles;
+----------+------------+-------------------------------------------------------
--------------------------------------------------------------------------------
--------------+
| Query_ID | Duration | Query
|
+----------+------------+-------------------------------------------------------
--------------------------------------------------------------------------------
--------------+
| 1 | 0.00071210 | WITH RECURSIVE t as(select 1 a,1 b union all select a+
1,b*2 from t where a<10)select a,sum(a)over(partition by mod(a,2) order by a),mo
d(a,2) from t |
| 2 | 0.00250339 | WITH RECURSIVE t as(select 1 a,1 b union all select a+
1,b*2 from t where a<1e6)select sum(a) from t
|
| 3 | 7.58109967 | WITH RECURSIVE t as(select 1 a,1 b union all select a+
1,b from t where a<1e6)select sum(a) from t
|
+----------+------------+-------------------------------------------------------
--------------------------------------------------------------------------------
--------------+
3 rows in set (0.00 sec)
MariaDB [test]>
|
|