Last active
August 30, 2016 08:48
-
-
Save winebarrel/7938971 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE games ( | |
author STRING HASH, | |
game_id NUMBER RANGE, | |
INDEX game-type-id-index (game_type_id NUMBER) ALL, | |
GLOBAL INDEX game-title-index (title STRING, version NUMBER) ALL | |
) read=4 write=4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ap-northeast-1> insert into games (author, game_id, game_type_id, title, version) | |
-> values ('Yamada', 100, 2, 'Dragon X', 1), ('Yamada', 101, 2, 'Dragon X', 2); | |
// 2 rows changed (0.10 sec) | |
ap-northeast-1> select all * from games; | |
[ | |
{"author":"Yamada","game_id":100,"game_type_id":2,"title":"Dragon X","version":1}, | |
{"author":"Yamada","game_id":101,"game_type_id":2,"title":"Dragon X","version":2} | |
] | |
// 2 rows in set (0.07 sec) | |
ap-northeast-1> select * from games use index (game-title-index) where title = 'Dragon X'; | |
[ | |
{"author":"Yamada","game_id":100,"game_type_id":2,"title":"Dragon X","version":1}, | |
{"author":"Yamada","game_id":101,"game_type_id":2,"title":"Dragon X","version":2} | |
] | |
// 2 rows in set (0.28 sec) | |
ap-northeast-1> select * from games use index (game-title-index) where title = 'Dragon X' and version = 2; | |
[ | |
{"author":"Yamada","game_id":101,"game_type_id":2,"title":"Dragon X","version":2} | |
] | |
// 1 row in set (0.06 sec) | |
ap-northeast-1> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment