2

How does Grails handle indexing in the database? I feel like if I try to do something like Person.findByName("KPthunder") it is going to have to search through all the records given that there is no index on the name field.

Do we have to add indexes to the columns we want to search through after grails makes the database?

All my searches are turning up are things about Grails index actions on controllers (including a search through my PDF copy of "Grails: A Quick Start Guide." I feel like I am overlooking something incredibly simple here...

1 Answer 1

4

Yes, we need to add indexes explicitly. They will definitely be used by DBMS, when appropriate.

Sign up to request clarification or add additional context in comments.

4 Comments

It doesn't appear to make a difference but I hunted down that chapter number in the latest documentation: grails.org/doc/latest/guide/… Database Indices
Grails 2.1.1, MySQL 5.5 - a table has been auto recreated; still has no index.
@Pavel Vlasov, what do you mean? Do you have the indexes declared in domain class?
@Pavel Vlasov, will you pllease make it more clear. If that's your downvote, then I have a feeling you downvoted without actually following the answer.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.