www.webdeveloper.com
Results 1 to 2 of 2

Thread: Best approach to relating databases or tables?

  1. #1
    Join Date
    Jul 2008
    Location
    Bristol
    Posts
    76

    Best approach to relating databases or tables?

    Hello everyone,

    How are all you fellow programmers on this fine "Monday" morning?

    I wonder if anyone can help with a database dilemma that I am having please?

    DB: MySQL 5
    Platform: Ubuntu

    I would really appreciate some advice on the correct avenue to take with a project I am working on.

    What I have:
    *I have a database that maintains a large table of articles. (similar to wordpress).
    *I intend to relate a given article to another set of data. This set of data will be fairly huge.
    *There maybe various sets of data that will be related.

    The query:
    * Is it better to contain these various large sets of data within the same database of articles, which will have a large set of traffic on it.
    OR
    * Is it better to create different databases (on the same server) that relate by a primary key to the main database with the articles.



    I didn't want to plough ahead with this without getting some advice or opinion from the community.

    I really appreciate anyone who takes the time to offer some thought on the matter.

    Many thanks

    Michael

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    18,936
    I don't think a separate database on the same server gains you anything, while adding extra complexity. At the most you should just need a separate table within the same DB. If there is a one-to-one relationship between article and "extra data", it should not even hurt to have it in the same table, as long as your queries which to not utilize that extra data do not select all columns ("*") and thus retrieve bytes you don't need.

    If there is a one-to-many or many-to-many relationship, then you'll want a second table with a foreign key relation, or in the latter case a third table to define the relationships.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles