• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Query Estimation

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We will be constructing a VLDB that allows end users to build and execute dynamic queries. We plan to queue expensive queries using JMS, and execute cheap queries immediately. Can you suggest a means to estimate the cost of running a SQL query in Java? This will be against an Oracle 10g database. I am familiar with explain plan, but I have only used that in the native SQL environment. Is there something similar or can I use explain plan? Your assistance may help cure disease and better humanity...
Scott
 
author & internet detective
Posts: 41967
911
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Scott,
I don't think you can get an explain type plan in java. You could do your own rough one though. If you know the approximate number of rows in each table, indexes on the table and join clauses, that should give you a rough order of maginitude for the query.
 
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Explain plan basically creates a table with the plan info, and this table can be queried (using JDBC). You ought to be able to issue the explain plan via JDBC, or, failing that, write a PL/SQL stored function which gets the cost and call it.
 
She's out of the country right now, toppling an unauthorized dictatorship. Please leave a message with this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic