Issue with update_attributes

Hi,

I have the following question regarding index updates in rails.

Suppose I have a users table with the following columns:
user_id (primary key)
username (index is created on this column)
name (there is no index on this column)

Assume that the row with user_id=10 has the following values:
user_id=10, username=“guru”, name=“Chandan Rastogi”

Now I do the following:
user=User.find_by_user_id(10)
user.update_attributes(:name => “Abhinav Gupta”)

This will issue an update statement as follows:

UPDATE users
SET name=“Abhinav Gupta”, username=“guru”, user_id=10
WHERE user_id=10

As you can see the value of username is the same as it was before the
update statement.

However, will the index on the username column be updated because of
this update statement.(Note: The update statement sets the username as
well)

I would be grateful if you can let me know a tool using which I can get
to know what all indexes are updated when an update statement is issued.

Also let me know if there exists a document that provides an answer to
the problem that I have described above.

The database that I am using is MySql

Thanks
Kapil

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs