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

  • Home
  • SEARCH
  • 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 6536925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:33:20+00:00 2026-05-25T10:33:20+00:00

Now the proposed table structures are:- data_table ->impressions ->clicks ->ctr OR data_table_1 ->ctr data_table_2

  • 0

Now the proposed table structures are:-

data_table
->impressions
->clicks
->ctr

OR

data_table_1
->ctr

data_table_2
->impressions
->clicks

What queries are executed?
There are about 500 updates per second for the impressions. There is about 1 update for clicks every second. There are about 500 updates per second for the ctr.

Now my application sorts the data using the ctr. The ctr is the click through rate which is worked out by ctr = clicks/impressions. Now I have realised that unless there is a click update the ctr doesn’t need to updated as all the impressions for articles are being increased which is decreasing the ctr in the same relationship, so unless there is a click the ctr does not need to be updated.

Currently the update query is like “UPDATE data_table SET impressions = impressions + 1, ctr = clicks / impressions WHERE something = something

This means that although 2 fields are updated at once only 1 query is executed.

Now the bottleneck is that these 500 updates on this causing slow down on selects on this table. There are about 20 selects per second. So I thought of separating the tables. The new table style proposes that the updates happen on a separate table and the selects happen on a separate table. The data table that contains the impressions is updated very frequently so having the updates for the impressions performed on it really speeds up the performance on this table. This means that the selects on the data_table_2 will be faster too and the ctr can be updated every time someone makes a click.

So, I just wanted to know if I should use the new table structure or not. What are you suggestions? Pros and Cons of my proposals!

  • 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-25T10:33:20+00:00Added an answer on May 25, 2026 at 10:33 am

    Maybe this is not a direct answer to your question, but i think it’s important to be noted.

    I think you should consider using nosql databases like Redis, MemcacheDB, MongDB, CouchDB. Relatational DBMS are not well suitable for this kind of use. For example, every time you update any column (UPDATE data_table SET impressions = impressions + 1) the caches are erased, and the DB has to hit the disk.

    Other think you can consider is using Memcache and bulk that data to disk after some period of time.

    For example, if you can afford to loose some impresions (remember that memcache does not persist data) you can do the impresions++ in memcache and update data in the DB every 5 minutes. It would decrease your load significantly.

    I hope it helps you.

    EDIT:

    Storing CTR is a good idea, it’s called “Denormalization”, and may work in your application if it’s a frequently required value.

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

Sidebar

Related Questions

Now that it's clear what a metaclass is , there is an associated concept
Now that everyone is talking about MVC, I notice that the business rules are
I've been programming in Java for about 4 years now, but what I've learned
I have a table that contains a text field, there is around 3 to
Now there are three options that I have in my mind. 1st -> four
I´ve to do several inserts into one table. Now, I´ve a list of objects
Now that most of the major browsers support full page zoom (at present, the
Now that I know C++ I want to get into desktop application that have
Now that LINQ to SQL is a little more mature, I'd like to know
Now that .NET v3.5 SP1 has been released (along with VS2008 SP1), we now

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.