indexing of association

Dear

Which table do we index when we have many_to_many relations on rails?
since the foreign key is not in any of the main tables;

when I query, i use eager loading. However, the performance is kind of
slow, because I am confused which table to index

Thanks

ok guys

another question

if i have this

select * from users order by name desc

in order to increase the performance, is it possible to index the
column 'name'
or it will not help

indexing is a bit confusing me, any idea
thanks

ok guys

another question

if i have this

select * from users order by name desc

in order to increase the performance, is it possible to index the
column 'name'
or it will not help

This sort of thing is ultimately database dependant, so check the docs
for your database.
Most should on something like this. (and you can always use EXPLAIN to
see whether the database is using your index)

Fred

I have added the index to the column name,

i did the following queries, it seems that order by name uses the
index, if not is there any other way

thanks