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 6930189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:24:55+00:00 2026-05-27T11:24:55+00:00

My question: I have a mysql database that consists of something like a fact

  • 0

My question:
I have a mysql database that consists of something like a fact table (although not every field is a lookup) and a variety of other tables. When I want to display data from that “fact” table, is it necessary to run a query to each individual lookup or is there a way to make a temporary table that has already done the “looking up”?

Example:
Table structure –

  • unique_id(auto increment int),
  • model(int, lookup to table #2),
  • type(int, lookup from table #2 to table #3)
  • employee(int, lookup to table #4)
  • notes(text)
  • cost(float)
  • hours(float)
  • –

So for instance when I want to make a php page to enter this data it seems like a lot more “work” than it needs to be:

  • unique_id (not shown as a data entry field, increments automatically
    on submit)

  • model (drop down box. population requires query to table #2 where status = X)

  • type (read-only text box shows type of model. Requires query to table #3 based on column from table #2)

  • employee (drop down box. population requires query to table #4 where employee_status = “Active”)

  • notes (text box, user inputs related notes to submission)

  • cost (texts box, user enters costs related to submission)

  • hours (text box, user enters hours related to submission)

Just to get a simple form populated with valid data requires what seems to me like A LOT of queries/lookups.

Is this the best way? Is there a better way?

Aside: I have control over the data structure, so if the problem is the database design, then those suggestions would be helpful as well.

  • 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-27T11:24:56+00:00Added an answer on May 27, 2026 at 11:24 am

    Dimension tables typically don’t change very often, at least relative to the number of inserts to the fact table. Dimension tables are also individually much smaller than the fact table. This makes dimension tables good candidates for caching.

    What some people do to good effect is to render the partial HTML output for the form, with all the data populated as dropdowns, radiobuttons, etc. Then store that partial HTML under a memcached key so you don’t have to do any of the database queries or the HTML render for most PHP requests — you just fetch the pre-populated HTML fragment out of memcached and echo it verbatim. I think of this like the “Ikea” of database-driven output.

    Of course if you ever do change data in a dimension table, you’d want to invalidate the cached HTML, or even better re-generate it and store a new version of the HTML in memcached.

    Regarding doing all the lookups, I’ll point out that there’s no requirement to use pseudokeys in a fact table. You can use the natural values, and make them reference the primary key of the dimension table, which also can be a natural key instead of a pseudokey. It might take a bit more space in some cases, but it eliminates the lookups. Of course it may make sense to continue using pseudokeys for dimensions that are long varchars.

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

Sidebar

Related Questions

OK I have a mySQL Database that looks something like this ID - an
I have a MySQL database with two tables (simplified for this question): movies table
I have a MySQL 5 database that is updated every 5 minutes from a
I have data in an MYSQL database that looks like this: Project Date Time
I have a short access/mySQL question. I have a mapping table on the format
I have the same question as #1895500 , but with PostgreSQL not MySQL. How
Consider a database(MSSQL 2005) that consists of 100+ tables which have primary keys defined
So I have a database that is setup sort of like this (simplified, and
I have a mySQL database and I have a Perl script that connects to
I have a form that is sending data to a MySQL database and I

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.