- 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 neverDELETE
orUPDATE
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
topostgresql.conf
. - Use table inheritance for fast removal of old data:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | |
"fmt" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Example static file server. Serves static files from the given directory. | |
package main | |
import ( | |
"flag" | |
"fmt" | |
"log" | |
"strconv" | |
"strings" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"flag" | |
"fmt" | |
"io" | |
"net" | |
"os" | |
"os/signal" | |
"strings" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is a solution for the Word Chains problem described | |
// at http://socialcam.com/jobs/problems . | |
// | |
// 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. |