Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

SQL - Index  RSS feed

 
Abder-Rahman Ali
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Regarding "Index" in SQL, I searched on the Internet and understood the theoretical part that it is like searching in a library, that instead of searching the whole library for a specific book, by indexing, we can search for the book by its first letter (i.e; Books that begin with the letter "A"), which in this case makes the search much faster.

But, I didn't understand the technical point here.

Say I create an index like this:



What is the preceding line trying to tell me? Maybe the answer will be that I want to search by "coindex", but what is really confusing me is that WHEN will I use indexing. I'm not making any search, so, WHERE can I feel "index" in my SQL command.

Thank you very much.

 
James Ward
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


In the above SQL, we are searching on coindex column. If an index exists on that column it will be used automatically by database to search, thereby giving us quick results.
 
Abder-Rahman Ali
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
James Ward wrote:

In the above SQL, we are searching on coindex column. If an index exists on that column it will be used automatically by database to search, thereby giving us quick results.


Oh, I see, that makes sense.

Thank you so much.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!