`
javababy1
  • 浏览: 1220196 次
  • 性别: Icon_minigender_1
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

How to show query plan and runtime statistic in Derby

阅读更多

The official websie (http://db.apache.org/derby/) has straightford description. I just try to highlight some features:

  • an open source, under the Apache License, Version 2.0 .
  • relational database
  • entirely in Java
  • 2 megabytes for the base engine and embedded JDBC driver
  • embedded or client/server mode

check out the Quick Start page if you want to know more.

I will give my experience on check the query plan, runtime statistic, which is very useful to tune the performance.

Query Plan

To show the query plan, first create file named “derby.properties ” under derby “lib” directory, and put following lines:

derby.language.logQueryPlan=true
derby.optimizer.noTimeout=true

You must manully create the file! Then start derby ij command line [1], after run the query, the query plan is recorded in the “derby.log” file.The log will show you the detail on how the query engine analysis the user's query and optimize the query. You can find the the final query sequence and whether index is used or not and which one.

Runtime Statictic

But you can not get the real runtime for the query just display the query plan. Here is some way to show it:

In ij command

  1. MaximumDisplayWidth 9999; (if you query is simple, ignor it. If complex, must set. For my case, even set it still not big enough. Try next two methods)
  2. CALL SYSCS_UTIL.SYSCS_SET_RUNTIMESTATISTICS(1);
  3. CALL SYSCS_UTIL.SYSCS_SET_STATISTICS_TIMING(1);
  4. Run your statement (like select * from table; )
  5. VALUES SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS();

Directly run java command

java -cp .;derby.jar;derbytools.jar java org.apache.derby.tools.ij my.sql > myoutput.txt

This will run a sql file and dump the result out to a file. Here is a sample "my.sql" file:


Note: I call a usre-defined function named "myED" in the script.

Using Java

Reference:

[1]http://db.apache.org/derby/integrate/plugin_help/ij_toc.html

[2]http://db.apache.org/derby/docs/dev/tools/ttoolsij98878.html

[3]http://db.apache.org/derby/docs/dev/tools/ttoolsij98878.html

[4]https://www.ibm.com/developerworks/forums/thread.jspa?threadID=122245&tstart=0&messageID=13833605

[5]http://home.online.no/~olmsan/publications/pres/javaone07/JavaDbJavaOne07.pdf

分享到:
评论

相关推荐

    How.to.Use.IBM.SPSS.Statistics.epub

    Each section describes how to interpret results and express them in a research report after the data are analyzed. For example, students are shown how to phrase the results of a significant and an ...

    Foundations for Analytics with Python O-Reilly-2016-Clinton W. Brownley

    The exam‐ ples in these sections show how to filter for specific rows and columns in the worksheets. After discussing how to read and parse any number of worksheets in a single workbook, the chapter...

    Python for Probability Statistics and Machine Learning

    statistics and illustrates how they relate to machine learning via the Python language and its powerful extensions. This is not a good first book in any of these topics because we assume that you ...

    Bioinformatics_and_Computational_Biology_Solutions_Using_R_and_Bioconductor

    The Bioconductor project is an open source and open development software ...code and necessary supporting libraries and hence will be able to see how every plot and statistic was computed.

    An Introduction to Mathematical Statistics and Its Applications

    原版教材:An Introduction to Mathematical Statistics and Its Applications.djvu

    statistic books for machine learning

    Implement statistical computations programmatically for supervised and unsupervised learning through K-means clustering. Master the statistical aspect of machine learning with the help of this example...

    IDEA统计代码量Statistic插件(解决旧版IDEA工具栏找不到Statistic问题)

    IDEA统计代码量Statistic插件,可适配IDEA2019.1版本,解决旧版IDEA工具栏找不到Statistic问题。 安装步骤:下载后打开IDEA,选择File -> Settings -> Plugins -> 点击顶部齿轮按钮 -> Install Plugins from Disk......

    基于云计算的中文文本分类方法的研究

    to build a cloud platform, and how to use MapReduce model to achieve the improved SVM classification algorithm on the cloud computing platform. The final experimental results show that the new ...

    TS Expert(To Parse DVB transport stream)

    (这个版本不需要License的版本... Be able to parse TS packets and PES packets  Be able to retrieve TS packets, sections and PES packets  With a powerful CRC calculation tool and a CSA cipher tool

    Mastering Wireshark 2 pdf

    We start with installing and setting up Wireshark2.0, and then explore its interface in order to understand all of its functionalities. As you progress through the chapters, you will discover ...

    Gap Statistic算法的Matlab源码

    Gap Statistic算法是一种用于确定数据聚类数量的统计方法,由Tibshirani、Ward和Fienberg在2001年提出。这个算法是基于比较数据的真实分布与随机分布之间的差异来评估不同聚类数目的效果。在Matlab环境中实现Gap ...

    Statistic-3.4.1.jar

    idea 2018 Statistic插件下载

    idea插件statistic4.1.7版本.rar

    而"Statistic"插件是专为IntelliJ IDEA设计的一个实用工具,它能帮助开发者统计和分析项目中的代码情况,提供关于代码量、文件数量以及编程语言使用的分布等数据。 Statistic插件的4.1.7版本,作为该插件的一个更新...

    Six Sigma with R_ Statistical Engineering for Process Improvement

    The aim of this book is to show how R can be used as the software tool in the development of Six Sigma projects. The book includes a gentle introduction to Six Sigma and a variety of examples showing...

    idea统计代码行数插件Statistic-3.8.1版本

    idea统计代码行数可以用到插件:Statistic。解决老版本idea不显示该插件问题 Statistic-3.8.1.jar 详见:https://blog.csdn.net/Sun__Kings/article/details/109285389

    Statistic3.4.1.zip

    《IDEA插件Statistic 3.4.1:代码统计利器》 在软件开发过程中,了解项目代码量是一项重要的任务,它有助于评估项目的规模、跟踪进度以及优化代码结构。"Statistic 3.4.1"是一款针对IntelliJ IDEA(简称IDEA)的...

    IDEA统计代码量Statistic插件

    IDEA统计代码量Statistic插件,可适配IDEA2019.1版本,解决旧版IDEA工具栏找不到Statistic问题。 安装步骤:下载后打开IDEA,选择File -> Settings -> Plugins -> 点击顶部齿轮按钮 -> Install Plugins from Disk......

Global site tag (gtag.js) - Google Analytics