Do I need to create indexes on foreign keys?

I have a table A and a table B. A has a foreign key to B on B's primary key, B_ID.

For some reason (I know there are legitimate reasons) it is not using an index when I join these two tables on the key.

Do I need to separately create an index on A.B_ID or should the existence of a foreign key provide that?

Answers


The foreign key constraint alone does not provide the index - one must (and should) be created.


Need Your Help

Chrome Extension Ajax Request

jquery ajax json google-chrome-extension

I am a newbie and working on a google-chrome extension, that needs to make jquery ajax requests to a server, load some html documents . My server is Apache, running on localhost using XAMPP 1.7.3. ...

Radio button creation from jquery

jquery asp.net-mvc json

Radio buttons are not working properly.In first part a dropdown list is created from controller and on change of dropdown item a list is returned in $.json, i want to show each list item as a radio

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.