Conceptualized by Alistair Cockburn. Also known as "Ports and Adapters".
In a nutshell:
Application Driver -> Primary Adapter -> Primary Port -> Use Case -> Secondary Port -> Secondary Adapter -> External System/Side Effect
| DROP AGGREGATE IF EXISTS public.ST_AsFeatureCollection(ANYELEMENT); | |
| DROP AGGREGATE IF EXISTS public.ST_AsFeatureCollection(ANYELEMENT, TEXT); | |
| DROP AGGREGATE IF EXISTS public.ST_AsFeatureCollection(ANYELEMENT, INT); | |
| DROP AGGREGATE IF EXISTS public.ST_AsFeatureCollection(ANYELEMENT, TEXT, INT); | |
| DROP AGGREGATE IF EXISTS public.ST_AsFeatureCollection(ANYELEMENT, INT, TEXT); | |
| DROP FUNCTION IF EXISTS public._st_asfeaturecollection_transfn(collection TEXT[], item ANYELEMENT); | |
| DROP FUNCTION IF EXISTS public._st_asfeaturecollection_transfn(collection TEXT[], item ANYELEMENT, TEXT); | |
| DROP FUNCTION IF EXISTS public._st_asfeaturecollection_transfn(collection TEXT[], item ANYELEMENT, INT); | |
| DROP FUNCTION IF EXISTS public._st_asfeaturecollection_transfn(collection TEXT[], item ANYELEMENT, TEXT, INT); | |
| DROP FUNCTION IF EXISTS public._st_asfeaturecollection_transfn(collection TEXT[], item ANYELEMENT, INT, TEXT); |
| { | |
| "$schema": "https://aka.ms/terminal-profiles-schema", | |
| "copyOnSelect": false, | |
| "defaultProfile": "{574e775e-4f2a-5b96-ac1e-a2962a402336}", | |
| // Add custom keybindings to this array. | |
| // To unbind a key combination from your defaults.json, set the command to "unbound". | |
| // To learn more about keybindings, visit https://aka.ms/terminal-keybindings | |
| "keybindings": | |
| [ | |
| // Copy and paste are bound to Ctrl+Shift+C and Ctrl+Shift+V in your defaults.json. |
| $userPath = $env:USERPROFILE | |
| $pathExclusions = New-Object System.Collections.ArrayList | |
| $processExclusions = New-Object System.Collections.ArrayList | |
| $pathExclusions.Add('C:\Windows\Microsoft.NET') > $null | |
| $pathExclusions.Add('C:\Windows\assembly') > $null | |
| $pathExclusions.Add($userPath + '\AppData\Local\Microsoft\VisualStudio') > $null | |
| $pathExclusions.Add('C:\ProgramData\Microsoft\VisualStudio\Packages') > $null | |
| $pathExclusions.Add('C:\Program Files (x86)\MSBuild') > $null | |
| $pathExclusions.Add('C:\Program Files (x86)\Microsoft Visual Studio 14.0') > $null |
| --- PSQL queries which also duplicated from https://github.com/anvk/AwesomePSQLList/blob/master/README.md | |
| --- some of them taken from https://www.slideshare.net/alexeylesovsky/deep-dive-into-postgresql-statistics-54594192 | |
| -- I'm not an expert in PSQL. Just a developer who is trying to accumulate useful stat queries which could potentially explain problems in your Postgres DB. | |
| ------------ | |
| -- Basics -- | |
| ------------ | |
| -- Get indexes of tables |
pg_dump -h <rds host> -p 5432 -F c -O -U <rds user> <db name> > db.dump
docker run --rm --interactive --link <postgres container id>:postgres --volume $PWD/:/tmp/ postgres:latest /bin/bash -c 'pg_restore --verbose --clean --no-acl --no-owner -h "$POSTGRES_PORT_5432_TCP_ADDR" -p "$POSTGRES_PORT_5432_TCP_PORT" -U postgres -d <db name> /tmp/db.dump'
| ** Find commmonly accessed tables and their use of indexes: | |
| SELECT relname,seq_tup_read,idx_tup_fetch,cast(idx_tup_fetch AS numeric) / (idx_tup_fetch + seq_tup_read) AS idx_tup_pct FROM pg_stat_user_tables WHERE (idx_tup_fetch + seq_tup_read)>0 ORDER BY idx_tup_pct; | |
| Returns output like: | |
| relname | seq_tup_read | idx_tup_fetch | idx_tup_pct | |
| ----------------------+--------------+---------------+------------------------ | |
| schema_migrations | 817 | 0 | 0.00000000000000000000 | |
| user_device_photos | 349 | 0 | 0.00000000000000000000 |
| 1) see re: increasing shmmax http://stackoverflow.com/a/10629164/1283020 | |
| 2) add to postgresql.conf: | |
| shared_preload_libraries = 'pg_stat_statements' # (change requires restart) | |
| 136 pg_stat_statements.max = 1000 | |
| 137 pg_stat_statements.track = all | |
| 3) restart postgres | |
| 4) check it out in psql |