Why PostgreSQL
Or: How I Learned To Stop Worrying And Love The Database.
Timothy Johnson asks in the last post
Can you tell us why the switch from mySQL to postgre? I am not a db-guy (a ui designer) but I would like to hear from a switcher about the differences between the 2. ... Is postgre part of the logical progression? I have made all the same tool changes you have besides this one
I'm not really a "db-guy" either but this is why I switched:
- One of my projects needs a really good db with stored procedures. A friend who knows much more than I recommends Postgres.
- I dread installing, setting up, and learning yet another application,
- But, I download, install from source and have Postgres running in no time at all. Everything just works.
- I started looking at the documentation and ended up reading almost the entire thing. I can't explain it but the docs have a great quality. Simple, to the point, but with enough examples to get you going. (ok, I only read sections I-III, and skimmed the rest, but still...)
- I tell my wife "this is like, the Ruby of databases!"
- I start getting giddy when I find PL/Ruby and the possibility of writing stored procedures in Ruby
Like Ruby, it's the little things that impressed me. Example: having used MySQL for years and not known about the "references" syntax, I'm a little embarassed. But that's the point, Postgres got me to a better place in less time and hassle. Knowing that it's top-notch behind the scenes is icing on the cake, but right now it's more about that good feeling.
That said, I wouldn't really consider Postgres part of the logical progression. MySQL and others are equally good. There's tradeoffs, and I'm sure real db-guys could give you the lowdown.
Btw, if anyone has experience with PL/Ruby or knows where to find more information besides this page, please let me know!
Array#to_h
I found myself writing something like this far too often:
It bugged me every time, but digging through the Pick Axe never yielded (ahem) a simpler solution. What I wanted to do is this:
But of course you'd need
Array#to_h. Here's the cleverest implementation I could think of.A pointless example:
I love
Array#inject!