Hacker News new | ask | show | jobs
by cpburns2009 664 days ago
There's a few gotchas.

1. Stored procedures are not automatically in an SCM. It takes good discipline to make sure they're properly committed, and synchronized with your databases.

2. Don't try to do too much with one view or query in general. This has bitten me many times. Don't be afraid to split-up a query. That can simply be a few separate queries, or creating a temporary table that's built up over multiple steps. It's more work up front, but the increased performance can be necessary.

I've come to adopt creating temporary stored procedures in my processes when I needed them. I find that's a nice balance when complex processing is more efficient and convenient to do in PostgreSQL rather than a round trip to Python.