tmux shortcuts & cheatsheet
start new with session name:
tmux new -s myname
|-- show running queries (pre 9.2)|
|SELECT procpid, age(clock_timestamp(), query_start), usename, current_query|
|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|
|WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'|
Sometimes you want to have a subdirectory on the
master branch be the root directory of a repository’s
gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the
master branch alongside the rest of your code.
For the sake of this example, let’s pretend the subfolder containing your site is named
dist directory from the project’s
.gitignore file (it’s ignored by default by Yeoman).
There are several approaches one can take to debug a leak. This discusses a time-based approach, where a full memory dump is generated every, say, 5 minutes, during a time that the memory leak is showing up. Afterwards, one can look at all the objects, and find out which ones are staying around, causing the
I'm hunting for the best solution on how to handle keeping large sets of DB records "sorted" in a performant manner.
Most of us have work on projects at some point where we have needed to have ordered lists of objects. Whether it be a to-do list sorted by priority, or a list of documents that a user can sort in whatever order they want.
A traditional approach for this on a Rails project is to use something like the
acts_as_list gem, or something similar. These systems typically add some sort of "postion" or "sort order" column to each record, which is then used when querying out the records in a traditional
order by position SQL query.
This approach seems to work fine for smaller datasets, but can be hard to manage on large data sets with hundreds (or thousands) of records needing to be sorted. Changing the sort position of even a single object will require updating every single record in the database that is in the same sort group. This requires potentially thousands of wri