Ruby on Rails, Io, Lisp, JavaScript, Dynamic Languages, Prototype-based programming and more...

Technoblog reader special: $10 off web hosting by FatCow!

Monday, July 10, 2006

Use or Force an Index with Rails

I just found an ActiveRecord hint that is very useful and very undocumented. If you are working with a table who's indexes are sufficiently complex, MySQL will inevitably guess the wrong index at times. To counteract that in SQL, you write:
SELECT * FROM alphas USE INDEX (some_index) WHERE betas = gamas;

Rails does not have a corresponding :use_index for find methods. However, it does have an un-documented :from option.
Alpha.find(:all, :from => "alphas USE INDEX (some_index)", :conditions => "betas = gamas")

Keep this in the back of your mind if you are going to be working with complex database tables any time soon.

You should follow me on twitter here.

Technoblog reader special: click here to get $10 off web hosting by FatCow!


Anonymous Anonymous said...

I had the same problems with mysql not performing as it should, I used:

@posts = ForumPosts.Find(:all, :order => 'touched DESC', :joins => 'FORCE INDEX (post_touched)')

I had written about it on my blog, but have been in the same situation as you - my host f*cked me sideways...

2:55 AM, July 11, 2006

Anonymous Anonymous said...


Switch Web Hosting Companies!

6:30 AM, October 01, 2006

Anonymous Anonymous said...

We have many offerings. Please review
Of course Bloggers get 10% discount
Refer a company and get 10% commission

* We have super fast servers with many upstream providers.
* 250 strands of fiber
* power for months on battery
* first month free if you mention blogger for 10% off

** many hosted solutions **
hosted solution provider Great Plains
Cisco Support
Novell GroupWise to exchange
hosted solution QuickBooks Pro
asterisk voip hosted pbx
Hosted Exchange Server
hosted solution for Microsoft Dynamics
hosted cisco platform for voip
** Need a Job? ***
IT Staffing
* Outsourcing *
IT Outsourcing
** Have a Case to win ***
Forensic Services

9:10 PM, August 05, 2007

Anonymous Anonymous said...

This company provide amazing tier one level connectivity. You have to check it out.
CoLocation Los Angeles

6:56 PM, August 16, 2007

Blogger Unknown said...

chung cư tháp doanh nhân
tháp doanh nhân / tháp doanh nhân hà đông / dự án tháp doanh nhân hà đông / chung cư the legend / chung cư the legend 109 nguyễn tuân
chung cư 360 giải phóng / dự án 360 giải phóng / chung cư vietracimex / chung cư 201 minh khai / chung cư thanh xuân tower / chung cư 35 lê văn thiêm
chung cư eco green city / chung cu eco green city / chung cư eco green city nguyễn xiển / chung cu eco green city nguyen xien / eco green city / eco green city nguyễn xiển / dự án eco green city / toà ct4 eco green city / toà ct3 eco green city / toà ct1 eco green city

11:07 AM, May 21, 2016

Anonymous Anonymous said...

longchamp handbags
coach outlet
true religion canada
oakley sunglasses
mulberry handbags
reebok shoes
burberry outlet
ralph lauren outlet
ralph lauren polo
ralph lauren
hermes belt for sale
versace sunglasses on sale
fitflops clearance
nike air max 90
thomas sabo outlet
pandora outlet
tory burch outlet
coach outlet
kobe shoes
oakley sunglasses
ghd hair straighteners
ray ban sunglasses
coach outlet online
tory burch shoes
coach outlet
ralph lauren outlet
mulberry handbags
michael kors outlet online
discount oakley sunglasses
burberry sunglasses on sale
ralph lauren pas cher
replica watches
oakley sunglasses
chrome hearts outlet online
longchamp pliage

6:20 PM, May 30, 2016

Blogger Unknown said...

fitflops sale
ugg outlet
mulberry handbags sale
true religion outlet
michael kors outlet clearance
true religion jeans
new balance outlet
michael kors outlet clearance
ferragamo outlet
christian louboutin shoes
links of london
michael kors wholesale
tory burch outlet online
prada sneakers
true religion outlet
swarovski outlet
jordan pas cher
nike air force 1
calvin klein underwear
louis vuitton pas cher
true religion jeans
ferragamo outlet
ferragamo shoes sale
louis vuitton outlet store
tiffany and co
coach outlet store
gucci outlet
louis vuitton outlet
oakley sunglasses uk
true religion jeans
michael kors outlet online
mulberry outlet
nike free 5
celine outlet online
louis vuitton bags

