code-appender / sql-tuning-level-up

Database learning using sql-level-up
MIT License
3 stars 0 forks source link

[๐Ÿ’กQuestion] 3์ฃผ์ฐจ_p152_ #25

Closed ranunclulus closed 5 months ago

ranunclulus commented 5 months ago

โ“์ด๋Ÿฐ ๋‚ด์šฉ์ด ๊ถ๊ธˆํ•ด์š”.

์ธ๋ฑ์Šค ๊ตฌ์กฐ ํ…Œ์ด๋ธ”์ด ๋žœ๋ค ์•ก์„ธ์Šค๊ฐ€ ๋ฐœ์ƒํ•˜์ง€ ์•Š์„ ์ •๋„๋กœ ์ข‹์€๋ฐ ์–ด๋–ค ๋ฌธ์ œ์ ์ด ์žˆ์–ด์„œ ํ…Œ์ด๋ธ”์„ ๋งŒ๋“ค ๋•Œ ๊ธฐ๋ณธ์ ์ธ ์˜ต์…˜์€ ํž™ ๊ตฌ์กฐ๋กœ ๋งŒ๋“œ๋Š” ๊ฑด๊ฐ€์š”??

juhee77 commented 5 months ago

์ธ๋ฑ์Šค ๊ตฌ์กฐ ํ…Œ์ด๋ธ” (IOT , ํด๋Ÿฌ์Šคํ„ฐํ˜• ์ธ๋ฑ์Šค)

ํ•ด๋‹น ์ธ๋ฑ์Šค ๊ตฌ์กฐ๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ํ…Œ์ด๋ธ” ๋ธ”๋ก์— ์žˆ์–ด์•ผํ•  ๋ฐ์ดํ„ฐ๋ฅผ ์ธ๋ฑ์Šค ๋ฆฌํ”„ ๋ธ”๋ก์— ๋ชจ๋‘ ์ €์žฅํ•˜๊ณ  ์žˆ๋‹ค(์ฆ‰, ์ธ๋ฑ์Šค ๋ฆฌํ”„ ๋ธ”๋ก์ด ๊ณง ๋ฐ์ดํ„ฐ ๋…ธ๋“œ์ด๋‹ค) , ๋ฌผ๋ฆฌ์ ์œผ๋กœ ์ •๋ ฌ ๋˜์–ด์žˆ๋‹ค. ์žฅ์ :

  1. ํŠน์ • ๊ฒ€์ƒ‰ ์ฟผ๋ฆฌ ์„ฑ๋Šฅ์ด ํ–ฅ์ƒ ๋œ๋‹ค.
  2. ๋ฒ”์œ„ ๊ฒ€์ƒ‰์— ํšจ์œจ์ ์ด๋‹ค.
  3. ๋žœ๋ค ์•ก์„ธ์Šค๊ฐ€ ๊ฐ์†Œํ•œ๋‹ค.

๋‹จ์ :

  1. ๋ ˆ์ฝ”๋“œ๋ฅผ ์ˆ˜์ •, ์‚ฝ์ž… ํ• ๋•Œ๋งˆ๋‹ค ๋ฐ์ดํ„ฐ๋ฅผ ์ •๋ ฌ๋œ ์ƒํƒœ๋กœ ์œ ์ง€ํ•˜๊ธฐ ์œ„ํ•œ ์ถ”๊ฐ€ ์ž‘์—…์ด ๋ฐœ์ƒํ•˜์—ฌ ์˜ค๋ฒ„ํ—ค๋“œ๊ฐ€ ํฌ๋‹ค.
  2. ๋นˆ ๊ณต๊ฐ„์— ๋Œ€ํ•œ ๊ด€๋ฆฌ๊ฐ€ ํ•„์š”ํ•˜๋‹ค.
  3. ์‚ฝ์ž… ์‚ญ์ œ๊ฐ€ ๋นˆ๋ฒˆํ•œ OLTP ํ™˜๊ฒฝ์—์„œ๋Š” ํด๋Ÿฌ์Šคํ„ฐ๋“œ ์ธ๋ฑ์Šค ํ…Œ์ด๋ธ”์˜ ์œ ์ง€ ๊ด€๋ฆฌ๋น„๊ฐ€ ์ƒ์Šนํ•˜์—ฌ ํž™ ๊ตฌ์กฐ๋ณด๋‹ค ์„ฑ๋Šฅ์ด ์ €ํ•˜๋  ์ˆ˜ ์žˆ๋‹ค.
  4. ํ…Œ์ด๋ธ”๋‹น ํ•œ ๊ฐœ์”ฉ๋งŒ ํ—ˆ์šฉ๋œ๋‹ค.
  5. PK์„ค์ •์‹œ ์ž๋™์œผ๋กœ ํด๋Ÿฌ์Šคํ„ฐ๋“œ ์ธ๋ฑ์Šค๊ฐ€ ์ƒ์„ฑ๋œ๋‹ค.

ํž™ ๊ตฌ์กฐ ํ…Œ์ด๋ธ”

์žฅ์  :

  1. ๋น ๋ฅธ ์‚ฝ์ž…
  2. ํšจ์œจ์  ๊ณต๊ฐ„ ์‚ฌ์šฉ
  3. ์„ฑ๋Šฅ ์ตœ์ ํ™” ๋“ฑ์— ์œ ๋ฆฌํ•˜๋‹ค.

๋‹จ์  :

  1. ํŠน์ • ๊ฒ€์ƒ‰ ์ฟผ๋ฆฌ ์„ฑ๋Šฅ์ด ๋‚ฎ์„ ์ˆ˜ ์žˆ๋‹ค
  2. ๋ฒ”์œ„ ๊ฒ€์ƒ‰์— ๋น„ํšจ์œจ์  ์ด๋‹ค.

์ฆ‰, ํž™ ๊ตฌ์กฐ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ํ…Œ์ด๋ธ”์„ ๋งŒ๋“œ๋Š” ์ด์œ ๋Š” ์‚ฝ์ž…, ์‚ญ์ œ์— ๋Œ€ํ•œ ์„ฑ๋Šฅ๊ณผ ๊ณต๊ฐ„ ์ตœ์ ํ™”๊ฐ€ ๊ฐ€์žฅ ํฐ ๋ชฉ์ ์ด๋‹ค.

๋”๋ถˆ์–ด, ํด๋Ÿฌ์Šคํ„ฐ ์ธ๋ฑ์Šค์™€ ๋„Œ ํด๋Ÿฌ์Šคํ„ฐ ์ธ๋ฑ์Šค์˜ ์ฐจ์ด

image

์ฐธ๊ณ 

https://mongyang.tistory.com/75 https://velog.io/@sweet_sumin/%ED%81%B4%EB%9F%AC%EC%8A%A4%ED%84%B0%EB%93%9C-%EC%9D%B8%EB%8D%B1%EC%8A%A4-Clustered-Index-%EB%84%8C-%ED%81%B4%EB%9F%AC%EC%8A%A4%ED%84%B0%EB%93%9C-%EC%9D%B8%EB%8D%B1%EC%8A%A4-Non-Clustered-Index https://swingswing.tistory.com/3