Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. Memsql column tables PART and PARTSUPP will have same column as shard key as well as Columnstore key to get benefit of indexing in columnstore 2. PART, PARTSUPP, CUSTOMER tables will act as column store data. 3. Created extra tables called LINEITEM_PART and ORDER_CUST where LINEITEM is colocated with PART and ORDER is colocated with CUSTOMER. This is done as an option to column table indexing. This is just a workaround 4. Earlier date handling was not efficient for snappy queries. As of now provided crude way to handle it efficiently. 5. To avoid costly joins on tables, ordering of the tables in FROM clause is changed for multiple queries
- Loading branch information
Kishor Bachhav
committed
Jul 26, 2016
1 parent
0daea47
commit 6153979
Showing
12 changed files
with
2,248 additions
and
2,150 deletions.
There are no files selected for viewing
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
80 changes: 80 additions & 0 deletions
80
cluster/src/test/scala/io/snappydata/benchmark/memsql/ConcurrentMemsql.scala
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
package io.snappydata.benchmark.memsql | ||
|
||
import java.io.{PrintStream, FileOutputStream} | ||
import java.sql.DriverManager | ||
import java.util.Date | ||
|
||
/** | ||
* Created by kishor on 21/7/16. | ||
*/ | ||
object ConcurrentMemsql { | ||
|
||
|
||
|
||
def main(args: Array[String]): Unit = { | ||
|
||
val host = args(0) | ||
val port = 3306 | ||
val dbName = "TPCH" | ||
val user = "root" | ||
val password = "" | ||
|
||
val readerThread = new Thread(new Runnable { | ||
def run() { | ||
Class.forName("com.mysql.jdbc.Driver") | ||
val dbAddress = "jdbc:mysql://" + host + ":" + port + "/" | ||
val conn = DriverManager.getConnection(dbAddress, user, password) | ||
val stmt = conn.createStatement | ||
stmt.execute("USE " + dbName) | ||
val avgFileStream = new FileOutputStream(new java.io.File(s"reader.out")) | ||
val avgPrintStream = new PrintStream(avgFileStream) | ||
for (i <- 1 to 100000) { | ||
|
||
var starttime = System.nanoTime() | ||
// val rs = stmt.executeQuery("select count(*) as counter from PARTSUPP where ps_suppkey = 18692 and Ps_partkey = 7663535; ") | ||
val rs = stmt.executeQuery("select PS_AVAILQTY as counter from PARTSUPP where ps_suppkey = 18692 and PS_partkeY = 653535") | ||
var count = 0 | ||
while (rs.next()) { | ||
count = rs.getInt("counter") | ||
//just iterating over result | ||
//count+=1 | ||
} | ||
var timetaken = (System.nanoTime() - starttime)/1000 | ||
|
||
avgPrintStream.println(s"Total time taken $timetaken results : $count ${new Date()} ") | ||
|
||
} | ||
avgPrintStream.close() | ||
} | ||
}).start() | ||
|
||
val writerThread = new Thread(new Runnable { | ||
def run() { | ||
Class.forName("com.mysql.jdbc.Driver") | ||
val dbAddress = "jdbc:mysql://" + host + ":" + port + "/" | ||
val conn = DriverManager.getConnection(dbAddress, user, password) | ||
val stmt = conn.createStatement | ||
stmt.execute("USE " + dbName) | ||
val avgFileStream = new FileOutputStream(new java.io.File(s"writer.out")) | ||
val avgPrintStream = new PrintStream(avgFileStream) | ||
var startCounter = 7653535 | ||
avgPrintStream.println(s"insertion started ${new Date()}") | ||
for (i <- 1 to 100000) { | ||
startCounter+=1 | ||
try { | ||
var starttime = System.nanoTime() | ||
// val rs = stmt.execute(s"insert into PARTSUPP values ($startCounter, 18692 , 2, 4.11, 'aa') ") | ||
val rs = stmt.execute(s"update PARTSUPP set PS_AVAILQTY = PS_AVAILQTY +1") | ||
} catch { | ||
case e => avgPrintStream.println(e) | ||
} | ||
} | ||
|
||
avgPrintStream.println(s"insertion ended ${new Date()}") | ||
avgPrintStream.close() | ||
|
||
} | ||
|
||
}).start() | ||
} | ||
} |
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
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
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
Oops, something went wrong.