๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
[๊ฐœ๋ฐœ] Practice/SQL Database

[SQL / Database] ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์˜ ์ข…๋ฅ˜ ์•Œ์•„๋ณด๊ธฐ

by Connecting-the-dots 2023. 5. 25.
728x90
๋ฐ˜์‘ํ˜•

๐Ÿ’ก ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์˜ ์ข…๋ฅ˜

๐Ÿ’œ Key-value Database

  • ๋ฐ์ดํ„ฐ๋ฅผ key-value ํ˜•ํƒœ๋กœ ์ €์žฅํ•˜๋Š” Database ์ด๋‹ค.
  • ์‹ค์šฉ์„ฑ์€ ๋–จ์–ด์ง€๊ธฐ ๋•Œ๋ฌธ์— ์ž์ฃผ ์‚ฌ์šฉํ•˜๋Š” ๋ฐ์ดํ„ฐ ์บ์‹ฑ์ด๋‚˜ ์˜์ƒ์ŠคํŠธ๋ฆฌ๋ฐ, ๋กœ๊ทธ์ธ ๊ธฐ๋ก ์ €์žฅ ๋“ฑ์„ ์œ„ํ•œ ์„œ๋ธŒ์šฉ DB๋กœ ๋งŽ์ด ์‚ฌ์šฉํ•œ๋‹ค.
  • Key-value Database ์ค‘์—์„œ๋Š” 1์ฐจ์ ์œผ๋กœ ํ•˜๋“œ๋””์Šคํฌ๋ณด๋‹ค ์†๋„๊ฐ€ ๋น ๋ฅธ RAM ์— ๋ฐ์ดํ„ฐ๋ฅผ ์ €์žฅํ•˜๊ณ , ํ•˜๋“œ์— ๋ฐฑ์—…ํ•ด๋‘๋Š” ๋ฐฉ์‹์ธ redis ๋ฅผ ๋งŽ์ด ์‚ฌ์šฉํ•œ๋‹ค.

๐Ÿ’œ Relational Database

  • ๋ฐ์ดํ„ฐ๋ฅผ ํ‘œ ํ˜•ํƒœ๋กœ ์ €์žฅํ•˜๋ฉฐ, ํ–‰๋ ฌ(Relation)์—์„œ ๋ช…์นญ์„ ๋”ฐ์˜จ ๊ฒƒ์ผ ๋ฟ ์‹ค์ œ๋กœ ๊ด€๊ณ„(Relation)๋ฅผ ์ค‘์ ์œผ๋กœ ๋‹ค๋ฃจ๊ธฐ์—๋Š” ์–ด๋ ค์šด ์ ์ด ๋งŽ์€ Database ์ด๋‹ค.
  • ์—‘์…€๊ณผ ์œ ์‚ฌํ•˜๋ฉฐ, ๋‹ค์–‘ํ•œ ๊ณณ์—์„œ ์ผ๋ฐ˜์ ์œผ๋กœ ์‚ฌ์šฉํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์ ์œ ์œจ์ด ๋†’์€ ํŽธ์— ์†ํ•œ๋‹ค.
  • ๋Œ€ํ‘œ์ ์ธ Relational Database ๋กœ๋Š” Oracle, MySQL, MariaDB, SQLite, PostgreSQL ๋“ฑ์ด ์žˆ๋‹ค.
  • ๋ณดํ†ต ๋ฐ์ดํ„ฐ๋ฅผ ์ •๊ทœํ™”(์ค‘๋ณต๋˜๋Š” ์š”์†Œ๋Š” ๋‹ค๋ฅธ ํ…Œ์ด๋ธ”๋กœ ๋นผ์„œ ์ค‘๋ณต ์ œ๊ฑฐ)ํ•ด์„œ ์ €์žฅํ•˜๋ฏ€๋กœ, ๋ฐ์ดํ„ฐ ์ž…์ถœ๋ ฅ๋ฌธ๋ฒ•์ด ๋ณต์žกํ•ด์ง„๋‹ค๋Š” ๋‹จ์ ์ด ์กด์žฌํ•œ๋‹ค.
  • ๊ธฐ๋ณธ์ ์œผ๋กœ ACID Transaction ๊ธฐ๋Šฅ์ด ์กด์žฌํ•˜๋ฏ€๋กœ ๊ธˆ์ „๊ฑฐ๋ž˜์™€ ๊ฐ™์€ ์ค‘์š”ํ•œ ๊ธฐ๋Šฅ์„ ๊ตฌํ˜„ํ•  ๋•Œ, ์•ˆ์ „ํ•˜๊ฒŒ ๊ตฌํ˜„ํ•˜๋Š” ๊ฒƒ์ด ๊ฐ€๋Šฅํ•˜๋‹ค.
  • ์ž…์ถœ๋ ฅ ์†๋„๋ณด๋‹ค ์ •ํ™•๋„๊ฐ€ ๋งค์šฐ ์ค‘์š”ํ•œ ์„œ๋น„์Šค๋ผ๋ฉด ์ผ๋ฐ˜์ ์œผ๋กœ Relational Database ๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค.

