> like we'll always have that tradeoff. :-) Yep. You could also stick some cache or parallel hints in there as well that way. > Can you do me a favor and trap one of these queries in your dev log? > I want to make sure that what I told you is true. I've been doing > some research (meet my assistant, Mr. Google), and I'm finding some > discussions from the end of 2004 that imply that the functionality > you want could be in place in the Oracle adapter. I'll try to track > it down from my end as well. The OCI8 driver definitely supports bind parameters, so I'm guessing the adapter would use them as well, though I'm not positive. I actually don't know how useful bind parameters are going to be in the context of web development, since users are (presumably) going to be bouncing around to different pages doing different queries, and thus the previous queries would be bumped out of the cache. I guess it depends on your schema and SGA setup. Regards, Dan
on 2006-04-19 18:14
on 2006-04-19 18:26
I think Oracle is a clever beast, If it recognises that the same query is being used then it wont have to compile it again. It can only recognise that the same query is being used if you use bind variables. Chris
on 2006-04-19 19:04
Hello, I did a quick test and can confirm that neither of the forms presented in the Conditions section of the ActiveRecord::Base uses Oracle bind parameters. So, each statement is parsed by the Oracle parser. What a shame! -Anthony
on 2006-04-19 19:26
This is because SQL generation is handled by ActiveRecord itself, not by the specific connection adapters. I'm not a giant fan of that decision, but I do understand why it was made. Still, you don't need to bother with these optimizations until you've profiled your app. If it isn't fast enough for you, you can easily use an Oracle-specific query to fetch the data you need.