You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-11-30 08:21:25 +03:00
48 lines
1.6 KiB
Plaintext
48 lines
1.6 KiB
Plaintext
#
|
|
# Cross engine join
|
|
# Author: Bharath, bharath.bokka@mariadb.com
|
|
#
|
|
-- source ../include/have_columnstore.inc
|
|
|
|
--disable_warnings
|
|
DROP DATABASE IF EXISTS mcs44_db;
|
|
--enable_warnings
|
|
|
|
CREATE DATABASE mcs44_db;
|
|
USE mcs44_db;
|
|
|
|
#
|
|
# Enable cross engine join
|
|
# Configure user and password in Columnstore.xml file
|
|
#
|
|
--exec /usr/bin/mcsSetConfig CrossEngineSupport User 'cejuser'
|
|
--exec /usr/bin/mcsSetConfig CrossEngineSupport Password 'Vagrant1|0000001'
|
|
#
|
|
# Create corresponding in the server
|
|
#
|
|
--disable_warnings
|
|
CREATE USER IF NOT EXISTS'cejuser'@'localhost' IDENTIFIED BY 'Vagrant1|0000001';
|
|
--enable_warnings
|
|
GRANT ALL PRIVILEGES ON *.* TO 'cejuser'@'localhost';
|
|
FLUSH PRIVILEGES;
|
|
|
|
# Create tables with Innodb and Columnstore engines
|
|
CREATE TABLE t1 (t1_int INT, t1_char CHAR(5))ENGINE=Innodb;
|
|
CREATE TABLE t2 (t2_int INT, t2_char CHAR(5))ENGINE=Columnstore;
|
|
INSERT INTO t1 VALUES (NULL,''),(1,'aaa'),(2,'bbb'),(3,'ccc'),(4,'ddd'),(5,'eee'),(6,'ffff'),(7,'ggggg');
|
|
INSERT INTO t2 VALUES (NULL,''),(1,'hhhh'),(3,'iii'),(5,'jjj'),(7,'kkkk'),(9,'lll'),(11,'m'),(13,'nnn');
|
|
|
|
# Execute cross engine join queries
|
|
SELECT COUNT(*) FROM t1, t2 WHERE t1.t1_int = t2.t2_int AND t1.t1_int = 3;
|
|
SELECT * FROM t1, t2 WHERE t1.t1_int = t2.t2_int;
|
|
SELECT t1.t1_int, t1.t1_char, t2.t2_char FROM t1 JOIN t2 ON t1.t1_int = t2.t2_int;
|
|
SELECT t1.t1_int, t1.t1_char, t2.t2_char FROM t1 JOIN t2 ON t1.t1_int = t2.t2_int WHERE t1.t1_int = 3;
|
|
SELECT * FROM t1 LEFT JOIN t2 ON t1.t1_int = t2.t2_int;
|
|
SELECT * FROM t1 RIGHT JOIN t2 ON t1.t1_int = t2.t2_int;
|
|
SELECT * FROM t1;
|
|
SELECT * FROM t2;
|
|
|
|
# Clean UP
|
|
DROP USER 'cejuser'@'localhost';
|
|
DROP DATABASE mcs44_db;
|