I have this query in my rails application where I get the name
of the Books
.
Book.where(:name => @name_list).pluck(:name)
Basically it find the Book
whose name is present in the @name_list
and then return an array of their names
if present.
But since there are a huge number of books present in the database, the request is getting timed out when I call this particular endpoint.
Please let me know if there is any way we can make this faster so that endpoint will work.
Also will the query speed increase if we add this name
column as an index
into the Books
table ?
add_index :books, :name