Server๐งค
[Server] Paging, Transaction
yujindonut
2022. 5. 18. 11:41
728x90
Paging
๋ฐ์ดํฐ๋ฅผ ์ํ๋ ๋งํผ ์๋ผ์ ๋ณผ ์ ์๊ฒ
SELECT *
FROM User
LIMIT 0, 5;
// 0 ~ 4๋ฒ์งธ ์ธ๋ฑ์ค์ ๋ฐ์ดํฐ๋ฅผ ๊ฐ์ ธ์ค๊ฒ ๋จ
ํ์ด์ง ๋ฒํธ(x) | ๋ฐ์ดํฐ | (y) | y = pageSize(page - 1) y = 5(x - 1) |
1 | 0,1,2,3,4 | limit 0, 5 | x = 1 , y = 0 |
2 | 5,6,7,8,9 | limit 5, 10 | x = 2, y = 5 |
3 | 10,11,12,13,14 | limit 10, 15 | x = 3, y = 10 |
Transaction
์ ) ์ธ์คํ๊ทธ๋จ ์์ฑ api
์ด๊ธฐ ์ํ -> ๊ฒ์๋ฌผ ์์ฑ -> ๊ฒ์๋ฌผ ์ฌ์ง ์์ฑ -> ๋ฐ์์ํ
๋ง์ฝ ์ด์ค์ ํ๋๋ผ๋ ์ด๋ฃจ์ด์ง์ง ์์ผ๋ฉด ์ด๊ธฐ์ํ๋ก ๋์๊ฐ
๋ฐ์ ( commit )
์ ์ํ๋ก ๋์๊ฐ๋ ๊ฒ ( rollback )
728x90