Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4344148
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T11:51:19+00:00 2026-05-21T11:51:19+00:00

Currently I’m working off of a data set which is just redicolus; a flat

  • 0

Currently I’m working off of a data set which is just redicolus; a flat file from multiple vendors which has no rhyme or reason; and sits at about 200 columns.. There are 15 which are common between those 200, which I have pulled out into another table.

From the other 185 columns they are a mix of varchar’s, int’s datetime’s and multiple string values.

Right now I’m trying to decide how best to store these other 185 columns; as in a flat table currently it’s just proving to scale super poorly. I have two solutions setup, however I do not know which one is better.

One is storing the meta data for each of the columns in separate tables (seen in image) Image architecture

However it seems that using this method; it’s going to be very difficult if down the road I need to do queries on items which lie within here.

THe other method I’ve thought of is throwing all the columns into a table which has id, value, datatype, than when doing queries cast the value to the datatype ie:

 select * from foo where cast(col_to_query) as int < 5

however I’m not sure what the performance is like when doing things that way.

Question:

Which of these two methods would be better performance wise and which one would you recommend (or if there is a better option I would love to hear it).

Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T11:51:19+00:00Added an answer on May 21, 2026 at 11:51 am

    The first approach will scale even worse than a single table, and will be incredibly difficult to query to boot.

    I would suggest using a single table, with all the columns in it, as a starting approach. You said it scales poorly though. What do you mean by that? How is it scaling poorly? Are queries taking a long time to return? Have you indexed the table properly for your queries? The number of columns doesn’t often affect the time for queries to return significantly, other than if they’re returning a huge amount of data. If that’s the case, how you store it under the covers will have little effect on the query response time if all the time is being spent in transferring data between mysql and the client. Be sure that you’re only selecting the columns you care about if this is the case. Don’t do “select *”.

    Another option would be to use a table inheritance strategy. In this case, you would have one parent table that stores the 15 common attributes, and a “type” that would identify the type of records, based upon the file it came from, or you could call it the source. Then, create an extension table with a 1 to 0-1 mapping for each of the different files with the custom columns only for each specific file. This won’t perform as well as one large table most likely, as you’ll have to do joins, but it will help reduce the need for a whole bunch of columns on one table that are often null.

    This would look something like this:

    create table master (
      master_id int not null auto_increment primary key,
      type int,
      <field1> int,
      <field2> varchar(20),
      ...
    );
    
    create table file1_data (
      master_id int not null primary key,
      type int,
      <field16> int,
      <field17> varchar(20),
      ...
    );
    

    Query it like this:

    select , , …
    from master
    inner join file1_data
    on file1_data.master_id = master.master_id
    where …

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently I'm doing some unit tests which are executed from bash. Unit tests are
Currently I know of only two ways to cache data (I use PHP but
I want use html5's new tag to play a wav file (currently only supported
I am currently running into a problem where an element is coming back from
I want to have generalised email templates. Currently I have multiple email templates with
Currently, I don't really have a good method of debugging JavaScript in Internet Explorer and
Currently my workflow with Emacs when I am coding in C or C++ involves
Currently we have a hybrid ASP/PHP setup connecting to a SQL Server 2005 database.
Currently we have a project with a standard subversion repository layout of: ./trunk ./branches
Currently, I am writing up a bit of a product-based CMS as my first

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.