Archive for database

Calling stored procedures from Mirth

Posted in Computación with tags , , , , , , on 27/October/2010 by Alex Pérez

Mirth JDBC reader/writer are well suited for simplest cases: only one SELECT and (optionally) a UPDATE for each row, but normally you need to use JDBC reader/writer with JS enabled.

Mirth JDBC API when using JS is very basic and does not allow easily deal with stored procedures: there are only executeCachedQuery() and executeUpdate(). If you’re lucky you can use executeUpdate() as long as your SP doesn’t use IN/OUT parameters or returns any resultset. Otherwise you should call the SPs in a java library and then invoke it from Mirth JS. Some time ago I documented how to call custom java classes from Mirth and this may be used to extend its database API. Continue reading

Indexing NULL column values

Posted in Computación with tags , , , , , , , , on 1/August/2010 by Alex Pérez

After reading some great articles from Burleson Consulting about the “is null/is not null” predicates I decided to make some additional tests. It’s a very common mistake to write SQL with this kind of predicates since the NULL values aren’t included in regular indexes (B*Tree, not function-based), so almost every “IS NULL” results in a TABLE FULL SCAN.

I want to test how much a index can improve a IS [NOT] NULL predicate measuring the #requests per minute that a legacy box can serve. In the old days this server was a mission-critical server, but nowadays is retired as test server and can be compared to a very low end box (P3-512M ram).
Well, I measure the time that the select statement takes to execute (using JMeter)  instead of cost because a 30% reduction cost does not mean a 30% time reduction, and usually the end-user speak in terms of time, and there are many “tricks” like moving a table to the KEEP_POOL that can speed-up SQL execution although the cost is the same.
Continue reading

Using JMeter to test JDBC databases

Posted in Computación with tags , , , , , , , on 17/April/2010 by Alex Pérez

Despite JMeter is a well-known load testing tool when testing web projects, it seems to be unused when testing SQL performance. So I decided to share how to configure a fairly simple SQL test plan involving only one SQL statement.

Download Apache JMeter and Java, if you don’t have them already.

Get a copy of the oracle driver (ojdbc14.jar) or a JDBC driver of your preferred DB, and throw it into the JMETER_HOME/lib directory

  • Open JMeter and create a test plan as shown in fig1. Based on this plan you can complicate it as you want to load your DB and fit it to your needs. There are two JMeter Listeners (red) called “Aggregate Report” and “Summary Report” that will report us some statistical results like mean, median, throughput among others. I recommend you to use the Statistical Aggregate Report listener. Inside the thread group (blue) are two items of type “JDBC Connection Configuration” and “JDBC Request”. As we will see, is where we define the DB connection properties (user, password, driver, IP, SID), and the statement we want to test. Continue reading

Installing oracle instant client on Linux

Posted in Computación with tags , , , , , , , on 20/July/2009 by Alex Pérez

This is a miniguide to install sqlplus with the minimal oracle-software fingerprint. As far as I can, I avoid to install the Oracle Client in my computers, because in MS Windows it modifies heavily the registry, and in linux you should set a lot of environment variables and deal with Oracle Universal Installer (OUI) that depends on many packages, versions, java … etc. And there is a better solution to install a simple sqlplus without installing the whole Oracle Client: oracle instant client.

I’ve used the 10.2.0.4 version, but I suppose that using any other 10.X or even 11.X version should be similar. Continue reading