Blame
|
1 | # General Notes |
||||||
| 2 | ||||||||
| 3 | ## Offload as much work from the application layer to the database. |
|||||||
| 4 | thoughs here is db is going to be faster than the app layer most of the time. |
|||||||
| 5 | Also its easier to deal with the "distributedness" of a system by just doing it in a in a single spot. |
|||||||
| 6 | ||||||||
| 7 | ||||||||
| 8 | ## unnest is pretty cool for inserting multiple rows: |
|||||||
| 9 | ```sql |
|||||||
|
10 | INSERT INTO table_name (col1, col2, col3) |
||||||
| 11 | SELECT * FROM UNNEST( |
|||||||
| 12 | ARRAY['val1', 'val2', 'val3'], |
|||||||
| 13 | ARRAY['val4', 'val5', 'val6'], |
|||||||
| 14 | ARRAY[1, 2, 3]); |
|||||||
|
15 | ``` |
||||||