๐Ÿ’œ Graph Database

  • ๊ด€๊ณ„๋ฅผ ์ค‘์ ์œผ๋กœ ๋ฐ์ดํ„ฐ๋ฅผ ์ €์žฅํ•˜๊ณ  ์‹ถ์„ ๋•Œ ์‚ฌ์šฉํ•˜๋Š” Database ๋กœ, ๋ฐ์ดํ„ฐ๋ฅผ Node ๋กœ ๋งŒ๋“ค๊ณ  Node ๋ผ๋ฆฌ์˜ ๊ด€๊ณ„ ๋ฐ ๋ฐฉํ–ฅ์„ ์ง€์ •ํ•  ์ˆ˜ ์žˆ๋‹ค.
  • ๋น„ํ–‰๊ธฐ ๋…ธ์„ , SNS ์นœ๊ตฌ ๊ด€๊ณ„, ์ฝ”๋กœ๋‚˜ ์ „์—ผ๋งต, ์ถ”์ฒœ ์„œ๋น„์Šค ๋“ฑ์— ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•˜๋‹ค.
  •  ๋Œ€ํ‘œ์ ์ธ Graph Database ๋Š” Sparsity, neo4j, OrientDB, ArangoDB ๋“ฑ์ด ์žˆ๋‹ค.

๐Ÿ’œ Document Database

  • Relational Database ๋ณด๋‹ค ์ž์œ ๋กœ์šด Database ์ด๋‹ค.
  • ๋Œ€ํ‘œ์ ์ธ Document Database ๋กœ๋Š” mongoDB, CouchDB ๋“ฑ์ด ์žˆ๋‹ค.
  • Collection ํด๋” ์•ˆ์— document ํŒŒ์ผ์„ ๋งŒ๋“ค์–ด ๋ฐ์ดํ„ฐ๋ฅผ JSON ํ˜•ํƒœ๋กœ ์ €์žฅํ•  ์ˆ˜ ์žˆ๋‹ค.
  • Relational Database ์™€ ๋‹ฌ๋ฆฌ ๊ฐ‘์ž๊ธฐ ๊ตฌ์กฐ๊ฐ€ ๋ฐ”๋€Œ์–ด๋„ ๋ฌธ์ œ๊ฐ€ ์—†์œผ๋ฏ€๋กœ ์–ด๋–ค ๋ฐ์ดํ„ฐ๋ฅผ ์ €์žฅํ• ์ง€ ๋ฏธ๋ฆฌ ์ •์˜ํ•  ํ•„์š”๋„ ์—†์œผ๋ฉฐ, ์ •๊ทœํ™” ์—†์ด ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ์ผ๋ฐ˜์ ์ด๋ฏ€๋กœ ๋ฐ์ดํ„ฐ ์ž…์ถœ๋ ฅ๋ฌธ๋ฒ•์ด ๊ฐ„๋‹จํ•˜๋‹ค๋Š” ์žฅ์ ์ด ์žˆ๋‹ค.
  • ๋˜ํ•œ, ๋ถ„์‚ฐ์„ ์—ผ๋‘์— ๋‘๊ณ  ๋งŒ๋“ค์–ด์ง„ Database ์ด๋ฏ€๋กœ ๋ถ„์‚ฐ์ฒ˜๋ฆฌ๊ฐ€ ๋งค์šฐ ์ž˜ ๋˜๊ธฐ ๋•Œ๋ฌธ์—, ๋ฐ์ดํ„ฐ์˜ ์ž…์ถœ๋ ฅ์ด ๋งŽ์€ SNS, ์‹ค์‹œ๊ฐ„ ์ฑ„ํŒ…, ๊ฒŒ์‹œํŒ, ์˜จ๋ผ์ธ๊ฒŒ์ž„ ์„œ๋น„์Šค ๋“ฑ์— ๋งŽ์ด ์‚ฌ์šฉํ•œ๋‹ค.
  • Database ๊ฐ„์˜ ์ผ๊ด€์„ฑ ๋ฐ ์ •ํ™•๋„๋Š” ๋–จ์–ด์งˆ ์ˆ˜ ์žˆ์œผ๋ฏ€๋กœ, ์ด๋Ÿฐ ๋ถ€๋ถ„๋“ค์ด ์ค‘์š”ํ•˜์ง€ ์•Š๋‹ค๋ฉด Document Database ๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๋œ๋‹ค.

