- 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:
package main | |
import ( | |
"fmt" | |
"reflect" | |
) | |
type Aaa struct { | |
a string | |
} |
Ref : stackoverflow
The best solution in my opinion is to use the unittest
[command line interface][1] which will add the directory to the sys.path
so you don't have to (done in the TestLoader
class).
For example for a directory structure like this:
new_project
├── antigravity.py
cmake_minimum_required(VERSION 2.8.3) | |
project(pycpp_test) | |
find_package(catkin REQUIRED COMPONENTS | |
roscpp | |
) | |
find_package(PythonLibs 3.4 EXACT) | |
catkin_package() |
Any running process has several memory regions: code, read-only data, read-write data, et cetera. Some regions, such as code and read-only data, are static and do not change over time. Other regions are dynamic: they can expand and shrink. Usually there are two such regions: dynamic read-write data region, called heap, and a region called stack. Heap holds dynamic memory allocations, and stack is mostly used for keeping function frames.
Both stack and heap can grow. An OS doesn't know in advance whether stack or heap will be used predominantly. Therefore, an OS must layout these two memory regions in a way to guarantee maximum space for both. And here is the solution:
- Layout static memory regions at the edges of process's virtual memory
- Put heap and stack on edges too, and let them grow towards each other: one grows up, one grows down
// Assumption: you have a variable named "pyobj" which is | |
// a pointer to an instance of PyUnicodeObject. | |
PyObject* temp = PyUnicode_AsASCIIString(pyobj); | |
if (NULL == temp) { | |
// Means the string can't be converted to ASCII, the codec failed | |
printf("Oh noes\n"); | |
return; | |
} |
-- Firstly, remove PRIMARY KEY attribute of former PRIMARY KEY
ALTER TABLE <table_name> DROP CONSTRAINT <table_name>_pkey;
-- Then change column name of your PRIMARY KEY and PRIMARY KEY candidates properly.
ALTER TABLE <table_name> RENAME COLUMN <primary_key_candidate> TO id;
package main | |
import ( | |
"fmt" | |
"runtime" | |
) | |
func MaxParallelism() int { | |
maxProcs := runtime.GOMAXPROCS(0) | |
numCPU := runtime.NumCPU() |
#SOA Manifesto
In 2002, Jeff Bezos (CEO of Amazon), issued a mandate requiring all teams to expose their data and functionality through services interfaces. Jeff Bezos understood that in order for his company to be successful, he had to switch focus from creating a "perfect product" to creating a perfect platform for that product.
He mandated that:
- All teams will henceforth expose their data and functionality through service interfaces
- Teams must communicate with each other through these interfaces
- There will be no other form of interprocess communication allowed: no direct linking, no direct reads of another team's data store, no shared-memory model, no back-doors whatsoever. The only communication is via service interface calls over the network.
- It doesn't matter what [API protocol] technology you use
// -*- coding: utf-8 -*- | |
// 参考: 床井研究室 - (4) シェーダの追加 | |
// http://marina.sys.wakayama-u.ac.jp/~tokoi/?date=20120909 | |
package main | |
import ( | |
gl "github.com/chsc/gogl/gl33" | |
"github.com/jteeuwen/glfw" | |
"log" | |
"unsafe" |