System Design Basics for Backend Developers · บทเรียน

ฐานข้อมูลและตัวเลือกพื้นที่จัดเก็บ

สำรวจประเภทฐานข้อมูลต่าง ๆ (เชิงสัมพันธ์, NoSQL) และโซลูชันพื้นที่จัดเก็บหลากหลายสำหรับข้อมูลถาวร

บทเรียน 2 จาก 411 ขั้นตอน

ฐานข้อมูลและตัวเลือกพื้นที่จัดเก็บ เป็นบทเรียน System Design Basics for Backend Developers ฟรีบน CoddyKit นี่คือบทเรียนที่ 2 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน System Design Basics for Backend Developers และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส System Design Basics for Backend Developers มีบทเรียนทั้งหมด 4 บทเรียน

บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ

Storing Your System's Data

Every application needs to store information. Think about user profiles, product catalogs, or posts on a social media app. This data needs to be saved reliably and retrieved quickly.

In system design, choosing the right storage solution is crucial for performance, scalability, and reliability.

Understanding Persistent Data

Persistent data is information that remains stored even after the application or computer system that created it has been shut down or restarted.

  • It's different from data held in memory (like RAM), which is lost when power is off.
  • Databases are the most common way to store persistent data in backend systems.

Why Use a Database?

Databases are specialized systems designed for efficient storage, organization, and retrieval of persistent data. They offer several advantages:

  • Organization: Structure data logically.
  • Efficiency: Fast searching and updates.
  • Integrity: Rules to keep data consistent and valid.
  • Concurrency: Handle many users accessing data at once.

Meet Relational Databases (SQL)

Relational databases are perhaps the most traditional type. They store data in tables, which are like spreadsheets with rows and columns.

  • Each table represents an entity (e.g., "Users", "Products").
  • Tables are linked together by relationships, using common columns.
  • They use SQL (Structured Query Language) for managing and querying data.

Examples include MySQL, PostgreSQL, Oracle, and SQL Server.

SQL Database Structure Example

Imagine a simple user table in a relational database:

TABLE Users:
id (PRIMARY KEY)
username (VARCHAR)
email (VARCHAR)
created_at (DATETIME)

Each row would be a user, and columns define their attributes. Relationships can link users to their orders, for instance.

Discover NoSQL Databases

NoSQL databases (short for "Not only SQL") offer more flexibility than relational databases. They don't use the traditional table-based structure.

NoSQL databases are often chosen for their:

  • Scalability: Easier to scale horizontally across many servers.
  • Flexibility: Handle unstructured or semi-structured data.
  • Performance: Optimized for specific data models.

Examples include MongoDB, Cassandra, Redis, and Neo4j.

NoSQL: Document Database Example

One common NoSQL type is a document database. It stores data in flexible, JSON-like documents. Here's how a user might be stored:

{
"_id": "user123",
"username": "coddykit_user",
"email": "user@example.com",
"profile": {
"firstName": "Coddy",
"lastName": "Kit",
"bio": "Learning backend systems"
},
"interests": ["tech", "coding", "design"]
}

Beyond Databases: Other Storage

While databases are primary for structured data, systems often need other storage types:

  • Object Storage: Stores large, unstructured data files (images, videos, backups). Think Amazon S3.
  • File Storage: Traditional file systems, often network-attached (NFS) for shared access.
  • Block Storage: Provides raw storage volumes that act like a hard drive, often used by virtual machines.

Making the Right Choice

Choosing the right storage depends on your specific needs:

  • Data Structure: Is your data highly structured (like financial records) or flexible (like user profiles with varying fields)?
  • Scalability: How much data will you store, and how many users will access it?
  • Consistency: How critical is it that all users see the absolute latest data at all times?

This decision is a cornerstone of system design.

Quick Check: Data Storage

Relational (SQL) and Non-Relational (NoSQL) databases have distinct characteristics. Select the statements that are generally true about Relational (SQL) Databases.

Recap: Databases & Storage

Great job! In this lesson, we explored the fundamentals of data storage in backend systems.

  • We learned about persistent data and why databases are essential.
  • We introduced Relational (SQL) databases, known for their structured tables and strong consistency.
  • We also covered Non-Relational (NoSQL) databases, offering flexibility and horizontal scalability.
  • Finally, we touched upon other storage types like object, file, and block storage.

Understanding these options is key to designing robust systems!

เริ่มต้นได้ฟรี

เรียนรู้ System Design Basics for Backend Developers ด้วย AI tutor — ฟรี

เขียนและเรียกใช้โค้ดจริงในเบราว์เซอร์ของคุณ รับความช่วยเหลือทันทีจาก AI tutor 24/7 และเรียนรู้ต่อจากที่คุณหยุดบนเว็บหรือในแอป

คอร์ส
12
บทเรียน
48

คำถามที่พบบ่อย

บทเรียน “ฐานข้อมูลและตัวเลือกพื้นที่จัดเก็บ” ฟรีหรือไม่

ใช่ — ข้อความเต็มของ “ฐานข้อมูลและตัวเลือกพื้นที่จัดเก็บ” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส System Design Basics for Backend Developers ให้อัปเกรดเป็น CoddyKit PRO คอร์ส System Design Basics for Backend Developers มีบทเรียนทั้งหมด 4 บทเรียน

คุณจะเรียนรู้อะไรในบทเรียน “ฐานข้อมูลและตัวเลือกพื้นที่จัดเก็บ”

สำรวจประเภทฐานข้อมูลต่าง ๆ (เชิงสัมพันธ์, NoSQL) และโซลูชันพื้นที่จัดเก็บหลากหลายสำหรับข้อมูลถาวร คุณปฏิบัติ System Design Basics for Backend Developers ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน

คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน System Design Basics for Backend Developers หรือไม่

ไม่จำเป็นต้องมีประสบการณ์มาก่อน System Design Basics for Backend Developers บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 2 จากทั้งหมด 4 บทเรียน

บทเรียน “ฐานข้อมูลและตัวเลือกพื้นที่จัดเก็บ” ใช้เวลานานแค่ไหน

บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย

ฉันเขียนและรันโค้ดในบทเรียน System Design Basics for Backend Developers นี้ได้ไหม

ได้ บทเรียน System Design Basics for Backend Developers ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ

บทเรียนทั้งหมดในหลักสูตรนี้

  1. ไคลเอ็นต์ เซิร์ฟเวอร์ และ API
  2. ฐานข้อมูลและตัวเลือกพื้นที่จัดเก็บ
  3. ตัวกระจายโหลดและแคช
  4. คิวข้อความและการประมวลผลแบบไม่พร้อมกัน
← กลับไปที่ System Design Basics for Backend Developers