Hoai-Nho-Logo

/

Blog

AboutProjectsBlogContact

All topics

Architecture & Design

Architecture & Design
Discover cutting-edge architecture and design ideas. Explore innovative projects, modern interior design trends, sustainable architecture, and creative design solutions to inspire your next project.aws saa-c03
AWS

Explore best practices, tutorials, case studies, and insights on leveraging AWS’s vast ecosystem to build, deploy, and manage applications in the cloud

Design patterns

The Design Pattern category explores reusable solutions to common software design challenges, helping developers write efficient, maintainable, and scalable code

Docker
Explore essential Docker tutorials and resources. Find helpful tips, best practices, and tools to master containerization and improve your deployment workflow.
Security

The Security category focuses on best practices, tools, and frameworks essential for protecting applications, data, and infrastructure in an increasingly digital world

SSL license expired?

Ultimate Guide to Renewing SSL Certificates: Secure Your Website in 2024

Ensure your website stays secure! 🔒 Learn how to check, renew, and manage your SSL certificate to prevent security risks and downtime. Follow our step-by-step guide with best practices to keep your HTTPS protection active in 2024!

CSS

Database

Database
Find easy-to-follow guides on database SQL, NoSQL, PostgreSQL, and MySQL. Learn how to make databases that are fast and work well. Get tips to improve your skills. database
MySQL
Discover essential database guides covering SQL, NoSQL, and best practices. Get tips and performance benchmarks to improve your data management skills.
NoSQL
Discover essential database guides covering SQL, NoSQL, and best practices. Get tips and performance benchmarks to improve your data management skills.
PostgreSQL
Explore comprehensive PostgreSQL tutorials and resources. Find helpful tips, best practices, and performance benchmarks to enhance your database skills.
Search topic

LIKE vs Full-Text Search: SQL Performance and Use Cases

Explore the differences between SQL’s LIKE operator and Full-Text Search. Learn their syntax, performance, use cases, and advanced features for optimizing database queries

Generation

Interview Question

NodeJS

NodeJS
Explore beginner to advanced tutorials on JavaScript and TypeScript. Find helpful tips, best practices, and tools to create powerful web applications. typescript_vs_javascript
Javascript/Typescript
Learn JavaScript and TypeScript with easy guides. Discover tips, best practices, and tools to build efficient web applications quickly.
tripple-cache

🚀 Triple-Layered Web Caching Strategy: How Memory, IndexedDB and HTTP Cache Improved Speed by 96%

Discover how to accelerate your website through our powerful triple-layered caching strategy combining Memory Cache, IndexedDB, and HTTP Cache. Detailed guidance from theory to practice helps reduce page load time by up to 96%, improve user experience, and optimize performance across all devices.

  1. Home
  2. /Blog
  3. /Database Mastery: Essential Knowledge for Senior Engineers

Database Mastery: Essential Knowledge for Senior Engineers

Unlock the core concepts and advanced techniques of database management tailored for senior engineers. This guide covers performance optimization, recovery strategies, scalability, and essential best practices to elevate your database expertise.

Hoài Nhớ@hoainho
December 06, 2024
|

3 min read

|

129 Views

Share:
  • Position: Senior Software Engineer
  • Interview Time: Sep 2024
  • Company Type: Health Care
  • Company Name: Private

1. DELETE vs TRUNCATE

Question: What are the key differences between DELETE and TRUNCATE?

Answer:

  • DELETE: Removes specific rows based on a condition; logs each deleted row, allowing rollback in transactions. Slower due to logging overhead.
  • TRUNCATE: Removes all rows in a table; logs only metadata changes, making it faster. Cannot be rolled back in most cases.
Question: When should you prefer DELETE over TRUNCATE?

Answer: Use DELETE when:

  • You need to conditionally remove specific rows.
  • Maintaining referential integrity with foreign key constraints is critical.

2. Stored Procedure vs Trigger vs Function

Question: What is the primary purpose of stored procedures?

Answer: Stored procedures encapsulate reusable business logic and can perform complex operations involving multiple queries.

Question: How do triggers differ from functions?

Answer:

  • Triggers: Automatically execute in response to database events like INSERT, UPDATE, or DELETE. Ideal for enforcing constraints or auditing.
  • Functions: Used to compute and return values. Called explicitly within queries or procedures.

3. Sync SQL vs NoSQL

Question: What are the key advantages of SQL over NoSQL?

Answer: SQL excels in structured data and complex queries with strict ACID compliance, ensuring consistency.

Question: When is NoSQL more suitable?

Answer: NoSQL is ideal for:

  • Handling unstructured or semi-structured data.
  • Applications needing horizontal scaling, such as social media platforms.

4. Aggregate vs Full-Text Search in NoSQL

Question: How do aggregate queries work in NoSQL?

Answer: Aggregate queries (like MongoDB’s aggregation framework) process data pipelines to compute results, such as totals and averages.

