Skip to content

Instantly share code, notes, and snippets.

@toniSta
toniSta / psycopg_client.py
Last active November 7, 2019 22:36
Python client using psycopg2
import psycopg2
connection = psycopg2.connect(host='localhost',
port=5432,
user='',
password='')
# IMPORTANT. Otherwise statements will be executed as transactions. We don't
# support "begin" and "commit".
connection.autocommit = True
@toniSta
toniSta / pqxx_client.cpp
Last active November 7, 2019 23:11
Simple C++ client
#include <iostream>
#include <pqxx/pqxx>
int main() {
const std::string connection_string("user='' host='localhost' port=5432 sslmode='disable' password=''");
pqxx::connection connection{connection_string}; // Create connection using string
// We use nontransactions because the regular transactions use "begin" and "commit" keywords that we don't support.
pqxx::nontransaction transaction{connection};
// Create table with one column and one row containing the value '1'. Ignore the result.
@toniSta
toniSta / sles.sh
Last active October 5, 2018 16:39
Hyrise install script for SLES
# Needs to be exact
BOOST_VERSION=1.66.0
# If you do not wish to install a specific RC, just leave this variable unset.
RC=rc2
install_boost() {
if [ $(find /usr -name libboost_atomic.so.$BOOST_VERSION 2>&1 | grep -v "Permission denied" | wc -l) -eq 0 ]; then
if [ -n "$RC" ]; then
boost_suffix=_$RC
fi
std::shared_ptr<const BaseColumn> Chunk::get_column(ColumnID column_id) const {
return std::atomic_load(&_columns.at(column_id));
}
#include <iostream>
#include <papi.h>
int numEvents = 2;
long long counters[2];
// total cycles, cycles spent stalling
int events[] = {PAPI_TOT_CYC, PAPI_RES_STL};
PAPI_start_counters(events, numEvents);
expensive_method();