[erlang-questions] measuring OS context switches

ke han <>
Wed Sep 20 18:51:00 CEST 2006

On Sep 21, 2006, at 12:21 AM, Yariv Sadan wrote:

>> Ke Han, I will soon switch most ErlyDB calls to prepared statements.
>> This should give you a big performance boost over Rails, because
>> ActiveRecord doesn't use prepared statements at all AFAIK. Without
>> prepared statements, MySQL has to parse each query and then plan its
>> execution, which is quite expensive. Prepared statements alone should
>> give you a big scalability advantage because the database is often  
>> one
>> of the main bottlenecks for a webapp.
> Update: it has been brought to my attention that sometimes prepared
> statements don't give you a real performance advantage, and sometimes
> even a disadvantage, because they don't use the query cache and
> because their execution planning is weaker than non-prepared
> statements (at least in MySQL). Given the uncertainty surrounding this
> issue, I will make prepared statements optional.

In all my ORMs, I found I had to have pluggable behaviors for each  
type of DB.  This meant overridable or pluggable behaviors for  
connection pooling (you miultiplex over a single Oracle connection,  
not so with MySQL), when to use Prepared Statements...some DBs you  
set it to do so optimistically and some only when allowed or defined  
on a per-query basis, etc...I'm sure no matter what insight you have  
now, you will need to refactor later when you handle more DBs...thats  
the small stuff, don't sweat it. ;-)  I think you're correct in  
focusing on the app programmer's experience, not the internal  
framework re-factoring.

ke han

> Yariv

More information about the erlang-questions mailing list