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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:17:43+00:00 2026-05-31T09:17:43+00:00

I’ve created a table with a unique index as well as a foreign index.

  • 0

I’ve created a table with a unique index as well as a foreign index. When I add the unique key I get a success response from MySQL. Then, when I add the foreign key I also get a success response.

Here’s the SQL for adding the foreign key:

ALTER TABLE `rewards_customer_index_points` 
ADD CONSTRAINT FOREIGN KEY FK_CUSTOMER_INDEX_POINTS_CUSTOMER_ID(  `customer_id` ) 
REFERENCES  `customer_entity` (  `entity_id` ) 
ON DELETE CASCADE 
ON UPDATE CASCADE

However, I’m not seeing that foreign key on the table, so it seems like it’s not being created successfully. But it’s definitely there, b/c the cascade works when I delete the referenced customer_entity record.

Why isn’t it showing in my index list? Both tables are InnoDB.

Here is the table structure and keys on the table:

mysql> explain rewards_customer_index_points;
+-----------------+------------------+------+-----+-------------------+-----------------------------+
| Field           | Type              | Null | Key | Default           | Extra                           |
+-----------------+------------------+------+-----+-------------------+-----------------------------+
| index_points_id | int(10) unsigned | NO   | PRI | NULL              | auto_increment              |
| customer_id     | int(10) unsigned | NO   | MUL | NULL              |                             |
| status          | int(11)          | NO   |     | 0                 |                             |
| points_positive | int(11)          | NO   |     | NULL              |                             |  
| points_negative | int(11)          | NO   |     | NULL              |                             |
| updated_at      | timestamp        | NO   |     | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
+-----------------+------------------+------+-----+-------------------+-----------------------------+


show index from rewards_customer_index_points;
+-------------------------------+------------+------------------------+--------------+-----------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table                         | Non_unique | Key_name               | Seq_in_index | Column_name     | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment     | Index_comment |
+-------------------------------+------------+------------------------+--------------+-----------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| rewards_customer_index_points |          0 | PRIMARY                |            1 | index_points_id | A         |           2 |     NULL | NULL   |      | BTREE      |         |               |
| rewards_customer_index_points |          0 | idx_customer_id_status |            1 | customer_id     | A         |           2 |     NULL | NULL   |      | BTREE      |         |               |
| rewards_customer_index_points |          0 | idx_customer_id_status |            2 | status          | A         |           2 |     NULL | NULL   |      | BTREE      |         |               |
+-------------------------------+------------+------------------------+--------------+-----------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
  • 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-31T09:17:44+00:00Added an answer on May 31, 2026 at 9:17 am

    In MySQL land a foreign key is not an index, and won’t show up in the list of indexes. MySQL’s original vision didn’t include foreign key table relationships, it only included per-table indexes to improve select performance improvements.

    InnoDB was originally a third party “extension” (not sure of the right term in MySQL speak) that added less speedy, but more compliant tables that included foreign key relationships. Because they were never part of the original vision, they were never incorporated into the show index or describe table commands.

    Checkout this older question for some ways to get a list of foreign keys on a table. Your choices are a slow query to the information_schema, or parsing the results of a SHOW CREATE TABLE command.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have an MVC Razor view @{ ViewBag.Title = Index; var c = (char)146;
I am currently running into a problem where an element is coming back from

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.