This file contains hidden or 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
| MAX_ITER=1000 | |
| MAX_THREADS=10 | |
| MAX_REPETITIONS=10 | |
| def benchmark fun, file | |
| File.unlink file if File.exists? file | |
| (1..MAX_THREADS).each do |thread_count| | |
| total_time = 0.0 | |
| mean_time = 0.0 | |
| (1..MAX_REPETITIONS).each do |repetitions| |
This file contains hidden or 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
| import Database.HDBC | |
| import Database.HDBC.PostgreSQL | |
| import Data.List | |
| type SQL = String | |
| data Relation = Relation SQL | |
| deriving (Show) | |
| sql (Relation sql) = sql |
This file contains hidden or 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
| :module Database.HDBC Database.HDBC.PostgreSQL | |
| :load relational.hs | |
| let dept = Relation "dept" | |
| let emp = Relation "emp" | |
| let teste = (π ["empno", "ename", "dname"] (emp ⋈ dept)) | |
| conn <- connectPostgreSQL "host=localhost dbname=teste" | |
| printTuples conn teste | |
| [[SqlRational (7902 % 1),SqlByteString "FORD",SqlByteString "RESEARCH"],[SqlRational (7654 % 1),SqlByteString "MARTIN",SqlByteString "SALES"],[SqlRational (7521 % 1),SqlByteString "WARD",SqlByteString "SALES"],[SqlRational (7839 % 1),SqlByteString "KING",SqlByteString "ACCOUNTING"],[SqlRational (7876 % 1),SqlByteString "ADAMS",SqlByteString "RESEARCH"],[SqlRational (7782 % 1),SqlByteString "CLARK",SqlByteString "ACCOUNTING"],[SqlRational (7900 % 1),SqlByteString "JAMES",SqlByteString "SALES"],[SqlRational (7698 % 1),SqlByteString "BLAKE",SqlByteString "SALES"],[SqlRational (7566 % 1),SqlByteString "JONES",SqlByteString "RESEARCH"],[SqlRational (7499 % 1),SqlByteString "ALLEN",SqlByteString "SALES"],[SqlRational (7788 % 1),SqlByteString "SCOTT",SqlByteString |
This file contains hidden or 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
| MAX_ITER=1000 | |
| MAX_THREADS=10 | |
| MAX_REPETITIONS=10 | |
| def benchmark fun, file | |
| File.unlink file if File.exists? file | |
| (1..MAX_THREADS).each do |thread_count| | |
| total_time = 0.0 | |
| mean_time = 0.0 | |
| (1..MAX_REPETITIONS).each do |repetitions| |
This file contains hidden or 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
| cd $HOME/pgsql90 | |
| mkdir mestre | |
| ./bin/initdb -D mestre | |
| echo " | |
| listen_addresses = '*' | |
| port = 5433 | |
| wal_level = hot_standby | |
| archive_mode = on | |
| archive_command = 'cp %p /tmp/%f' | |
| max_wal_senders = 1 |
This file contains hidden or 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
| cd $HOME/pgsql90 | |
| ./bin/psql -p 5433 postgres -c "SELECT pg_start_backup('teste');" | |
| cp -r mestre escravo | |
| rm -f escravo/pg_xlog/* | |
| rm escravo/mestre.conf | |
| rm escravo/postmaster.pid | |
| sed -e "s/mestre\.conf/escravo.conf/" escravo/postgresql.conf > escravo/postgresql.conf.new | |
| mv escravo/postgresql.conf.new escravo/postgresql.conf | |
| echo " | |
| listen_addresses = '*' |
This file contains hidden or 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
| wget http://ftp9.us.postgresql.org/pub/mirrors/postgresql/source/v9.0beta2/postgresql-9.0beta2.tar.gz | |
| tar -zxvf postgresql-9.0beta2.tar.gz | |
| cd postgresql-9.0beta2 | |
| ./configure --prefix=$HOME/pgsql90 | |
| make install |
This file contains hidden or 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
| CREATE OR REPLACE FUNCTION public.word2number(word text) | |
| RETURNS integer | |
| LANGUAGE sql | |
| AS $function$ | |
| SELECT (CASE WHEN sum(u::int) % 9 = 0 THEN 1 ELSE sum(u::int) % 9 END)::int | |
| FROM unnest(regexp_split_to_array( | |
| ( | |
| WITH RECURSIVE a as | |
| ( | |
| SELECT 1 AS iteration, ascii(lower(nullif(substr($1, 1, 1), ' '))) % 97 % 9 + 1 AS ch |
This file contains hidden or 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
| [github] | |
| user = diogob | |
| [user] | |
| name = Diogo Biazus | |
| email = [email protected] | |
| [color] | |
| branch = auto | |
| diff = auto | |
| status = auto | |
| [color "branch"] |
This file contains hidden or 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
| apt-get update | |
| apt-get install aptitude | |
| aptitude install python-software-properties | |
| apt-add-repository ppa:pitti/postgresql | |
| add-apt-repository ppa:nginx/stable | |
| aptitude update | |
| aptitude install ruby1.9.1-full build-essential postgresql-server-dev-9.1 postgresql-contrib-9.1 nginx vim-nox git-core htop atop most | |
| pg_dropcluster 9.1 main --stop | |
| echo "pt_BR.UTF-8 UTF-8" > /var/lib/locales/supported.d/pt_BR | |
| locale-gen |
OlderNewer