(C-x means ctrl+x, M-x means alt+x)
The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf
:
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
from elasticsearch import Elasticsearch | |
query = { | |
"query": { | |
"bool": { | |
"should": | |
[ | |
{ | |
"term": { | |
"id-topico": "" |
db.currentOp().inprog.forEach( | |
function(op) { | |
if(op.secs_running > 5) printjson(op); | |
} | |
) |
import asyncio | |
import signal | |
async def polling(): | |
print('polling...') | |
await asyncio.sleep(3) | |
asyncio.ensure_future(polling()) | |
loop = asyncio.get_event_loop() | |
loop.create_task(polling()) |
py27-dj1.8.x installed: Django==1.8.7,django-braces==1.8.1,django-crispy-forms==1.5.2,django-debug-toolbar==1.4,django-extra-views==0.7.1,django-filter==0.11.0,django-floppyforms==1.2.0,djangorestframework==2.4.4,py==1.4.31,pytest==2.8.5,pytest-django==2.9.1,pytz==2014.7,six==1.10.0,sqlparse==0.1.18,wheel==0.24.0 | |
py27-dj1.8.x runtests: PYTHONHASHSEED='1485872978' | |
py27-dj1.8.x runtests: commands[0] | py.test | |
============================= test session starts ============================== | |
platform darwin -- Python 2.7.10, pytest-2.8.5, py-1.4.31, pluggy-0.3.1 | |
django settings: example.settings (from environment variable) | |
rootdir: /Users/andrews/projects/opensource/django-admin2, inifile: | |
plugins: django-2.9.1 | |
collected 212 items |
First, you have to enable profiling
> db.setProfilingLevel(1)
Now let it run for a while. It collects the slow queries ( > 100ms) into a capped collections, so queries go in and if it's full, old queries go out, so don't be surprised that it's a moving target...
#!/usr/bin/env python | |
import argparse | |
import json | |
import os | |
import urllib2 | |
def get_envs(app_name): | |
resp = request("/apps/{}/env".format(app_name)) |