10:43 PM, August 03, 2016

Blogger Fangyaya said...

air jordan 13
gucci outlet
adidas outlet
michael kors outlet
true religion outlet
cheap jordans
cheap jordans
louis vuitton outlet
coach outlet
uggs for men
michael kors outlet
air jordan 8
ralph lauren uk
true religion jeans
louis vuitton handbags uk
ralph lauren polo shirts
ugg sale
ugg boots
rolex watches
mlb jerseys
oakley sunglasses
ray ban sunglasses uk
nike outlet store
michael kors outlet online
louis vuitton handbags
uggs on sale
supra shoes
hermes handbags

6:52 PM, September 07, 2016

Blogger John said...

ugg outlet
burberry bags
cheap ugg boots
cheap oakley sunglasses
ugg pas cher
polo ralph lauren outlet online
ysl handbags
oakley sunglasses outlet
ed hardy outlet
michael kors outlet canada

6:23 PM, September 26, 2016

Blogger chenlina said...

michael kors handbags
toms shoes
ugg boots
replica watches
nike outlet store
coach outlet
ugg boots
kate spade
michael kors outlet
golden state warriors jerseys

7:52 PM, October 17, 2016

Blogger chenmeinv0 said...

canada goose jackets
ugg canada
michael kors outlet online
uggs outlet
nike roshe run shoes
true religion jeans
ray ban glasses
hogan sito ufficiale
true religion
ralph lauren polo

10:22 PM, January 03, 2017

Blogger Unknown said...

nike blazer low
christian louboutin shoes
ralph lauren uk
ed hardy sale
cheap jordans
chicago bulls jerseys
michael kors
yeezy boost
adidas superstar shoes
michael kors outlet

1:19 AM, March 15, 2017

Blogger Unknown said...

nike huarache
under armour shoes
salvatore ferragamo
cheap mlb jerseys
cheap oakley sunglasses
fitflops sale clearance
new york knicks jersey
christian louboutin outlet
michael kors outlet
cleveland cavaliers jersey

12:26 AM, March 16, 2017

Blogger Unknown said...

moncler jackets
birkenstock shoes
michael kors outlet online
fake rolex watches
mlb jerseys
discount oakley sunglasses
ray ban glasses
air max 90
nike flyknit

6:44 AM, April 18, 2017

Anonymous Em said...

Good to keep in mind.

4:18 PM, June 21, 2017

Blogger Unknown said...

discount oakley sunglasses
hollister kids
vans store
polo ralph lauren outlet online
adidas outlet store
jerseys cheap
adidas outlet online
vans outlet
yeezy boost 350
moncler jackets

2:45 AM, July 14, 2017

Blogger Đào Duy Quang Blog said...

Chung cư Green Pearl nằm trong quần thể Dự án Green Pearl tại số 378 Minh Khai, Vĩnh Tuy, Hai Bà Trưng, Hà Nội là một vị trí đắc địa thuộc cửa ngõ phía Nam của Thủ đô, tiếp giáp với đường Minh và KĐT times city. Căn hộ chung cư cao cấp Green Pearl sẽ mở ra không gian sống xanh, trong lành, KHÔNG ồn ào, KHÔNG khói bụi ngay trong lòng đô thị.
Chung cư Green Pearl

7:13 AM, August 27, 2017

Blogger Unknown said...

ralph lauren outlet
salomon boots
moncler outlet
rolex watches
replica watches
roshe run
ghd hair straighteners
canada goose pas cher

2:54 AM, November 20, 2017

Anonymous Obat Ampuh Atasi Rematik said...

Article very interisting, thanks for sharing information

Pengobatan Gagal Ginjal
Obat Diabetes Melitus Alami
Pengobatan Luka Gangren Tanpa Amputasi
Obat Ampuh Atasi Tukak Lambung
Obat Gabagen Sampai Sembuh
Pengobatan Ampuh Atasi Cacingan

12:02 AM, March 12, 2018

Blogger Cipro said...