Question: What is the advantage of full-text search in NoSQL?

Answer: Full-text search, often powered by indexes, allows querying natural language data efficiently, making it great for applications like search engines.


5. LIKE vs Full-Text Search in SQL

Question: Why is LIKE slower than full-text search?

Answer: LIKE scans data sequentially and lacks optimized indexing, whereas full-text search uses specialized indices for faster pattern matching.

Question: When should LIKE be used?

Answer: Use LIKE for simple, lightweight pattern searches when full-text indexing isn’t configured.


6. When to Use SQL vs NoSQL

Question: How do you choose between SQL and NoSQL?

Answer:

  • Choose SQL for financial or healthcare systems needing consistency.
  • Choose NoSQL for distributed systems prioritizing speed and scalability.

7. Sharding in NoSQL

Question: What is sharding?

Answer: Sharding partitions a database horizontally across multiple servers, improving scalability by distributing load.

Question: When is sharding beneficial?

Answer: For high-traffic applications where data can be split logically (e.g., by user ID).


8. Schema Design in SQL

Question: What is normalization?

Answer: Normalization reduces redundancy by organizing data into related tables. For example, 3NF ensures no transitive dependencies.

Question: When should you denormalize?

Answer: In read-heavy applications to improve query performance by reducing JOINs.


9. Query Optimization in SQL

Question: What are common query optimization techniques?

Answer:

  • Use EXPLAIN to analyze query execution plans.
  • Add indexes to frequently queried columns.
  • Optimize JOINs with proper indexing.

10. Polyglot Persistence

Question: What is polyglot persistence?

Answer: Using multiple types of databases (SQL and NoSQL) in the same application to leverage their respective strengths.

Question: When is polyglot persistence suitable?

Answer: For complex systems needing structured data (SQL) and unstructured data (NoSQL), such as e-commerce platforms.


🔗 Explore More Insightful Blogs!

Visit the original website for more in-depth articles and resources tailored for developers like you. 🚀


Tags:
BackendDatabase QuestionsTech Interview
Written by

author
Hoài Nhớ

Hoài Nhớ

@Hoài Nhớ
BackendDatabase QuestionsTech Interview

Table of Contents

    References posts

    LIKE vs Full-Text Search: SQL Performance and Use Cases

    Explore the differences between SQL’s LIKE operator and Full-Text Search. Learn their syntax, performance, use cases, and advanced features for optimizing database queries

    Hoài Nhớ
    Top 10 Database Optimization and Recovery Strategies for Senior Software Engineers

    Master essential database concepts like indexing, query optimization, caching, partitioning, failover, and recovery strategies with these expert insights. Perfect for senior software engineers preparing for interviews.

    Hoài Nhớ
    Step-by-Step Guide: Setting Up Git and Shell Aliases on All Operating Systems

    Learn how to create Git and shell aliases on Windows, macOS, and Linux. Follow this step-by-step guide to save time, boost productivity, and ensure your shortcuts work perfectly.

    Hoài Nhớ
    Related Posts

    Search topic
    ElasticSearchFull-Text Search
    LIKE vs Full-Text Search: SQL Performance and Use Cases

    Explore the differences between SQL’s LIKE operator and Full-Text Search. Learn their syntax, performance, use cases, and advanced features for optimizing database queries

    Hoài Nhớ
    Database optimization
    Backend PerformanceDatabase
    Top 10 Database Optimization and Recovery Strategies for Senior Software Engineers

    Master essential database concepts like indexing, query optimization, caching, partitioning, failover, and recovery strategies with these expert insights. Perfect for senior software engineers preparing for interviews.

    Hoài Nhớ
    Git alias
    Git AliasTips
    Step-by-Step Guide: Setting Up Git and Shell Aliases on All Operating Systems

    Learn how to create Git and shell aliases on Windows, macOS, and Linux. Follow this step-by-step guide to save time, boost productivity, and ensure your shortcuts work perfectly.

    Hoài Nhớ
    Github Action
    CI/CDGithub Action
    Github Action Interview: CICD Pipeline

    GitHub Actions is a CI/CD tool tightly integrated with GitHub, allowing developers to automate workflows directly within their repositories.

    Hoài Nhớ
    Database image
    Backup DatabaseDatabase Replica
    Mastering Databases: From Optimizing Queries to Distributed Systems

    Databases are at the core of modern applications, from e-commerce to social platforms, powering billions of transactions every second. In this blog, we’ll explore key concepts that every software engineer should understand—ranging from JOINs, partitioning, sharding, and query optimization to security best practices. This post serves as a comprehensive guide to help you understand, design, […]

    Hoài Nhớ

    Subscribe to our newsletter

    Get the latest posts delivered right to your inbox


    © 2025 Hoai Nho. All rights reserved.

    ContactGitHubLinkedIn