javajdbcwebobjects

Any Suggestion for Optimization of Query with EO model?


I am trying to fetch data from a table which have very huge data some. i am using Java Webobject and EOmodel. While i am trying to fetch with a indexed column i am able to get the result in less than 2 sec. But when i am trying to search with any other column its almost taking 30+ sec. the query which is hitting through the EOmodel , am hitting directly with a JDBC standalone it fetches the result in 1.5sec.

Any suggestion for setting any flag in fetch specification or so to fetch the result fast.

Thanks in advance :)


Solution

  • What is the difference in the SQL generated by EOF fetch compared to your JDBC fetch?

    How many items in the result? (if there are 10,'s of thousands, then the time may be converting from raw SQL result to EOEnterpriseObjects).

    Try setFetchesRawRows(true) on your EOFetchSpecification and that will probably give you a comparable result to the JDBC fetch if your result set is large.

    Finally, if you have caching enabled on your database, and you ran the JDBC fetch right after the EOF fetch for comparison purposes, the JDBC fetch might be just getting cached results from the SQL cache.

    Bottom line, you are not providing enough information here for anyone to be able to offer really targeted advice.