最近在改一個陳舊的 lamda function,他的主要功能是:
1. 去 A database 撈一堆沒有被處理的使用者 id
2. 去 B C database 撈取要記錄的資料
3. 送到 third party
4. 標記已記錄
但是,在中間我看到
Promise.map((step 1 的 rows), async (row) => {
await step 2 的處理
}, {max-concurrency: 16 });
欸,我就問不能把 stpe1 的 user id 一次性的塞到 step 2 做 query 的條件嗎?一次處理 16 個連線沒錯但萬一users 數量很多這樣也是要處理很久...
之於原因可以問問 chatgpt where in IDs vs query many times with IDs
最近在改一個陳舊的 lamda function,他的主要功能是:
1. 去 A database 撈一堆沒有被處理的使用者 id
2. 去 B C database 撈取要記錄的資料
3. 送到 third party
4. 標記已記錄
但是,在中間我看到
Promise.map((step 1 的 rows), async (row) => {
await step 2 的處理
}, {max-concurrency: 16 });
欸,我就問不能把 stpe1 的 user id 一次性的塞到 step 2 做 query 的條件嗎?一次處理 16 個連線沒錯但萬一users 數量很多這樣也是要處理很久...
之於原因可以問問 chatgpt where in IDs vs query many times with IDs