max_connections
- set to useful peak
- above 200, look at conn pooler
- consider
superuser_reserved_connections
shared_buffers
- shared RAM
- amt of memory pg takes for itself
- generally, avail ram ÷ 4
updated_at
column, about 17M rows, aptible postgres ~800 IOPS: 455.8086s# TYPE /a in vim | |
select(0x1, 0x7FFF5DD1C850, 0x7FFF5DD1C7D0, 0x7FFF5DD1C750, 0x7FFF5DD1C8D8) = 0 0 | |
lseek(0x3, 0x2000, 0x0) = 8192 0 | |
dtrace: error on enabled probe ID 2132 (ID 320: syscall::write:return): invalid kernel access in action #12 at DIF offset 92 | |
select(0x1, 0x7FFF5DD1C720, 0x7FFF5DD1C6A0, 0x7FFF5DD1C620, 0x7FFF5DD1C7A8) = 0 0 | |
fsync(0x3, 0x7FFF5DD1C720, 0x7FFF5DD1C6A0) = 0 0 | |
select(0x1, 0x7FFF5DD1C770, 0x7FFF5DD1C6F0, 0x7FFF5DD1C670, 0x7FFF5DD1C7F8) = 0 0 | |
select(0x1, 0x7FFF5DD1C850, 0x7FFF5DD1C7D0, 0x7FFF5DD1C750, 0x0) = 1 0 |
alert(); |
/* quickly/hackily create randomish string data with md5 */ | |
DELIMITER $$ | |
DROP PROCEDURE IF EXISTS user_promos; | |
CREATE PROCEDURE user_promos() | |
BEGIN | |
DECLARE i INT DEFAULT 1; | |
WHILE i < 5000 DO |
I hereby claim:
To claim this, I am signing this object:
http://bonesmoses.org/2016/07/15/pg-phriday-a-postgres-persepctive-on-mongodb/ | |
CREATE TABLE sensor_log ( | |
id SERIAL NOT NULL PRIMARY KEY, | |
location VARCHAR NOT NULL, | |
reading BIGINT NOT NULL, | |
reading_date TIMESTAMP NOT NULL | |
); | |
\timing | |
# useful if k is a very large list, and you don't want to do it all in one request | |
# note that consistency will not be guaranteed here (i.e. list can change during iteration) | |
def scan_list(k, range=1000, &block) | |
i = 0 | |
result = [] | |
while l = HLR.lrange(k, i, i+range) | |
break if l.size == 0 | |
if block_given? | |
yield l | |
else |
# List users by average and maximum session length. | |
SELECT person, max(client.runtime_ms), avg(client.runtime_ms) | |
FROM item_occurrence | |
GROUP BY 1 | |
ORDER BY 2 DESC | |
# List active date ranges for each deploy. | |
SELECT client.javascript.code_version, min(timestamp), max(timestamp) | |
FROM item_occurrence | |
GROUP BY 1 |