Friday, February 14, 2020

plpgsql_check 1.9 calculates coverage metrics

Small note - I finished support of statement and branch coverage metrics calculations for plpgsql_check

https://github.com/okbob/plpgsql_check/commit/c6f9896ead0a0969db23c3062f1fe7ce5f38029b

Saturday, February 8, 2020

psql and gnuplot

psql from PostgreSQL 12 can produces CSV format. This format is well readable by gnuplot. So anybody can use it together:

\pset format csv
select i, sin(i) from generate_series(0, 6.3, 0.5) g(i) \g |gnuplot -p -e "set datafile separator ','; set key autotitle columnhead; plot '-'with boxes"

    1 +-+---------+-*******--+-----------+----------+-----------+--------+-+   
      +           + *     *******        +          +           +          +   
  0.8 +-+      ******     *     *                              sin *******-+   
      |        *    *     *     *                                          |   
  0.6 +-+      *    *     *     *******                                  +-+   
      |  *******    *     *     *     *                                    |   
  0.4 +-+*     *    *     *     *     *                                  +-+   
      |  *     *    *     *     *     *                                    |   
  0.2 +-+*     *    *     *     *     ******                             +-+   
    0 **********************************************************************   
      |                                    *     *     *     *    *     *  *   
 -0.2 +-+                                  *     *     *     *    *     *+-*   
      |                                    *     *     *     *    *     ****   
 -0.4 +-+                                  *******     *     *    *     *+-+   
      |                                          *     *     *    *     *  |   
 -0.6 +-+                                        *     *     *    *     *+-+   
      |                                          *     *     *    *******  |   
 -0.8 +-+                                        *******     *    *      +-+   
      +           +          +           +          +  *     *  + *        +   
   -1 +-+---------+----------+-----------+----------+--************------+-+   
      0           1          2           3          4           5          6  

postgres=# select i, sin(i) from generate_series(0, 6.3, 0.05) g(i) \g |gnuplot -p -e "set datafile separator ','; set key autotitle columnhead; set terminal dumb enhanced; plot '-'with boxes" 

                                                                               
                                                                               
    1 +-+-------+-*******-+---------+--------+---------+---------+-------+-+   
      +         ************        +        +         +         +         +   
  0.8 +-+     ****************                                 sin *******-+   
      |      ******************                                            |   
  0.6 +-+   ********************                                         +-+   
      |   ************************                                         |   
  0.4 +-+**************************                                      +-+   
      | ****************************                                       |   
  0.2 +******************************                                    +-+   
    0 ***************************************************************    +-+   
      |                              ********************************      |   
 -0.2 +-+                             ******************************     +-+   
      |                                ****************************        |   
 -0.4 +-+                               **************************       +-+   
      |                                  ***********************           |   
 -0.6 +-+                                 *********************          +-+   
      |                                     ******************             |   
 -0.8 +-+                                    ****************            +-+   
      +         +         +         +        + ************      +         +   
   -1 +-+-------+---------+---------+--------+---********--------+-------+-+   
      0         1         2         3        4         5         6         7   
                                                                               

postgres=# select i, sin(i) from generate_series(0, 6.3, 0.05) g(i) \g |gnuplot -p -e "set datafile separator ','; set key autotitle columnhead; set terminal dumb enhanced; plot '-'with lines ls 1" 

                                                                               
                                                                               
    1 +-+-------+-*******-+---------+--------+---------+---------+-------+-+   
      +         ***      ***        +        +         +         +         +   
  0.8 +-+     ***          ***                                 sin *******-+   
      |      **              **                                            |   
  0.6 +-+   *                  *                                         +-+   
      |   **                    **                                         |   
  0.4 +-+**                      **                                      +-+   
      | **                        **                                       |   
  0.2 +**                          **                                    +-+   
    0 **+                           **                              *    +-+   
      |                              **                            **      |   
 -0.2 +-+                             **                          **     +-+   
      |                                 *                        **        |   
 -0.4 +-+                                *                      **       +-+   
      |                                  **                    *           |   
 -0.6 +-+                                 **                 **          +-+   
      |                                     **              **             |   
 -0.8 +-+                                    **           ***            +-+   
      +         +         +         +        + ***     +***      +         +   
   -1 +-+-------+---------+---------+--------+---*******---------+-------+-+   
      0         1         2         3        4         5         6         7 



This can be little bit simplified with psql macros

postgres=# \set gnuplot '\\g | gnuplot -p -e "set datafile separator \',\'; set key autotitle columnhead; set terminal dumb enhanced; plot \'-\'with boxes"' 

postgres=# \pset format csv

postgres=# select i, sin(i) from generate_series(0, 6.3, 0.05) g(i) :gnuplot

                                                                               
                                                                               
    1 +-+-------+-*******-+---------+--------+---------+---------+-------+-+   
      +         ************        +        +         +         +         +   
  0.8 +-+     ****************                                 sin *******-+   
      |      ******************                                            |   
  0.6 +-+   ********************                                         +-+   
      |   ************************                                         |   
  0.4 +-+**************************                                      +-+   
      | ****************************                                       |   
  0.2 +******************************                                    +-+   
    0 ***************************************************************    +-+   
      |                              ********************************      |   
 -0.2 +-+                             ******************************     +-+   
      |                                ****************************        |   
 -0.4 +-+                               **************************       +-+   
      |                                  ***********************           |   
 -0.6 +-+                                 *********************          +-+   
      |                                     ******************             |   
 -0.8 +-+                                    ****************            +-+   
      +         +         +         +        + ************      +         +   
   -1 +-+-------+---------+---------+--------+---********--------+-------+-+   
      0         1         2         3        4         5         6         7   
                                                                               

Friday, February 7, 2020

Moscow PgConf.Russia 2020

Last week I was on Moscow's PgConf.Russia 2020 (Thanks for Oleg Bartunov for invitation). It was interesting and very good event, where I can meet interesting people, where I can see interesting places - like famous building of Moscow Lomonosov State University - with nice guide from PostgresPro.


My presentations

https://pgconf.ru/en/2020/272099
https://pgconf.ru/en/2020/272097