Skip to content

Instantly share code, notes, and snippets.

@h0lyalg0rithm
Last active August 29, 2015 14:26
Show Gist options
  • Save h0lyalg0rithm/6055b620b3172f71b083 to your computer and use it in GitHub Desktop.
Save h0lyalg0rithm/6055b620b3172f71b083 to your computer and use it in GitHub Desktop.
PostgreSQL benchmark
CREATE TABLE test (
id serial NOT NULL primary key,
name text
desc1 text
desc2 text
);
CREATE INDEX alll ON test(name, desc1, desc2);
CREATE INDEX name ON test(name);
CREATE INDEX more ON test(name, desc1);
CREATE INDEX more1 ON test(name, desc2);
require 'pg'
conn = PG.connect( dbname: 'benchmark' )
(1...10000).each do
conn.exec( "INSERT INTO test(name) VALUES('t')" ) do |result|
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment