Skip to content

Instantly share code, notes, and snippets.

Aliaksandr Valialkin valyala

Block or report user

Report or block valyala

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
valyala /
Last active Sep 21, 2019
Optimizing postgresql table for more than 100K inserts per second

Optimizing postgresql table for more than 100K inserts per second

  • Create UNLOGGED table. This reduces the amount of data written to persistent storage by up to 2x.
  • Set WITH (autovacuum_enabled=false) on the table. This saves CPU time and IO bandwidth on useless vacuuming of the table (since we never DELETE or UPDATE the table).
  • Insert rows with COPY FROM STDIN. This is the fastest possible approach to insert rows into table.
  • Minimize the number of indexes in the table, since they slow down inserts. Usually an index on time timestamp with time zone is enough.
  • Add synchronous_commit = off to postgresql.conf.
  • Use table inheritance for fast removal of old data:
valyala / go-tool-pprof-readline-support.diff
Created Jan 20, 2016
Add readline support for interactive mode in go tool pprof
View go-tool-pprof-readline-support.diff
diff --git a/src/cmd/pprof/internal/plugin/plugin.go b/src/cmd/pprof/internal/plugin/plugin.go
index a22ec5f..4d545de 100644
--- a/src/cmd/pprof/internal/plugin/plugin.go
+++ b/src/cmd/pprof/internal/plugin/plugin.go
@@ -6,7 +6,6 @@
package plugin
import (
- "bufio"
View dou-fileserver.go
// Example static file server. Serves static files from the given directory.
package main
import (
valyala / spew.go
Created Apr 28, 2012
Spew implementation ( ) in golang
View spew.go
package main
import (
View word_chains_solution.cpp
// This is a solution for the Word Chains problem described
// at .
// The problem.
// Two words are connected by a word chain if it is possible to change one into
// the other by making a series of single-character changes, such that every
// intermediate form is also a word. For example, CAT and DOG are connected with
// a word chain because CAT, COT, COG and DOG are all words. DEMONIC and
// UMBRELLA are not.
You can’t perform that action at this time.