This is one more brilliant site page that has demonstrated me astonishing resources which fuses instructional activities and materials to the critical class of topic subject. I would like to bookmark the page so I can come at this time again to read you, as you have done a magnificent job. If you want have fun aquí está la página friv

8:39 AM, March 29, 2018

Blogger yanmaneee said...

air jordan 4
adidas yeezy boost
nike basketball shoes
adidas superstar
yeezy boost
jordan retro 12
ferragamo belt
converse outlet

12:54 AM, May 26, 2018

Anonymous Obat Tradisional Telinga Berdengung said...

This article is interesting and useful. Thank you for sharing. And let me share an article about health that God willing will be very useful. Thank you :)

Obat Migrain Tradisional
Penyebab Telat Haid dan Solusinya
Cara Menghilangkan Benjolan di Kelopak Mata
Cara Mengobati Kencing Tersendat
Walatra Gamat Emas Kapsul
Cara Mengobati Prurigo

1:13 AM, July 03, 2018

Blogger Unknown said...

nike requin
ray ban sunglasses
nike shoes for women
coach outlet
kate spade outlet
longchamp outlet
supreme clothing
oakley sunglasses
saics running shoes

7:10 PM, July 15, 2018

Blogger Unknown said...

2018906 leilei3915
pandora charms
canada goose outlet
ralph lauren outlet
ugg outlet online clearance
true religion jeans sale
canada goose jackets
cheap ugg boots
michael kors outlet online
moncler jackets
canada goose jackets

12:00 AM, September 06, 2018

Anonymous Tips Obat Tradisional Gagal Jantung said...

Thank you for joining us. his article is very helpful

Cara Mengobati Benjolan Di Vagina
Pengobatan Alami Penyakit vertigo
Obat Maag Alami
Obat Penambah Berat Badan
Cara Mengobati Penyakit Kista
Cara Mengobati Sesak Napas Alami

12:24 AM, October 16, 2018

Blogger Sarah Betty said...

Thank you for another fantastic posting. Where else could anyone get that kind of information in such a perfect way of writing? I have a speech next week, and I was looking for more info.

"Online gambling is generous meadow usually upgrading towards the customers’ prerequisite online. The power of the games like mind improvement and inventive expansion confers capacity and understanding to the children who pander towards the gambling exercise on the regular schedule. The web site builders are in making intriguing games for each number of clients mainly interested. Using Friv games’ beginning, you will uncover many ground breaking games submitted for that people. You alsocan play various friv online games
and have faster thinking understanding and will realize that after doing offers online your teens have exceptional educational ability. Dads, housewives grandparents and youths get pleasure from the computer savvy exercise of the friv games."

1:52 AM, February 03, 2019

Blogger samaher said...


شركة نقل عفش من الرياض الى مكة


3:02 PM, April 28, 2019

Blogger Hằng VT said...

The article was great, I accidentally saw it and I was really attracted to it, hoping it would be well known. This post is very useful, I admire the author, hope you will succeed in the next post, I will continue to follow your post.
cá koi mini, abcya 2, friv Games for kids 2019, jogos io 2019

7:54 AM, August 06, 2019

Anonymous Anonymous said...

اگر به دنبال ترجمه متون فارسی خود برای اهدافی مانند مدارک مهاجرت، ارسال مقاله به نشریات خارجی به دنبال مترجمانی کارکشته، با تسلط کامل بر زبان انگلیسی هستید تا متن شما به سرعت با بهترین کیفیت و نازل ترین قیمت به شما ارائه شود ترجمه آنلاین در خدمت شماست. ترجمه آنلاین با کادری از باسابقه ترین مترجمان و ارزان تر از همه جا ترجمه تخصصی فارسی به انگلیسی به انگلیسی متون شما را انجام میدهد.

10:30 PM, November 03, 2019

Blogger Unknown said...

حشرات بالخبر مكافحة حشرات بالخبر
مكافحة حشرات بمكة مكافحة حشرات بمكة
مكافحة حشرات بالمدينة المنورة مكافحة حشرات بالمدينة المنورة
مكافحة حشرات بالدمام مكافحة حشرات بالدمام

2:53 PM, February 04, 2020


Post a Comment

Subscribe to Post Comments [Atom]

<< Home


If you like this blog, you might also like top photography schools.