I've been working on a facebook application and I had this fleeting fantasy that all 300 million facebook users might suddenly want to use this ingenious thing. In the brief interval where that fantasy was in effect, I thought I might use a cloud data storage service like Amazon Simple DB.
This got me thinking about how I should abstract my db access in my php code so I googled "php mysql database abstraction layer". Interestingly, the first result was a rant against database abstraction.
I have encountered some pretty big differences between MySQL and PostgreSQL. The most salient one I remember being that MySQL implements an autoincrement feature whereas PostgreSQL has sequences. I'm still not clear on the difference between [man]mysql_last_insert_id[/man] and [man]pg_last_oid[/man].
And now Amazon Simple DB is something entirely different. AFAIK, the concept of indexes and autoincremented primary keys doesn't even apply. Simple DB also doesn't support joins.
I don't find myself needing to switch between PostgreSQL and MySQL ever. I do think I might switch between MySQL and Simple DB or some other cloud-type approach. Just wondering if anyone here has some magical approach toward abstracting data access or whether there have been any hard lessons learned.