I have a main MySQL db set up, and a class to handle the queries to it. It runs real nice. I am building a custom advertising system on my site and I’m wondering if there is any benefit to creating a separate database all together to handle that system?
Is there any pitfalls to doing it either way?
Option #1 – one DB for main website function, one DB for advertising system
Option #2 – one DB for both main website function and advertising system
Well, you need a new connection for every Database you use, also you need a new instance of your DB-Class – both costs some (minimal) memory. I personally see no reason why you would need/want to do this. If you just want to separate the two things, maybe you could use a prefix like “adv_” for the advertisement tables.
Edit: another problem could come up if you ever want to combine (e.g. join) data of the two databases – you will have a much easier time if you do not use multiple databases.