Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
oracle_enhanced adapter cursor_sharing option - similar vs force
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Raimonds Simanovskis  
View profile  
 More options Sep 16, 3:11 am
From: Raimonds Simanovskis <raimonds.simanovs...@gmail.com>
Date: Wed, 16 Sep 2009 00:11:40 -0700 (PDT)
Local: Wed, Sep 16 2009 3:11 am
Subject: oracle_enhanced adapter cursor_sharing option - similar vs force
As you probably know ActiveRecord generates SQL statements without
bind variables which would be quite bad for Oracle as it will generate
separate execution plans and cursors for each SQL statement even if
just WHERE condition values are changed.

Therefore oracle_enhanced adapter sets session option cursor_sharing
to 'similar' which extracts all literals from SQL statement and puts
them as bind variables. The issue is that sometimes 'similar'
cursor_sharing can still decide to create separate execution plan and
cursor if it thinks that execution plan might be different for
different bind values. Therefore there is other cursor_similar option
'force' which will always extract all literals as bind variables and
will always produce just one execution plan and cursor. There is quite
good explanation of this at http://www.oracle.com/technology/oramag/oracle/06-jan/o16asktom.html

oracle_enhanced adapter since very beginning (already since original
oracle adapter) was setting cursor_sharing to similar. But recently we
found in one application that uses delayed_job plugin (and which
queries delayed_jobs table very frequently) that it generates huge
amount of execution plans and cursors. Probably it is because time
parameters are inserted as TO_DATE(..., ...) functions in SQL query
and therefore Oracle optimizer is deciding that it needs to create
separate execution plan for each query. This application is using 10g
database, have heard that in 11g this might be different.

In such cases it is recommended to use cursor_sharing force mode. You
can do it quite simply by specifying this option in database.yml, e.g.

production:
  adapter: oracle_enhanced
  database: ...
  username: ...
  password: ...
  cursor_sharing: force

Actually I am thinking about making this force option to be default in
next version of oracle_enhanced adapter as probably quite many Rails
developers are not aware of potential issues with similar option.
Those who knows the details will be able to chose by changing this
option in database.yml.

What do you think about changing default value for this option?

Raimonds


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Lori Olson  
View profile  
 More options Sep 16, 1:16 pm
From: Lori Olson <javadra...@gmail.com>
Date: Wed, 16 Sep 2009 11:16:06 -0600
Local: Wed, Sep 16 2009 1:16 pm
Subject: Re: oracle_enhanced adapter cursor_sharing option - similar vs force

I think I concur that the default should be updated.  However, it needs to
be documented in a prominent place.  Probably multiple places.

Regards, Lori

On Wed, Sep 16, 2009 at 1:11 AM, Raimonds Simanovskis <


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
toddwf  
View profile  
 More options Sep 21, 11:09 am
From: toddwf <tod...@gmail.com>
Date: Mon, 21 Sep 2009 08:09:58 -0700 (PDT)
Local: Mon, Sep 21 2009 11:09 am
Subject: Re: oracle_enhanced adapter cursor_sharing option - similar vs force

I support changing this to the default option.  I was unaware I could
change it and we've been discussing this issue for quite awhile.

-Todd


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google