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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T14:26:15+00:00 2026-05-10T14:26:15+00:00

I have a large database of normalized order data that is becoming very slow

  • 0

I have a large database of normalized order data that is becoming very slow to query for reporting. Many of the queries that I use in reports join five or six tables and are having to examine tens or hundreds of thousands of lines.

There are lots of queries and most have been optimized as much as possible to reduce server load and increase speed. I think it’s time to start keeping a copy of the data in a denormalized format.

Any ideas on an approach? Should I start with a couple of my worst queries and go from there?

  • 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. 2026-05-10T14:26:16+00:00Added an answer on May 10, 2026 at 2:26 pm

    I know more about mssql that mysql, but I don’t think the number of joins or number of rows you are talking about should cause you too many problems with the correct indexes in place. Have you analyzed the query plan to see if you are missing any?

    http://dev.mysql.com/doc/refman/5.0/en/explain.html

    That being said, once you are satisifed with your indexes and have exhausted all other avenues, de-normalization might be the right answer. If you just have one or two queries that are problems, a manual approach is probably appropriate, whereas some sort of data warehousing tool might be better for creating a platform to develop data cubes.

    Here’s a site I found that touches on the subject:

    http://www.meansandends.com/mysql-data-warehouse/?link_body%2Fbody=%7Bincl%3AAggregation%7D

    Here’s a simple technique that you can use to keep denormalizing queries simple, if you’re just doing a few at a time (and I’m not replacing your OLTP tables, just creating a new one for reporting purposes). Let’s say you have this query in your application:

    select a.name, b.address from tbla a  join tblb b on b.fk_a_id = a.id where a.id=1 

    You could create a denormalized table and populate with almost the same query:

    create table tbl_ab (a_id, a_name, b_address);  -- (types elided) 

    Notice the underscores match the table aliases you use

    insert tbl_ab select a.id, a.name, b.address from tbla a join tblb b on b.fk_a_id = a.id  -- no where clause because you want everything 

    Then to fix your app to use the new denormalized table, switch the dots for underscores.

    select a_name as name, b_address as address  from tbl_ab where a_id = 1; 

    For huge queries this can save a lot of time and makes it clear where the data came from, and you can re-use the queries you already have.

    Remember, I’m only advocating this as the last resort. I bet there’s a few indexes that would help you. And when you de-normalize, don’t forget to account for the extra space on your disks, and figure out when you will run the query to populate the new tables. This should probably be at night, or whenever activity is low. And the data in that table, of course, will never exactly be up to date.

    [Yet another edit] Don’t forget that the new tables you create need to be indexed too! The good part is that you can index to your heart’s content and not worry about update lock contention, since aside from your bulk insert the table will only see selects.

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

Sidebar

Related Questions

I have a large database and would like to select table names that have
I have a large database of users (~200,000) that I'm transferring from a ASP.NET
I have to dump a large database over a network pipe that doesn't have
If I have large articles that need to be stored in a database, each
I have a large ADO.Net dataset and two database schemas (Oracle) with different constraints.
I have a database table with a large number of rows and one numeric
I have large data sets (10 Hz data, so 864k points per 24 Hours)
I have large batches of XHTML files that are manually updated. During the review
I'm developing a website in PHP and I have large JS files that I
I'm looking to introduce some database denormalization to a heavily normalized system. I have

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.