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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:21:21+00:00 2026-05-22T22:21:21+00:00

I am experimenting with mysql partitioning ( splitting the table up to help it

  • 0

I am experimenting with mysql partitioning ( splitting the table up to help it scale better ), and I am having a problem with the keys on the table. First, I am using a python’s threaded comments module… here is the schema

+-----------------+------------------+------+-----+---------+-------+
| Field           | Type             | Null | Key | Default | Extra |
+-----------------+------------------+------+-----+---------+-------+
| content_type_id | int(11)          | NO   | MUL | NULL    |       |
| object_id       | int(10) unsigned | NO   |     | NULL    |       |
| parent_id       | int(11)          | YES  | MUL | NULL    |       |
| user_id         | int(11)          | NO   | MUL | NULL    |       |
| date_submitted  | datetime         | NO   |     | NULL    |       |
| date_modified   | datetime         | NO   |     | NULL    |       |
| date_approved   | datetime         | YES  |     | NULL    |       |
| comment         | longtext         | NO   |     | NULL    |       |
| markup          | int(11)          | YES  |     | NULL    |       |
| is_public       | tinyint(1)       | NO   |     | NULL    |       |
| is_approved     | tinyint(1)       | NO   |     | NULL    |       |
| ip_address      | char(15)         | YES  |     | NULL    |       |
| id              | int(11)          | YES  |     | NULL    |       |
+-----------------+------------------+------+-----+---------+-------+

Note, I have modified this database by dropping the id col (primary by default), and re adding it.

Essentially, I want to have id AND content_type_id as my primary keys. I also want id to auto increment. Is this possible.

Second question. Since I am just learning about mysql partitioning, I am wondering if my partitioning logic is sound. There are 67 different content_types, and some (maybe all) of those content types allow comments to be made on them. My plan is to partition based on the type of object that is being commented on. For instance, the images will be commented on a lot, so I put any content type pertaining to images into one partition, and another content type that can be commented on is “blog entries”, so there is a separate partition for that, and so on and so on. This will allow me to spread these partitions possibly to dedicated machines as the load grows. How is my understanding of this concept so far?

Thanks so much!

  • 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-22T22:21:22+00:00Added an answer on May 22, 2026 at 10:21 pm

    Since id will be auto incremented, it can be the primary key all by itself. Adding content_type to the primary key would not gain you anything in regards to the uniqueness of the key.

    If you want to add an index for faster performance to the 2 columns, then add an alternate unique index to the table with the 2 columns instead of trying to add them both to the primary key. However, be aware that enforing uniqueness on the 2 columns would be a waste since id is already guaranteed to be unique by itself, so a regular index would make more sense if needed.

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

Sidebar

Related Questions

I'm experimenting with Linq and am having trouble figuring out grouping. I've gone through
I'm a SQL Server guy experimenting with MySQL for a large upcoming project (due
I'm working on building a tree structure in MySQL and have been experimenting with
(Using MySQL and PHP) I have a search form that will allow my users
I spent the day experimenting with AWS for the first time. I've got an
what im experimenting is the next: S:\proj>manage.py shell Python 2.5.4 (r254:67916, Dec 23 2008,
I'm experiencing this weird problem reading data from a table called nodes. Any select
I'm experimenting with an ASP.NET MVC 3 site, using razor as the view-engine. I
I'm experimenting with a custom LayoutManager and I don't understand the subtleties of using
While experimenting with this question on collections in Spring.NET , I discovered that Spring

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.