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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:08:33+00:00 2026-05-27T08:08:33+00:00

I have a big table (200’000’000 rows); declared like this thread( forum_id tinyint, thread_id

  • 0

I have a big table (200’000’000 rows); declared like this

 thread( forum_id tinyint, thread_id int, 
         date_first datetime, date_last datetime
         replycount mediumint, extra blob )

forum_id and thread_id are the primary key. With big forums (around a million of topics) i sometimes have to run queries like SELECT thread_id FROM thread ORDER BY date_last DESC LIMIT 500000, 10. These queries with huge offsets takes a second or maybe a few to run.

So i tought that i could, by duplicating data, create a few tables for the forums with most threads to speed this up. Only a few forums are over 100’000 topics, so there will be a table like

  thread_for_forumid_123456 ( thread_id int, 
         date_first datetime, date_last datetime
         replycount mediumint )

What do you think about this? Will it speed up huge offset queries? Do you have some other suggestions? Thanks.

  • 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-27T08:08:34+00:00Added an answer on May 27, 2026 at 8:08 am

    First, i will REALLY try to avoid your approach. I look at it as the “last chance” to avoid performance issues.

    You have alternatives (from hardware to software) on hard you can buy Fusion i/o or just an SSD drive (Raid vs SSD vs FusionIO). But, you can solve this using software and dont investing money at all.
    On your scenario you should use cache (i.e. memcached) if you aren’t already using it.
    MySQL have partitioning, its not the best choice in the world but, you can have some good performance increase.

    BUT, if you go with your idea, i suggest that you shard your data, using a value that split your data across tables more balanced.
    You can do something nasty like: create 50 tables like thread_0 to thread_49
    And then (forumid % 50) so you land on one of this 50 tables.
    That way you avoid to create a table everytime you create a forum, and you avoid to have N tables. And the select with forum_id indexed will be very fast.
    Also you can have some sort of logic on the app to manage pagination, and avoid huge offsets.

    Good luck!

    PS: I add a blogpost on MysqlPerfomanceBlog “Why you dont want to shard”

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

Sidebar

Related Questions

I have a table that looks something like this: word big expensive smart fast
I have this big table called StateChanges (1.9 million rows) from a third party
I have this big data-entry sort of page, a table kind of layout using
so I have this HTML table with a bunch of big numbers in it
I have a big table with vertical scroll bar. I would like to scroll
I have this problem. I have a big table with categories in THEAD and
I have a very big table with a lot of rows, every row has
I have one BIG table(90k rows, size cca 60mb) which holds info about free
I have this big table which I want to have fulltext search, so I
I have a big table containing a button in each cell. These buttons are

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.