Answer the question
In order to leave comments, you need to log in
How to properly set up indexes?
Let's say there are tables:
users
id, email, ...
articles
id, user_id, ...
ALTER TABLE `articles`
ADD PRIMARY KEY (`id`),
ADD KEY `fk_client_id` (`user_id`) USING BTREE;
ALTER TABLE `articles`
ADD CONSTRAINT `articles_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question