It is of course possible in a custom modules to use two different databases (and I mean different databases not different RDBMSs!), but is there a way to use two different databases, and then force Drupal to keep certain data in one and other data in the other?

For instance, keep nodes (and closely related tables) in one, and all site configuration in another. (Perhaps, while sorting it out, it might be useful to have a third as the default. That way everything that's not sorted into either the content or the configuration database would remain in the default until you decided where it best fit.)

How can this be done, without major hacking of Drupal's core?

2 Answers 2


If it's not possible at the Drupal level, this might be possible at the MySQL level using the FEDERATED storage engine. This is a thoroughly untested solution, however, and it might not play nice with Drupal.

  • 3
    Please keep in mind that the FEDERATED storage engine can only attach to MyISAM tables, and not InnoDB. If you can setup replication and restrict writes to a Master (with all tables InnoDB) and reads to Slaves, you could convert all tables on Slaves to MyISAM and then test this read/write splitting. FEDERATED tables would not be needed. +1 for this answer's outside-the-box thinking. Commented Nov 14, 2012 at 18:13

Sadly, without core hacking (and a lot of it), you can't accomplish this. And, even if you could, other third party modules would expect tables to be in the default database.

I suppose, an 'easy' trick would be to put a switch in the db_query function and base it on the table name. But that is still a hack and I have a feeling will cause more trouble than it is worth.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.