๐Ÿ’œ Column Family Database

  • Relational Database ์ฒ˜๋Ÿผ ํ‘œ ํ˜•ํƒœ๋กœ ๋ฐ์ดํ„ฐ๋ฅผ ์ €์žฅํ•˜๊ณ  ์‹ถ์ง€๋งŒ, ์กฐ๊ธˆ ๋” ์œ ์—ฐํ•˜๊ฒŒ ์‚ฌ์šฉํ•˜๊ณ  ์‹ถ์„ ๋•Œ ์‚ฌ์šฉํ•˜๋Š” Database ์ด๋‹ค.
  • ๋Œ€ํ‘œ์ ์ธ Column Family Database ๋กœ๋Š” cassandra, Google Cloud Bigtable ๋“ฑ์ด ์žˆ๋‹ค.
  • ํ…Œ์ด๋ธ”์„ ๋งŒ๋“  ํ›„ ๊ฑฐ๊ธฐ์— Row ๋ฅผ ๋งŒ๋“ค๋˜, ๊ฐ Row ๋งˆ๋‹ค ์ž์œ ๋กญ๊ฒŒ Column ์„ ๋งŒ๋“ค๊ณ  ๋ฐ์ดํ„ฐ๋ฅผ ๊ธฐ์ž…ํ•˜์—ฌ ์ €์žฅํ•˜๋Š” ๋ฐฉ์‹์˜ Database ์ด๋‹ค.
  • Row ๋งˆ๋‹ค Column ์ด ๋‹ฌ๋ผ๋„ ์ƒ๊ด€์—†์œผ๋ฉฐ, ์ •๊ทœํ™” ์—†์ด ์‚ฌ์šฉํ•˜๋ฏ€๋กœ ๋ฐ์ดํ„ฐ ์ž…์ถœ๋ ฅ๋ฌธ๋ฒ•์ด ๊ฐ„๋‹จํ•˜๋‹ค๋Š” ์žฅ์ ์ด ์žˆ๋Š” ๋ฐ˜๋ฉด, SQL ์ด ์•„๋‹Œ ํ•ด๋‹น Database ์˜ ์–ธ์–ด๋ฅผ ์‚ฌ์šฉํ•ด์•ผ ํ•œ๋‹ค๋Š” ๋‹จ์ ์ด ์กด์žฌํ•œ๋‹ค.
  • ๋˜ํ•œ, ๋ณต์ œ ๋ฐ ๋ถ„์‚ฐ ์ฒ˜๋ฆฌ๋„ ์ž˜ ๋˜๋ฏ€๋กœ ๋ฐ์ดํ„ฐ์˜ ์ •ํ™•๋„๊ฐ€ ๋–จ์–ด์ง€๋”๋ผ๋„ ๋งŽ์€ ์ž…์ถœ๋ ฅ์ด ํ•„์š”ํ•œ ๊ฒฝ์šฐ ์ ํ•ฉํ•œ  Database ์ด๋‹ค.
  • ๋ฐ์ดํ„ฐ ์ €์žฅ์„ ํ•  ๋•Œ ์‹œ๊ฐ„๊ธฐ๋ก์„ ํŽธํ•˜๊ฒŒ ํ•ด์ฃผ๋Š” ๊ธฐ๋Šฅ์ด ์žˆ์œผ๋ฏ€๋กœ Netflix ์™€ ๊ฐ™์ด ์‹œ๊ณ„์—ด ๋ฐ์ดํ„ฐ๋ฅผ ๋ถ„์„ ๋ฐ ์ €์žฅํ•  ๋•Œ Column Family Database ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ๋„ ์กด์žฌํ•œ๋‹ค.

๐Ÿ’œ Search Engine

  • ๋น ๋ฅด๊ฒŒ ๋ฐ์ดํ„ฐ ๊ฒ€์ƒ‰์„ ๋„์™€์ค„ ์ˆ˜ ์žˆ๋„๋ก ๊ฒ€์ƒ‰์šฉ ์ธ๋ฑ์Šค๋ฅผ ๋ณด๊ด€ํ•˜๊ธฐ ์œ„ํ•œ Database ์ด๋‹ค.
  • ๋Œ€ํ‘œ์ ์œผ๋กœ elastic, Amazon CloudSearch, Google Cloud Search ๋“ฑ์ด ์žˆ๋‹ค.
  • ์‹ค์‹œ๊ฐ„ ๊ฒ€์ƒ‰์–ด, ์ถ”์ฒœ ๊ฒ€์ƒ‰์–ด, ๊ฒ€์ƒ‰์–ด ์˜คํƒ€๊ต์ • ๋“ฑ์˜ ์„œ๋น„์Šค์— ์‚ฌ์šฉ๋˜๋Š” Database ๋กœ, ๊ฒ€์ƒ‰์ด ์ค‘์š”ํ•œ ์‚ฌ์ดํŠธ๋ฅผ ๋งŒ๋“ค ๋•Œ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ๋งŽ๋‹ค.
728x90
๋ฐ˜์‘ํ˜•