# How do you execute arbitrary SQL with ActiveRecord?

**URL:** <https://www.ruby-forum.com/t/how-do-you-execute-arbitrary-sql-with-activerecord/94624>\
**Category:** Rails\
**Created:** [May 9, 2006, 12:55pm UTC](https://www.ruby-forum.com/t/how-do-you-execute-arbitrary-sql-with-activerecord/94624 "2006-05-09T12:55:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![crenner](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/278dde/32.png) [@crenner](https://www.ruby-forum.com/u/crenner)\
**Post date:** [May 9, 2006, 12:55pm UTC](https://www.ruby-forum.com/t/how-do-you-execute-arbitrary-sql-with-activerecord/94624/1 "2006-05-09T12:55:38Z")

</div>

How do you execute arbitrary SQL with ActiveRecord?

I need to insert 40,000+ records, and the usual way is way too slow.  
I’m using Oracle

Thanks  
Chris

---

<div class="post-metadata">

**Author:** ![crenner](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/278dde/32.png) [@crenner](https://www.ruby-forum.com/u/crenner)\
**Post date:** [May 9, 2006, 1:05pm UTC](https://www.ruby-forum.com/t/how-do-you-execute-arbitrary-sql-with-activerecord/94624/2 "2006-05-09T13:05:15Z")

</div>

On Tuesday 09 May 2006 11:55, you wrote:

> How do you execute arbitrary SQL with ActiveRecord?
> 
> I need to insert 40,000+ records, and the usual way is way too slow.  
> I’m using Oracle
> 
> Thanks  
> Chris

ActiveRecord::Base.connection.execute(â??..â?)

Ashley
