Timeline for Junction table or denormalize?
Current License: CC BY-SA 4.0
13 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 28, 2022 at 0:46 | comment | added | user2402616 |
Looks like it's SHOW INDEXES FROM for maria. imgur.com/a/SCIAU0X is what it looks like for me
|
|
May 28, 2022 at 0:43 | comment | added | Rick James | That looks like a well-indexed many-to-many (junction) table. | |
May 28, 2022 at 0:42 | history | edited | Rick James | CC BY-SA 4.0 |
from comment
|
May 28, 2022 at 0:40 | comment | added | user2402616 |
CREATE TABLE provsub ( provider_id int(11) NOT NULL, subscriber_id int(11) NOT NULL, created timestamp NOT NULL DEFAULT current_timestamp(), updated timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (provider_id ,subscriber_id ), KEY subscriber_id (subscriber_id ), CONSTRAINT provsub_ibfk_1 FOREIGN KEY (provider_id ) REFERENCES providers (id ), CONSTRAINT provsub_ibfk_2 FOREIGN KEY (subscriber_id ) REFERENCES subscribers (id ) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 |
|
|
May 27, 2022 at 21:36 | comment | added | Rick James |
Provide SHOW CREATE TABLE ... to see what secondary indexes exist. Also SHOW INDEXES FOR ...
|
|
May 27, 2022 at 21:27 | comment | added | user2402616 | I was able to create the table without any issues in Maria. I was able to query JOINs too. Haven't tested it if automatically creates rows when any X or Y is created though | |
May 27, 2022 at 21:11 | comment | added | Rick James | megocode3's link does not seem to apply to MySQL. | |
May 27, 2022 at 20:31 | comment | added | user2402616 | I had already created it using the method outlined on...megocode3.wordpress.com/2008/01/04/… Seems like a similar way..although it looks like it doesn't have the second index for doing "y to x" | |
May 21, 2022 at 2:11 | comment | added | Rick James | Be sure to index the junction table as described here: Many-to-many | |
May 15, 2022 at 21:02 | vote | accept | user2402616 | ||
May 15, 2022 at 2:45 | answer | added | J.D. | timeline score: 2 | |
S May 14, 2022 at 16:45 | review | First questions | |||
May 14, 2022 at 17:25 | |||||
S May 14, 2022 at 16:45 | history | asked | user2402616 | CC BY-SA 4.0 |