Mysql using multiple databases

Posted on 2011-04-19
Last Modified: 2012-05-11
I am looking at parts of my application to access data from two separate databases.

I am just wondering what sort of resources this uses as I am trying to understand it better.

There is only a small amount of data in the other database it needs to access.  For system performance am I better to put the table and data into the one database?  I would prefer not to double up the same data into two databases if I can, but am interested in the performance side, especially if I have a large number of users on this, as hoped.

I would appreciate advice from an expert on this.
Question by:debbieau1
    LVL 7

    Accepted Solution

    I'm not an expert on here but do run hundreds of MySQL databases in various environments and have encountered this situation several times with client sites that I work on.

    If separate parts of your application will access the databases independently (e.g. Page A only interacts with Database A and Page B only interacts with Database B) then you should be fine.

    If a single part of your application needs to simultaneously query both databases and display data from both databases then you're best to import the table(s) from Database B into Database A and use joins (if necessary) to pull that data together into your application so it only has to query a single database.

    Querying two separate databases to populate a single document/page/view will take slightly more time, and it may not be noticeable initially, but may impact performance if this is a heavily queried document/page/view.
    LVL 1

    Author Closing Comment

    LVL 7

    Expert Comment

    You're welcome.  Thank you for taking the time to review my answer.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
    Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL ( several years ago, it seemed like now was a good time to updat…
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now