Skip to content

Instantly share code, notes, and snippets.

@antongorshkov
Last active April 2, 2016 23:40
Show Gist options
  • Save antongorshkov/e0efd0d21a8893680959 to your computer and use it in GitHub Desktop.
Save antongorshkov/e0efd0d21a8893680959 to your computer and use it in GitHub Desktop.
Start here:
http://docs.memsql.com/4.1/setup/docker/
create database test;
use test;
CREATE TABLE test_table (id BIGINT PRIMARY KEY AUTO_INCREMENT, c INT);
INSERT INTO test_table (c) VALUES (1);
INSERT INTO test_table (c) SELECT c*2 FROM test_table;
select sum(c*2)
from test_table
;
select count(*)
from test_table
;
delete from test_table
;
INSERT INTO test_table (c) VALUES (1)
;
INSERT INTO test_table (c) SELECT c*2 FROM test_table
;
CREATE TABLE events (
event_type VARCHAR(256),
time TIMESTAMP,
id INT AUTO_INCREMENT,
PRIMARY KEY (event_type, id)
)
;
select * from events
;
INSERT INTO events (event_type,time) VALUES ("foo",now());
select data::value
from kafka1
;
select data::$value,data::%price
from kafka1
;
lastname AS data::name::$last PERSISTED TEXT
;
ALTER TABLE kafka1 ADD COLUMN val AS data::$value PERSISTED TEXT
;
ALTER TABLE kafka1 ADD COLUMN price AS data::%price PERSISTED DOUBLE
;
select * from kafka1 order by val
;
select count(*)/1e6 from kafka1
;
select val,count(*),sum(val)
from kafka1
group by val
;
delete from kafka1 limit 10000000
;
MemSQL JSON SQL Docs:
http://docs.memsql.com/4.0/json/json/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment