Large database

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Michi

    #1

    Large database

    Hello!

    I am in the process of designing a large scale MySQL database. I
    expect anywhere from 10 to 100 thousand entries in the main user
    table. While that is not very many in terms of MysQL, I am still
    concerned about overhead that I may be building into my application.
    The main user table is necessarily large (in terms of numbers of
    columns).

    The problem is that my application has two components. The side that
    users see only requires queries of about 5 fields from the user table.
    However, there is a backend that will be scanning up to 40 user
    related fields. So assuming both of these things happen equally often,
    which of the two following scenarios is better: Having one large 40
    column table or having one small 5 column user table and a 35 column
    secondary table.

    Example:
    Process 1: Selecting 5 fields out of a table with 40 columns versus
    selecting 5 fields out of a table of 5 entries
    Process 2: Selecting 40 fields out of a table of 40 columns versus
    selecting 40 fields out of a table of 5 entries joined with a table of
    35 entries.

    I couldn't find a straight answer to this question, and I was hoping
    someone could help. =)
  • Jeff North

    #2
    Re: Large database

    On 25 Sep 2004 20:17:44 -0700, in mailing.databas e.mysql
    starfish0226@ho tmail.com (Michi) wrote:
    [color=blue]
    >| Hello!
    >|
    >| I am in the process of designing a large scale MySQL database. I
    >| expect anywhere from 10 to 100 thousand entries in the main user
    >| table. While that is not very many in terms of MysQL, I am still
    >| concerned about overhead that I may be building into my application.
    >| The main user table is necessarily large (in terms of numbers of
    >| columns).
    >|
    >| The problem is that my application has two components. The side that
    >| users see only requires queries of about 5 fields from the user table.
    >| However, there is a backend that will be scanning up to 40 user
    >| related fields. So assuming both of these things happen equally often,
    >| which of the two following scenarios is better: Having one large 40
    >| column table or having one small 5 column user table and a 35 column
    >| secondary table.
    >|
    >| Example:
    >| Process 1: Selecting 5 fields out of a table with 40 columns versus
    >| selecting 5 fields out of a table of 5 entries
    >| Process 2: Selecting 40 fields out of a table of 40 columns versus
    >| selecting 40 fields out of a table of 5 entries joined with a table of
    >| 35 entries.
    >|
    >| I couldn't find a straight answer to this question, and I was hoping
    >| someone could help. =)[/color]

    Show us the create statement of the table.
    ---------------------------------------------------------------
    jnorth@yourpant sbigpond.net.au : Remove your pants to reply
    ---------------------------------------------------------------

    Comment

    • Aggro

      #3
      Re: Large database

      Michi wrote:
      [color=blue]
      > which of the two following scenarios is better: Having one large 40
      > column table or having one small 5 column user table and a 35 column
      > secondary table.[/color]

      Does the 5 column table and 35 column table have both 1 row that matches
      only 1 row in another table? If so, I bulieve it's better to keep them
      in the same table. This is also logically better solution.

      AFAIK if you select only 5 columns from a table that has 40 columns, is
      equally fast to selecting 5 columns from table that has 5 columns,
      assuming the tables have same structure and indexing for those columns
      and have equal amount of rows. Even if you select 40 columns instead of
      5, the speed loss is quite small in my experience.

      Comment

      Working...