GithubHelp home page GithubHelp logo

pupeno / query_reviewer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dsboulder/query_reviewer

0.0 2.0 1.0 131 KB

This rails plugin not only runs "EXPLAIN" before each of your select queries in development, but provides a small DIV in the rendered output of each page with the summary of query warnings that it analyzed.

Home Page: http://code.google.com/p/query-reviewer/

License: MIT License

JavaScript 5.06% Ruby 94.94%

query_reviewer's Introduction

QueryReviewer
=============

QueryReviewer is an advanced SQL query analyzer.  It accomplishes the following goals:

 * View all EXPLAIN output for all SELECT queries to generate a page (and optionally SHOW PROFILE ALL)
 * Rate a page's SQL usage into one of three categories: OK, WARNING, CRITICAL
 * Attach meaningful warnings to individual queries, and collections of queries
 * Display interactive summary on page

All you have to do is install it.  You can optionally run:
  rake query_reviewer:setup

Which will create config/query_reviewer.yml, see below for what these options mean.  If you don't have a config file,
the plugin will use the default in vendor/plugins/query_reviewer.


Configuration
=============

The configuration file allows you to set configuration parameters shared across all rails environment, as well as
overriding those shared parameteres with environment-specific parameters (such as disabling analysis on production!)

 * enabled: whether any output or query analysis is performed.  Set this false in production!
 * inject_view: controls whether the output automatically is injected before the </body> in HTML output.
 * profiling: when enabled, runs the MySQL SET PROFILING=1 for queries longer than the warn_duration_threshold / 2.0
 * production_data: whether the duration of a query should be taken into account (if you don't have real data, don't let query duration effect you!)

 * stack_trace_lines: number of lines of call stack to include in the "short" version of the stack trace
 * trace_includes_vendor: whether the "short" verison of the stack trace should include files in /vendor
 * trace_includes_lib: whether the "short" verison of the stack trace should include files in /lib

 * warn_severity: the severity of problem that merits "WARNING" status
 * critical_severity: the severity of problem that merits "CRITICAL" status

 * warn_query_count: the number of queries in a single request that merits "WARNING" status
 * critical_query_count: the number of queries in a single request that merits "CRITICAL" status

 * warn_duration_threshold: how long a query must take in seconds (float) before it's considered "WARNING"
 * critical_duration_threshold: how long a query must take in seconds (float) before it's considered "CRITICIAL"


Example
=======

If you disable the inject_view option, you'll need to manually put the analyzer's output into your view:

<%= query_review_output %>


Copyright (c) 2007-2008 Kongregate & David Stevenson, released under the MIT license

query_reviewer's People

Contributors

dsboulder avatar lukemelia avatar pupeno avatar morten avatar greatseth avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.