Giter Site home page Giter Site logo

queryperformance's Introduction

QueryPerformance API for PostgreSQL

Version 1.0

Api that returns performance data for a postgreSQL database using the extension pg_stat_statements. Supports sorting by all columns as well as filtering and pagnation. Built using Fiber framework

Run project:

docker-compose up -d

Stop project:

docker-compose down

Test:

make test

Integration testing:

make test-integration

API Documentation

/performance

Returns a list of queries and there mean,total,calls and rows retrived or affected

Endpoint definition

performance/

HTTP method

GET

Parameters

| Parameter | Description | Data Type |

|-----------|------|-----|-----------|

| sort_by | Optional. Column to order result by. Default is unordered. | string |

| asc | Optional. Sort by ASC order. Default is false and will sort by DESC order. | bool |

| offset | Optional. Pagnation offset, default 0 | uint

| limit | Optional. Pagnation limit, default is show all | uint

| statement | Optional. Only queries containing Statement,Multiple values will show queries with either, default show all | string

| Mincalls | Optional. Only queries with calls equal or greater than mincalls, default 0 | int

Sample request

curl --get --include 'http://127.0.0.1:7070/performance?sort_by=mean_exec_time&offset=7&limit=3'

Sample response

[
  {
    "query": "SELECT extname FROM pg_extension WHERE extname = $1",
    "calls": 1,
    "mean_exec_time": 0.123666,
    "total_exec_time": 0.123666,
    "stddev_exec_time": 0,
    "rows": 1
  },
  {
    "query": "INSERT INTO users(username, password)\nVALUES ($1, $2)",
    "calls": 2,
    "mean_exec_time": 0.0444785,
    "total_exec_time": 0.088957,
    "stddev_exec_time": 0.0336045,
    "rows": 2
  },
  {
    "query": "SELECT $1 FROM pg_database WHERE datname = $2",
    "calls": 1,
    "mean_exec_time": 0.007,
    "total_exec_time": 0.007,
    "stddev_exec_time": 0,
    "rows": 0
  }
]

queryperformance's People

Stargazers

dama avatar

Watchers

Jonathan  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.