PDO vs MySQLi for silverstripe

Any thoughts on this?

Every time I do a new install I face this question. I’ve read the MySQLi is a hair faster but you have to stick with MySQL. Seems like PDO allows for flexibility. Once you set your database does it ever makes sense to change to a different one? Like MariaDB or similar.

Couple of other thoughts.

Does it make sense to have several databases on a SS website? For instance, if you had a section of a site with a massive amount of hierarchical info, e.g. the building code, would that type of data be better suited to a different database type? Like hadoop?

Or is one database and style sufficient?

I think you summed up the fist part of your question. PDO offers more flexibility. Changing the database backend once a site is installed is (in my experience) more likely to be driven by a change of hosting environment than anything else. There are certainly differences in backends, even between the ‘drop-in compatible’ options such as MySQL, MariaDB and Percona. They have subtle performance differences in different ways, but to be honest, if you are interested in that level of detail, then you probably would make those choices before you start.

Does it make sense to have several databases on a SS website? I’d say probably not, except for specialised applications. The ORM uses a lot of relational operations which depend on certain things to be present for normal operation.

That said, if you have (for example) a massive data set, or particular search criteria which don’t lend themselves to a relational database like MySQL, then it could make perfect sense to split that data out and access it via a different backend. It’s quite common to use Solr as a search system on SilverStripe, since its text searching abilities far outperform that which is available from something like MySQL or Postgres.

As with a lot of things like this, the short answer is, “there’s no short answer” :slight_smile:

Sweet, yea I read so much and I think it gets in the way! I mean, if a site became that big there’d be a team to change stuff if it needed to be right?

I’m just putzzin around, but it’s a lot of fun. Especially when you get through minor things that seem impossible, but are really nothing in the scheme of things.

PDO it is!