1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Pros and Cons of same DB for other application

Discussion in 'General PHP and MySQL Discussions' started by ibaker, Aug 13, 2014.

  1. ibaker

    ibaker Well-Known Member

    I run XF and also an online store using CS-Cart. I was wondering what were the pros and cons of having 2 separate databases, 1 for XF and 1 for the shop, OR, having the one database that has both XF and shop tables in it...the shop has around 190 tables and is only 10 to 20 mb in size yet my XF database is 600 meg in size.

    It may not matter but I am using Percona, a MySQL drop in.

    The shop currently has a separate user registration and login however I may be looking at using a function that will provide a single registration and login system on both...costly but I say "may" do it.

    I will have the shop installed in a sub folder of XF and currently use a widget embedded into an XF page for the shop...see here:
    Last edited: Aug 13, 2014
  2. AndyB

    AndyB Well-Known Member

    I suggest keeping the database different.
    kingofseo, Daniel Hood and MattW like this.
  3. Daniel Hood

    Daniel Hood Well-Known Member

    That's so close to a pro/con list ;)

    I think the biggest con is that if there happens to be a security breach in either system then it compromises both systems data, as opposed to just one. The only real pro I see is that you can have both systems access each others data without creating a separate database connection (not a huge deal).

    I do agree with @AndyB about keeping them separate despite me giving him a hard time.
  4. ibaker

    ibaker Well-Known Member

    Thanks Daniel
  5. AndyB

    AndyB Well-Known Member

    In addition to Daniel's post.


    1) It's easier to find tables and information in the tables when using phpMyAdmin.
    2) Being able to restore just one database instead of having to restore both.


    1) Must create two backup Crons.
  6. Ridemonkey

    Ridemonkey Well-Known Member

    I don't see many pros to storing multiple table sets with different prefixes inside the same DB.

    As mentioned, it requires two backup jobs to separate them, but you get increased security and increased flexibility by being able to use independent login details and retaining your ability to modify one database without modifying the other. You can do this by modifying/backing up/restoring tables individually but it's far more of a pain to do it that way.

    Combining them doesn't really improve integration in any way since just having the data side-by-side doesn't allow the datasets to interact. You'll still have to build the integration functionality, and you can just as easily do that between two databases as within the same database.
  7. Jim Boy

    Jim Boy Well-Known Member

    Unless you are talking about having the two sets of data on separate mysql instances, then performance wise, you wont see any difference. Security - having separate database will offer some protection if you set user privileges properly. That is users that are restricted to their own database. If you dont do this, if you get hacked in one system, then both systems will be compromised. Where integration is needed between two system, use fine-grained controls so that trhe relevant database user only has access to what they need, preferably with "SELECT' only permission. The other main thing is that it becomes more of a pain working out what is what, whilst XF tables will default to having and 'xf_' prefix, many add-ons do not. If you ever decide to separate the databases later, you'd likely miss something along the way.
  8. Moscato

    Moscato Active Member

    For combining
    Shared hosting with a database limit can be bypassed (this is a dirty reason)
    One backup cron job
    Disaster recovery

    Just don't do it

Share This Page