The Artima Developer Community
Sponsored Link

Agile Buzz Forum
Smalltalk Daily 04/22/10: Statement Caching with OS8 and Oracle

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
James Robertson

Posts: 29924
Nickname: jarober61
Registered: Jun, 2003

David Buck, Smalltalker at large
Smalltalk Daily 04/22/10: Statement Caching with OS8 and Oracle Posted: Apr 22, 2010 7:39 AM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: Smalltalk Daily 04/22/10: Statement Caching with OS8 and Oracle
Feed Title: Cincom Smalltalk Blog - Smalltalk with Rants
Feed URL: http://www.cincomsmalltalk.com/rssBlog/rssBlogView.xml
Feed Description: James Robertson comments on Cincom Smalltalk, the Smalltalk development community, and IT trends and issues in general.
Latest Agile Buzz Posts
Latest Agile Buzz Posts by James Robertson
Latest Posts From Cincom Smalltalk Blog - Smalltalk with Rants

Advertisement

Today's Smalltalk Daily looks at using statement caching against Oracle (version 9 and up) with ObjectStudio. If you're looking for a particular topic, you can find it with the Media Search application on our site.

The code used is below; To watch, click on the viewer:


"Statement Caching examples. Oracle does not support this feature until 9.0.0, so make 
sure you are using Oracle 9.0.0 and later."

"Information from Oracle: Statement caching refers to the feature that provides and 
manages a cache of statements for each session. In the server, it means that cursors 
are ready to be used without the need to parse the statement again.  It can be 
used with connection pooling, and will improve performance and scalability." 

"The following are two examples, one uses statement caching, the other does not."

"Statement Caching is off be default."
ObjectStudio.OracleDatabase useStatementCaching: false.

"Logon to the Oracle Server."
ObjectStudio.OracleDatabase 
	logOnServer: #'OracleDB' 
	user: #'username' 
	password: #'pwd' 
	alias: #'OracleDB'.


"Get the Oracle database instance."
db := ObjectStudio.Database accessName: #'OracleDB'.

"Set times to repeat."
loopCount := 100.

"Set the SQL to do the fetch."
sql :='select * from sys.all_tables where TABLE_NAME=''DUAL'''.

selectTime1 := [
1 to: loopCount do: [ :i|
        db execSql: sql.
    ].
] millisecondsToRun.

"Print out the miliseconds spent."
('Select without using statement caching: ' + selectTime1) out.	

db logOff.


"Turn on Statement Caching."
ObjectStudio.OracleDatabase useStatementCaching: true.

"Logon to the Oracle Server."
ObjectStudio.OracleDatabase 
	logOnServer: #'OracleDB' 
	user: #'username' 
	password: #'pwd' 
	alias: #'OracleDB'.

"Get the Oracle database instance."
db := ObjectStudio.Database accessName: #'OracleDB'.

selectTime2 := [
1 to: loopCount do: [ :i|
    db execSql: sql.
	]
] millisecondsToRun.

"Print out the miliseconds spent."
('Select using statement caching: ' + selectTime2) out.	

db logOff.



If you have trouble viewing that directly, you can click here to download the video directly

You can also watch it on YouTube:

Technorati Tags: , , , ,

Read: Smalltalk Daily 04/22/10: Statement Caching with OS8 and Oracle

Topic: YouTrack 2.0 Release Candidate Previous Topic   Next Topic Topic: Agile Quick Links #13

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use