#208 ✓not-applicable

Prepared statements, database driver quoting

Reported by senotrusov | April 15th, 2008 @ 11:00 AM

We can gain significant performance boost using prepared statements.

dbconn = SQLite3::Database.new(filename)

insert = dbconn.prepare "INSERT INTO records (foo, bar) VALUES (?, ?)"

insert.execute "foo", "bar"
insert.execute "qux", "oups"

So, the benefits are:

don't parse query on every request,

cache query execution plan,

do string quoting internally by driver or even don't do it at all (depending on database and access protocol).

If you store files in database, ruby's speed of string quoting can be noticeably slow. On some databases like Oracle the parsing and building of query execution plan is an expensive operation.

Any plans to implement this?

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »