!
PyData Moscow . python , . , ClickHouse,
GitHub . SQL . ClickHouse, Spring Hibernate.
.
. , ( 200 ). , . , 8 . 60 .
, , Ubuntu rpm (UPD:
). rpm Centos 7.
. :
- gcc 6 , centos 4.8. , ? clickHouse, C++, 4 . , GCC 6 . clickhouse gcc, - Ubuntu. . 1.5 .
- clickhouse libmysqlclient. , clikchouse MySQL?
40 . clickhouse
/usr/local/etc/clickhouse-server/config.xml
, .
sudo /usr/local/bin/clickhouse-server --config /usr/local/etc/clickhouse-server/config.xml
, 1987 2015 . . 24 , 14 61.6 .
:
|
, |
2015 |
2.067
|
|
3.744 |
|
7.012 |
|
3.195 |
, |
3.392 |
|
12.466 |
, |
4.596 |
|
1.653 |
2015 |
0.380 |
|
8.806 |
, 8 , 8 , . , clickhouse , production. , , . 166 .
ClickHouse Java
clickhouse Java. jdbc
.
maven :
ru.yandex.clickhouse
clickhouse-jdbc
${clickhouse-jdbc-version}
, . , clikchouse . - 9000, http 8123. JDBC http, 8123. - default. - . clickhouse ,
::
.
JDBC:
private static final String DB_URL = "jdbc:clickhouse://localhost:8123/default";
private final Connection conn;
/**
* Creates new instance
* @throws SQLException in case of connection issue
*/
public ClickHouseJDBCDemo() throws SQLException {
conn = DriverManager.getConnection(DB_URL);
}
/**
* Queries db to get most popular flight route for ths given year
* @param year year to query
* @throws SQLException in case of query issue
*/
public void popularYearRoutes(int year) throws SQLException {
String query = "SELECT " +
" OriginCityName, " +
" DestCityName, " +
" count(*) AS flights, " +
" bar(flights, 0, 20000, 40) AS bar " +
"FROM ontime WHERE Year = ? GROUP BY OriginCityName, DestCityName ORDER BY flights DESC LIMIT 20";
long time = System.currentTimeMillis();
try (PreparedStatement statement = conn.prepareStatement(query)) {
statement.setInt(1, year);
try (ResultSet rs = statement.executeQuery()) {
Util.printRs(rs);
}
}
System.out.println("Time: " + (System.currentTimeMillis() - time) +" ms");
}
, .
.
Hibernate?
ORM. , JDBC, ORM, Spring Data JPA. , , . , SQL Dialect. ClickHouse .
org.hibernate.dialect.Dialect
:
public class ClickHouseDialect extends Dialect {
}
. . , clickhouse
alias . , :
SELECT alias.column from tablename alias
clickHouse .
, hibernate alias SQL Dialect. , .
hibernate ,
. , hibernate . , - .
clickhouse . . , jdbc. , ANSI SQL Hibernate. , . clickhouse , . ORM .
, , clikchouse .
https://habrahabr.ru/post/332112/