Disclaimer

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.

Tuesday, April 29, 2008

Like '%' and ROWNUM

I've found many of developers using like with '%' and allowing application user to fetch all rows in table. For example consider query like this:

select * from ms_account where customer_name like '%'||:p_1||'%'

When the users submit the query using a,b or % only, the database will query all the records and could cause very high consumption server resources (Memory, I/O, CPU)

Using rownum could help.

select * from ms_account where customer_name like '%'||:P_1||'%' and rownum <= 10. This will fetch the query with maximum 10 records.

Learn more about rownum : http://www.oracle.com/technology/oramag/oracle/06-sep/o56asktom.html

You should limit your query (espesially the one with LIKE)

Thursday, January 3, 2008

Oracle Forms vs Oracle ADF

I've been using Oracle Forms/Reports for about 5 years,with all of its pros and cons. About 2 years ago, i have opportunity to implement my j2ee skill using Oracle ADF Swing,JSP and ADF Business components. It was a great learning experience. Right now, with EJB 3.0 released, i research more into ADF Toplink and ADF Faces to accelerate my skill set.

My opinion is:
1.Use Oracle Forms wisely. You have to understand the network requirement that could impact your application performance and the architecture flexibility. We can not configure cluster for Oracle Forms. You have to buy Load Balancer, either hardware or software to achieve high availability.

2.Use Oracle ADF to gain more flexibility in designing your application. With this framework, you have a lot of flexibility from choosing persistence technology to the client type. Oracle ADF has excellent data binding features. You can use different persistence technology ie. Toplink,ADF BC, Flat files, XML, etc. and display it using the same client code or reversely you can used your persistence component to different client type ie. web apps, swing, mobile.

Use the tools wisely and carefully...... "flexibility comes with complexity" :)