Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
Thread: Some help with indexing please?
03-26-2013, 01:19 PM #1
- Join Date
- Sep 2012
- Thanked 0 Times in 0 Posts
Some help with indexing please?
Hello. I am trying to understand indexing and i'm a bit stumped when it comes to joins.
I have two tables
A website table (Primary Key here is website_id)
A links table (Foreign Key here is website_id)
And every link in my links table belongs to a SINGLE website in the websites table so I perform a join on it
SELECT website.website_id, website.name, links.url FROM links INNER JOIN website ON website.website_id = links.website_id
Is that correct? If not what else would I need to index everything properly here in order to run the above query? Thank you
Last edited by Oatley; 03-26-2013 at 01:23 PM.
03-26-2013, 01:44 PM #2
- Join Date
- Dec 2005
- Thanked 76 Times in 76 Posts
Your key (explain) is also empty. You probably have not enought data so mysql would use any key. It fugures it is best to stash everythig into memory and does not use any key.
Users who have thanked BubikolRamios for this post:
03-26-2013, 09:10 PM #3
Bubikol is probably right, but if you want to, you could show us what EXPLAIN shows you. There is more info in the EXPLAIN that might confirm Bubikol's guess..or not.
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.