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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T00:19:54+00:00 2026-05-20T00:19:54+00:00

There are a few other questions about this error, but I’m having a hard

  • 0

There are a few other questions about this error, but I’m having a hard time getting my head around this issue.

I’m trying to make a very basic MySQL table. I’m attempting to keep everying thing in utf8, which I do understand takes more bytes than a normal char set.

CREATE TABLE `bibliography` (
  `id` int(5) unsigned zerofill NOT NULL,
  `pub_type` varchar(5) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `pub_genre` varchar(5) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `title` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `author_first` varchar(5) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `author_last` varchar(5) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `publication` varchar(5) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `pub_date` date NOT NULL,
  `pub_city` varchar(5) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `pub_country` varchar(5) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `html` text NOT NULL,
  `live` int(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `pub_type` (`pub_type`,`pub_genre`,`title`,`author_first`,`author_last`,`publication`,`pub_date`,`pub_city`,`pub_country`),
  KEY `live` (`live`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

Okay, so above works, but obviously I can’t live 5 character author names. When I try to raise the limit:

ALTER TABLE `bibliography` CHANGE `author_first` `author_first` VARCHAR( 50 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL 

I get the error:

1071 – Specified key was too long; max key length is 1000 bytes

So, I don’t get it. Does the 1000 byte limit apply across the whole table? Obviously it does, right?

In light of the answers, can someone enlighten me on the difference between setting up an index like:

KEY `live` (`live`),
  KEY `pub_type` (`pub_type`),
  KEY `pub_genre` (`pub_genre`),
  KEY `author_last` (`author_last`),
  KEY `publication` (`publication`) 

and like:

KEY `pub_type` (`pub_type`,`pub_genre`,`title`,`author_first`,`author_last`,`publication`,`pub_date`,`pub_city`)

I’m starting to understand here, that the KEY is limited to 1000 bytes. But you can have multiple keys in a table. How is combining a bunch of fields into one key different form assigning a key to each different field?

  • 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-20T00:19:55+00:00Added an answer on May 20, 2026 at 12:19 am

    No, it doesn’t apply across the whole table. But, you’re using a unicode field that needs up to 3 bytes per character, so a key that includes a VARCHAR(50) unicode field translates to 150 bytes in MySQL. So, your total is:

    KEY `pub_type` (
        `pub_type`, 5
        `pub_genre`, 5
        `title`, 255
        `author_first`, 5
        `author_last`, 5
        `publication`, 5
        `pub_date`, 3 bytes
        `pub_city`, 5
        `pub_country`5 
    )
    

    = 7*5 + 255 = 290 * 3 = 870 + 3 = 873 bytes.
    You only have 1000 - 873 = 127 bytes to expand, which translates to about 127 / 3 = 42 more characters you can expand your fields by. Not a safe bet.

    You’re using indices (keys) wrong. There’s no point in having an index on every field. If you’re trying to speed up your query, only include the fields that are most often used in your WHERE clause.

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

Sidebar

Related Questions

There have been a few articles and questions about how to do this but
First of all, I know there are a few other StackOverflow questions about this
I know there are a few questions about this but i just cant seem
I realize there are a few other questions about why Cygwin is apparently slow,
I realize there have been a few other questions on this topic, and the
There are some other SO questions about concurrency but they don't quite address my
I have TPanel. On this Panel there is an TImage descendant , few other
I'm having a hard time undestand a couple of the methods in UIViewController, but
First off, I'm aware that there are many questions related to this, but none
I know how to use locks in my app, but there still few things

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.