Skip to content

Instantly share code, notes, and snippets.

Avatar

Felix Geisendörfer felixge

View GitHub Profile
View plan.json
[
{
"Plan": {
"Node Type": "Seq Scan",
"Parallel Aware": false,
"Relation Name": "congrats_on_loading_your_first_gist",
"Alias": "congrats_on_loading_your_first_gist",
"Startup Cost": 0.00,
"Total Cost": 35.50,
"Plan Rows": 2550,
View gen_series.json
[
{
"Plan": {
"Node Type": "Nested Loop",
"Parallel Aware": false,
"Join Type": "Inner",
"Startup Cost": 0.01,
"Total Cost": 20010.01,
"Plan Rows": 1000000,
"Plan Width": 8,
View timing.txt
postgres=# \timing
Timing is on.
postgres=# SELECT count(*) FROM generate_series(1, 10000);
count
-------
10000
(1 row)
Time: 2.587 ms
View pr-7864.sql
SET search_path=query_test;
DROP SCHEMA IF EXISTS query_test CASCADE;
CREATE SCHEMA query_test;
CREATE TABLE campaigns (
id int PRIMARY KEY,
campaign_plan_id int
);
INSERT INTO campaigns VALUES
View linux.sql
SELECT version();
version
----------------------------------------------------------------------------------------------------------------------------------
PostgreSQL 11.5 (Debian 11.5-1.pgdg90+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516, 64-bit
(1 row)
-- Why is this returning true?
-- I think { and [ are considered to sort equally on this machine's `en_US` collation,
-- so the result is the same as `'{' < '{a'`
SELECT '{' < '[a' COLLATE "en_US";
View collate_c_sort_perf.sql
SHOW LC_COLLATE;
lc_collate
-------------
en_US.UTF-8
(1 row)
EXPLAIN ANALYZE
SELECT g::text FROM generate_series(1, 10000) g ORDER BY 1;
QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------
View main.go
package main
import "fmt"
func main() {
f1 := &Foo{}
f2 := &Foo{}
fmt.Printf("%p = %p\n", f1, f2)
b1 := &Bar{}
View chat.go
package main
import (
"bufio"
"fmt"
"io"
"log"
"net"
"os"
"sync"
View decoder.rb
encoded_in = "\x00\x00\x00\x03aaa\x00\x00\x00\x06Binary\x02\x00\x00\x00\fP\x00\x84A\xEB\xF9~?\x966\xE7\x8A\x00\x00\x00\x03ccc\x00\x00\x00\x06String\x01\x00\x00\x00\x04test\x00\x00\x00\x03zzz\x00\x00\x00\x06Number\x01\x00\x00\x00\a0230.01\x00\x00\x00\x10\xC3\xB6ther_encodings\x00\x00\x00\x06String\x01\x00\x00\x00\x05T\xC3\xBCst"
class EncodedMessage
attr_accessor :data
attr_accessor :md5
def initialize(data, md5)
@data = [data].pack('a*')
@md5 = md5
# TODO(fg) verify md5