This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"year": 1980, | |
"earthquake": 439, | |
"other": 0, | |
"undefined": 0, | |
"total": 439 | |
}, | |
{ | |
"year": 1981, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fabien@9b ~ » which postgres_launch | |
postgres_launch () { | |
docker run -it --rm --name postgres_$1 -e POSTGRES_USER=$1 -v $HOME/Databases/$1:/var/lib/postgresql/data -p $2:5432 postgres:9.6 | |
} | |
fabien@9b ~ » which postgres_restore | |
postgres_restore () { | |
pg_restore -U $1 -d postgres -j $(grep -c processor /proc/cpuinfo) -O -x -h 127.0.0.1 -p $(postgres_get_port $1) $2 | |
} | |
fabien@9b ~ » which postgres_get_port | |
postgres_get_port () { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fabien@9b ~ » which postgres_get_port | |
postgres_get_port () { | |
docker inspect postgres_$1 | jq -M -r '.[0].NetworkSettings.Ports."5432/tcp"[0].HostPort' | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MariaDB [conso]> select DATE_FORMAT(DATE, '%Y-%m'), sum(cIndexDelta) from conso_releve where HOUR(DATE) < 8 AND HOUR(DATE) < 18 GROUP BY DATE_FORMAT(DATE, '%Y-%m') ORDER BY DATE_FORMAT(DATE, '%Y-%m'); | |
+----------------------------+------------------+ | |
| DATE_FORMAT(DATE, '%Y-%m') | sum(cIndexDelta) | | |
+----------------------------+------------------+ | |
| 2016-12 | 3480 | | |
| 2017-01 | 229778 | | |
| 2017-03 | 79683 | | |
| 2017-05 | 79782 | | |
+----------------------------+------------------+ | |
4 rows in set (0.19 sec) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Delete on object (cost=0.00..19.66 rows=1 width=6) (actual time=4.508..4.508 rows=0 loops=1) | |
-> Index Scan using object_pkey on object (cost=0.00..19.66 rows=1 width=6) (actual time=4.441..4.442 rows=1 loops=1) | |
Index Cond: (_oid = 65262249) | |
Trigger for constraint amplitude__oid_fkey1: time=5.848 calls=1 | |
Trigger for constraint amplitude__parent_oid_fkey1: time=145.531 calls=1 | |
Trigger for constraint publicobject__oid_fkey: time=0.349 calls=1 | |
Trigger for constraint eventdescription__oid_fkey: time=6.320 calls=1 | |
Trigger for constraint eventdescription__parent_oid_fkey: time=1.502 calls=1 | |
Trigger for constraint comment__oid_fkey: time=0.259 calls=1 | |
Trigger for constraint comment__parent_oid_fkey: time=0.095 calls=1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo -u postgres createdb -O test test | |
echo "CREATE TABLE data AS SELECT d, md5(random()::text) FROM generate_series(1,10000) d;" | sudo -u postgres psql |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"database/sql" | |
"flag" | |
_ "github.com/lib/pq" | |
"log" | |
) | |
func main() { |