Handling database indexes for Rails polymorphic associations

This post has been moved to my new blog, check it out!

This blog is being terminated :)


5 Responses to “Handling database indexes for Rails polymorphic associations”

  1. Jantzen Says:

    Exactly what I was looking for; however, several paragraphs and code examples are repeated twice.

  2. Maurício Linhares Says:

    Hi Jantzen,

    I did not notice that, but now it’s fixed, thanks for pointing it out :)

  3. ZachZ Says:

    By the way, index column order DOES matter to some DBMS’s such as PostgreSQL. In the case, you’ll want to consider the order in which columns are considered in the generated SQL statements from ActiveRecord.

    In my own limited testing, AR seems to generate “id” then “type”, for the association’s WHERE clause. So your last example index would correctly cover it!

    index :comments, [:commentable_id, :commentable_type]

  4. David Sousa Says:

    Opa, tudo bom?
    Aqui, eu acho que o inicio do topico esta duplicado nele mesmo… Da uma olhada.

    t mais.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: