General Notes

Offload as much work from the application layer to the database.

thoughs here is db is going to be faster than the app layer most of the time. Also its easier to deal with the "distributedness" of a system by just doing it in a in a single spot.

unnest is pretty cool for inserting multiple rows:

    INSERT INTO table_name (col1, col2, col3)
    SELECT * FROM UNNEST(
    ARRAY['val1', 'val2', 'val3'],
    ARRAY['val4', 'val5', 'val6'],
    ARRAY[1, 2, 3]
);
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9