Skip to content

Instantly share code, notes, and snippets.

View zr40's full-sized avatar

Matthijs van der Vleuten zr40

View GitHub Profile
@zr40
zr40 / upsert_delete_mvcc_voodoo.rs
Last active January 13, 2016 22:37
Upsert+delete voodoo test (implemented in Rust)
extern crate postgres;
use postgres::{Connection,SslMode};
use std::sync::mpsc::{channel,Receiver,TryRecvError};
use std::thread;
#[test]
fn test_upsert_delete_mvcc_voodoo() {
// This tests an upsert+delete technique to replace a set of rows with
// another set of rows. The intended use case is to replicate an external
@zr40
zr40 / blocking.sql
Last active September 29, 2017 17:25
Show blocking locks
select
object,
case "lock requested"
when 'AccessExclusiveLock' then 'access exclusive'
when 'ExclusiveLock' then 'exclusive'
when 'ShareRowExclusiveLock' then 'share row exclusive'
when 'ShareLock' then 'share'
when 'ShareUpdateExclusiveLock' then 'share update exclusive'
when 'RowExclusiveLock' then 'row exclusive'
when 'RowShareLock' then 'row share'