Skip to content

Instantly share code, notes, and snippets.

@robrich
robrich / reference-table.sql
Created June 23, 2020 04:01
Reference Tables
create database 'tpc_h';
use 'tpc_h';
CREATE TABLE IF NOT EXISTS `lineitem` (
`l_orderkey` bigint(11) NOT NULL,
`l_partkey` int(11) NOT NULL,
`l_suppkey` int(11) NOT NULL,
`l_linenumber` int(11) NOT NULL,
`l_quantity` decimal(15,2) NOT NULL,
`l_extendedprice` decimal(15,2) NOT NULL,
@robrich
robrich / backup-with-split-partitions.sql
Created June 18, 2020 04:55
MemSQL Backup with Split Partitions
-- create a database with 2 master partitions
create database thedb partitions 2;
-- create sample data
use thedb;
create table data (msg varchar(200));
insert into data (msg) values ('the data');
-- notice how we're not using the database efficiently
show partitions;
@robrich
robrich / memsql-helios-commands.sql
Created June 11, 2020 22:03
Welcome to MemSQL Helios
-- create a database
create database cosmeticshop;
-- create a table
use cosmeticshop;
create table cosmeticshopfunnel
(
event_time TIMESTAMP,
event_type CHAR(18),
product_id CHAR(10),
@robrich
robrich / linear-regression-pushdown-disabled.ipynb
Created June 4, 2020 00:49
Training and testing a Machine Learning model with Spark and MemSQL
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@robrich
robrich / etl-with-memsql-spark-connector.ipynb
Created June 4, 2020 00:47
MemSQL Spark Connector and MySQL JDBC
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@robrich
robrich / deployment.yaml
Created May 11, 2020 21:11
RedHat OpenShift + MemSQL Operator
apiVersion: apps/v1
kind: Deployment
metadata:
name: memsql-operator-envvar
namespace: memsql
spec:
replicas: 1
selector:
matchLabels:
name: memsql-operator-envvar
@robrich
robrich / deployment.yaml
Created February 4, 2020 22:20
Kubernetes first elements
apiVersion: apps/v1
kind: Deployment
metadata:
name: myapp
labels:
app: myapp
spec:
replicas: 3
template:
metadata:
@robrich
robrich / Vagrantfile
Last active October 12, 2021 16:35
MemSQL Vagrant Dev Cluster
Vagrant.configure("2") do |config|
config.vm.box = "generic/ubuntu1904"
# set the provider
config.vm.provider "virtualbox"
# configure the provider
config.vm.provider "virtualbox" do |v|
v.cpus = 4
v.memory = 4096
end
CREATE DATABASE hellomemsql;
USE hellomemsql;
CREATE TABLE test (
message text NOT NULL
);
INSERT INTO test (message) VALUES ('this is a sample message');
version: '2'
services:
memsql:
image: 'memsql/cluster-in-a-box'
ports:
- 3306:3306
- 8080:8080
environment:
LICENSE_KEY: ${LICENSE_KEY}