Ruby on Rails
Thursday, July 4, 2013
I'm on Rails 3.2.13 I'm afraid.
I'll just use the execute statement for now :)
Den onsdagen den 3:e juli 2013 kl. 20:30:38 UTC+2 skrev Rick:
-- Den onsdagen den 3:e juli 2013 kl. 20:30:38 UTC+2 skrev Rick:
Direct from Rails4.0 ActiveRecord documentation:Creating an index with a specific method
add_index(:developers, :name, using: 'btree')generates:
CREATE INDEX index_developers_on_name ON developers USING btree (name) -- PostgreSQL CREATE INDEX index_developers_on_name USING btree ON developers (name) -- MySQLNote: only supported by PostgreSQL and MySQL
On Tuesday, July 2, 2013 1:13:15 PM UTC-4, Linus Pettersson wrote:HiI'm sorting some columns like this: MyModel.order("LOWER(column) ASC")... But these queries are quite slow. I'm on Postgres by the way.Does Rails support creating a lowercase index for these situations? I know Postgres has support for it and I guess I can create one like this (found on SO):But does Rails have support for creating it? Don't like to use execute() if there is a better way :)execute "CREATE UNIQUE INDEX index_products_on_lower_name ON products USING btree (lower(name));"Cheers,Linus
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/5586011a-477b-40e0-ace4-a134ec02f036%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment