1. 程式人生 > >Atlas Sharding 安裝、配置及簡單測試

Atlas Sharding 安裝、配置及簡單測試

mysql> select * from test;

+------+----------+

| id   | name     |

+------+----------+

| 1000 | test0001 |

| 1002 | t1002    |

| 1001 | t1001    |

|    1 | test01   |

|    2 | t02      |

|    3 | t03      |

|    4 | t04      |

+------+----------+

7 rows in set (0.01 sec)

mysql> select * from test where id in (1,1000);

+------+----------+

| id   | name     |

+------+----------+

|    1 | test01   |

| 1000 | test0001 |

+------+----------+

2 rows in set (0.02 sec)

mysql> select * from test where id between 3 and 1001;

+------+----------+

| id   | name     |

+------+----------+

|    3 | t03      |

|    4 | t04      |

| 1000 | test0001 |

| 1001 | t1001    |

+------+----------+

4 rows in set (0.02 sec)

mysql> select * from test where id  >3 and id <1001;

+------+----------+

| id   | name     |

+------+----------+

|    4 | t04      |

| 1000 | test0001 |

+------+----------+

2 rows in set (0.00 sec)

mysql> select * from test where id  <5  or id  <1002;

+------+----------+

| id   | name     |

+------+----------+

| 1000 | test0001 |

| 1001 | t1001    |

|    1 | test01   |

|    2 | t02      |

|    3 | t03      |

|    4 | t04      |

+------+----------+

6 rows in set (0.00 sec)

mysql> select * from test where id  >5 limit 3;

+------+----------+

| id   | name     |

+------+----------+

| 1000 | test0001 |

| 1002 | t1002    |

| 1001 | t1001    |

+------+----------+

3 rows in set (0.00 sec)

mysql> select * from test where id  >5 limit 3 ,2;

ERROR 1105 (sqlst): Proxy Warning - Sharing Hit Multi Dbgroup Not Support SQL

--不支援Limit Offset

mysql> select * from test order by id desc;

ERROR 1105 (sqlst): Proxy Warning - Sharing Hit Multi Dbgroup Not Support SQL

--不支援跨gouporder by

mysql> select * from test  where id >1000 order by id desc;

+------+-------+

| id   | name  |

+------+-------+

| 1002 | t1002 |

| 1001 | t1001 |

+------+-------+

2 rows in set (0.00 sec)

--在單個group內支援order by

mysql> select id   from test  where group by name ;

ERROR 1105 (HY000): Proxy Warning - near "group": syntax error

--goup不支援 group by ;

mysql> select id   from test  where  id >999 group by name  ;

+------+

| id   |

+------+

| 1001 |

| 1002 |

| 1000 |

+------+

3 rows in set (0.01 sec)

--在單個group內支援group by ;

mysql> select count(*) from test;

ERROR 1105 (sqlst): Proxy Warning - Sharing Hit Multi Dbgroup Not Support SQL

--group不支援count;

mysql> select count(*) from test where id <100;

+----------+

| count(*) |

+----------+

|        4 |

+----------+

1 row in set (0.00 sec)

--單個group支援count

mysql> select max(id) from test where id <100;

+---------+

| max(id) |

+---------+

|       4 |

+---------+

1 row in set (0.00 sec)

--單個group內支援max;

mysql> select max(id) from test ;

ERROR 1105 (sqlst): Proxy Warning - Sharing Hit Multi Dbgroup Not Support SQL

--group不支援max;

mysql> select min(id) from test;

ERROR 1105 (sqlst): Proxy Warning - Sharing Hit Multi Dbgroup Not Support SQL

---group不支援min;

mysql> select min(id) from test where id <100;

+---------+

| min(id) |

+---------+

|       1 |

+---------+

1 row in set (0.00 sec)

--單個group支援min;

mysql> select * from test t join tab01 k  on k.id=t.id and tab01=1;

ERROR 1105 (sqlst): Proxy Warning - Sharing Hit Multi Dbgroup Not Support SQL

--不支援JOIN;