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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T21:45:30+00:00 2026-05-16T21:45:30+00:00

Is it possible to partition based on char column? After reviewing the MySQL 5.1

  • 0

Is it possible to partition based on char column?

After reviewing the MySQL 5.1 documentation it appears that only integer types can be used.

Is this correct? Or can I use some function to convert the char into an integer?

The char field in question contains a unique identifier.

  • 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-16T21:45:31+00:00Added an answer on May 16, 2026 at 9:45 pm

    Partitioning in MySQL 5.1 can only deal with integer columns (Source). You can only use a few partitioning functions on non-integer columns. For example:

    CREATE TABLE ti (id INT, amount DECIMAL(7,2), tr_date DATE)
       ENGINE=INNODB
       PARTITION BY HASH( MONTH(tr_date) )
       PARTITIONS 6;
    

    You can also use key partitioning in MySQL 5.1, as long as the primary key includes all the columns in the table’s partitioning function:

    CREATE TABLE k1 (
       id CHAR(3) NOT NULL PRIMARY KEY,
       value int
    )
    PARTITION BY KEY(id)
    PARTITIONS 10;
    

    On the other hand, in MySQL 5.5, you can use range column partitioning or list column partitioning on a wide variety of data types, including character-based columns.

    List Columns Example:

    CREATE TABLE expenses (
       expense_date DATE NOT NULL,
       category VARCHAR(30),
       amount DECIMAL (10,3)
    );
    
    ALTER TABLE expenses
    PARTITION BY LIST COLUMNS (category)
    (
       PARTITION p01 VALUES IN ('lodging', 'food'),
       PARTITION p02 VALUES IN ('flights', 'ground transportation'),
       PARTITION p03 VALUES IN ('leisure', 'customer entertainment'),
       PARTITION p04 VALUES IN ('communications'),
       PARTITION p05 VALUES IN ('fees')
    );
    

    Range Columns Example:

    CREATE TABLE range_test (
       code CHAR(3),
       value INT
    )
    PARTITION BY RANGE COLUMNS(code) (
       PARTITION p0 VALUES LESS THAN ('MMM'),
       PARTITION p1 VALUES LESS THAN ('ZZZ')
    );
    

    Further reading:

    • MySQL 5.1 Reference Manual :: Key partitioning
    • A deep look at MySQL 5.5 partitioning enhancements
    • MySQL 5.5 Reference Manual :: Range columns partitioning
    • MySQL 5.5 Reference Manual :: List columns partitioning
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to partition a table using 2 columns instead of only 1
Is it possible to add a identity column to a GROUP BY so that
Is it possible to recover from a network partition in an mnesia cluster without
In SQL Server is it possible to perform table partition without having to recode
Possible Duplicate: Yield In VB.NET In C#, when writing a function that returns an
I have a SQL query that does some ranking, like this: SELECT RANK() OVER(PARTITION
I've written a QuickSort algorithm based off pseudo-code that I had been given. I've
I have a mapper that, while processing data, classifies output into 3 different types
Is it possible to partition of list box into several columns. If yes which
Is it possible to apply multiple window functions to the same partition? (Correct me

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.