[GENERAL] High checkpoint_segments

2012-02-14 Thread Jay Levitt
r hot standbys. As a consumer-web startup, with no SLA, and not a huge database, and if we ever do have to recover from downtime it's ok if it takes longer.. is there a reason NOT to always run with something like checkpoint_segments = 1000, as long as I leave the timeout at 5m? Jay Levit

Re: [GENERAL] Extensions btree_gist and cube collide?

2012-02-03 Thread Jay Levitt
IW, I saw this behavior when upgrading a 9.0 database (which had cube and earthdistance installed, but no cube or earthdistance objects in the database other than UDFs) and using the CREATE EXTENSION FROM unpackaged syntax. Jay Levitt -- Sent via pgsql-general mailing list (pgsql-general@postgresq

Re: [GENERAL] 9.1.2: Preventing connections / syncing a database

2012-01-02 Thread Jay Levitt
Greg Sabino Mullane wrote: update pg_database set datallowconn = false where datname = 'foobar'; That's perfect - thanks. Now I can (I think) do this: pg_restore -d rails_dev_new [wait] psql template1 update pg_database set datallowconn = false where datname = 'rails_dev'; select pg_termi

Re: [GENERAL] 9.1.2: Preventing connections / syncing a database

2012-01-02 Thread Jay Levitt
loses focus, you refresh the browser, Rails automatically reloads the changed code, you see the change. (There are three different browser extensions that will automatically refresh your browser, too, in case that was too hard.) TL;DR: Reduce friction -> more frequent database updates -&

[GENERAL] 9.1.2: Preventing connections / syncing a database

2012-01-01 Thread Jay Levitt
Our development workstations maintain a local copy of the production database (which has been small enough that this is workable right now, and preferable to having a test database with generated fake data). We've been doing this by rsync'ing a compressed pgdump from the production server, dro

Re: [GENERAL] Correct syntax to create partial index on a boolean column

2011-12-15 Thread Jay Levitt
Craig Ringer wrote: it's a *bit* of a tiny use case. It certainly is. Jay -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] Controlling complexity in queries

2011-12-14 Thread Jay Levitt
Alban Hertroys wrote: select questions.id from questions join ( select u.id from users as u group by u.id ) as s on s.id = questions.user_id where questions.id = 1; You could write that as: select questions.id from questions as q where exists (select 1 from users as u where u.id = q.user_id

Re: [GENERAL] Controlling complexity in queries

2011-12-14 Thread Jay Levitt
Merlin Moncure wrote: SQL has a very powerful abstraction feature: it's called a view. Good use of views is a key design feature for complex databases. Functions are generally not a good choice for query abstraction unless: One more: * You want contextual queries. (I guess this is a special

Re: [GENERAL] Controlling complexity in queries

2011-12-13 Thread Jay Levitt
Merlin Moncure wrote: Breaking your large queries into functions OTOH can make significant changes to the plan, often to the worse. As an end-user, I think this is an area where PostgreSQL could really stand out (that and the moon launch). In Rails-land, you don't have The DBA that writes qu

Re: [GENERAL] psql -1 with multiple files?

2011-12-01 Thread Jay Levitt
Steve Crawford wrote: On 12/01/2011 02:01 PM, Jay Levitt wrote: Is there a way to load multiple .sql files in a single transaction? Alternately, since -1 basically wraps your input in a BEGIN...your statements...COMMIT you could do that yourself with a begin.sql and commit.sql: cat begin.sql

[GENERAL] psql -1 with multiple files?

2011-12-01 Thread Jay Levitt
Is there a way to load multiple .sql files in a single transaction? It looks like "psql -f file1 -f file2" or "psql -f file*" was a WIP patch that never happened, and from what I can tell, psql ignores the -1 parameter when reading from STDIN, so I can't cat them together either: $ cat > am_i_

[GENERAL] PGError: ERROR: could not open relation with OID?

2011-11-23 Thread Jay Levitt
. Our volume is fairly low, the tables are fairly small, we have complete logs. How can I troubleshoot to see what might have happened? Or is this a known bug in 9.0.5? Jay Levitt -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

[GENERAL] Learning to rephrase equivalent queries?

2011-11-10 Thread Jay Levitt
Sometimes the planner can't find the most efficient way to execute your query. Thanks to relational algebra, there may be other, logically equivalent queries that it DOES know how to optimize. But I don't know relational algebra. yet. (Date/Codd is a sleeping pill.) I need more experience fi

[GENERAL] find_psql_error

2011-10-14 Thread Jay Levitt
I got tired of this: psql:lib/sql/similarity.sql:97: ERROR: column o.user_id does not exist at character 426 So I wrote this: https://github.com/jaylevitt/find_psql_error And you call it like this: find_psql_error "psql:lib/sql/similarity.sql:97: ERROR: column o.user_id does not exist at ch