Best of DatabaseDecember 2024

  1. 1
    Article
    Avatar of communityCommunity Picks·1y

    Learn SQL while solving crimes! SQL Police Department

    Structured Query Language (SQL) is a powerful language used to access and manipulate data in tables. Key operations include selecting all or specific columns, filtering and sorting rows, eliminating duplicates, and using conditional statements to refine data queries. Understanding these basics enables effective data management and retrieval.

  2. 2
    Article
    Avatar of communityCommunity Picks·1y

    SQL Cheat Sheet: The Ultimate Guide to All Types of SQL JOINS

    SQL joins are essential for combining data from multiple tables based on common columns. This guide covers various types of joins such as INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL JOIN, SELF JOIN, and CROSS JOIN, explaining their syntax and usage. Understanding these joins is crucial for effective data retrieval and integration in relational databases.

  3. 3
    Article
    Avatar of mercariMercari Engineering·1y

    The Race Condition in multiple DB transactions and the solutions

    Race conditions can occur when using multiple database transactions in a single API request, especially in systems with high concurrency. This post outlines the challenges faced by the Merpay Balance team, who encountered race conditions while processing debt repayments. They evaluated solutions such as rollback, lock mechanisms, and merging transactions, ultimately choosing a lock mechanism to ensure only one request processes repayments at a time. The implementation details, including challenges and considerations, are shared for developers facing similar issues.

  4. 4
    Article
    Avatar of hnHacker News·1y

    pgroll

    pgroll simplifies zero-downtime schema migrations for PostgreSQL by automating data backfills and using PostgreSQL views to support simultaneous old and new schemas. It handles the complex steps of schema changes with its expand-and-contract pattern and integrates seamlessly with development and deployment pipelines. The tool offers enhanced functionality in its cloud version and ensures safe, reversible schema changes with instant rollbacks.

  5. 5
    Article
    Avatar of hnHacker News·1y

    Olshansk/postgres_for_everything: How to reduce complexity and move faster? Just Postgres for everything.

    Using PostgreSQL simplifies development by handling a wide variety of tasks including cron jobs, message queues, GIS & mapping, search, caching, and more. It shows PostgreSQL’s versatility and provides a repository of resources to use PostgreSQL for various purposes. Contributors are encouraged to submit new examples to enrich this collection.

  6. 6
    Article
    Avatar of tdsTowards Data Science·1y

    SQLite in Modern Web Production: Dreams Becoming Reality

    SQLite is becoming a production-ready database for modern web applications due to its simplicity, reduced complexity, and cost benefits. Unlike the traditional client-server architecture, SQLite uses a single-file architecture, enabling applications to handle data directly from one file. Despite challenges like concurrency issues, advancements such as immediate transaction modes and write-ahead logging, along with the transition from HDD to SSD, have improved SQLite's reliability and performance. Simple backup solutions and tools like Litestream further ensure safety and real-time replication of database changes.

  7. 7
    Video
    Avatar of t3dotggTheo - t3․gg·1y

    Prisma is removing Rust?

    Prisma is transitioning its core logic from Rust to TypeScript to improve performance, extensibility, and community contributions. This move aligns with Prisma's new manifesto aimed at setting clear priorities and managing issues effectively. The manifesto also highlights a commitment to supporting first-class databases, ensuring smooth integration and compatibility for future developments. Additionally, Prisma plans to remain engaged with the community through transparent communication and regular updates.

  8. 8
    Article
    Avatar of communityCommunity Picks·1y

    DELETEs are difficult

    DELETE operations in databases, particularly PostgreSQL, can pose significant challenges and are often overlooked compared to SELECT and INSERT operations. DELETE commands involve several steps, including row identification, lock acquisition, trigger execution, marking rows for deletion, index updates, and more. This process may lead to bloat, necessitating autovacuum processes to reclaim space. Strategies such as batching DELETE operations, using partitioning, and managing autovacuum settings are essential for maintaining database performance and efficiency.

  9. 9
    Article
    Avatar of baeldungBaeldung·1y

    Dynamic Spring Data JPA Repository Query With Arbitrary AND Clauses

    This tutorial explores three approaches to creating dynamic queries in Spring Data JPA repositories: Query by Example, Query by Specification, and QueryDSL. The post provides a detailed setup for each method, including code examples for entity classes, repository definitions, and querying logic. It compares these methods based on their complexity and suitability for different types of queries.

  10. 10
    Article
    Avatar of communityCommunity Picks·1y

    Nobody told me I would miss my JOINs when I started in microservices.

    Managing data in a microservices architecture can be challenging, especially replicating the efficiency of JOINs in a relational database. Moving to microservices often involves turning simple JOIN operations into latency-heavy HTTP calls. Solutions include data replication, materialized views, event-driven replication, and batch data sync, each with its own pros and cons. Selecting the right approach depends on understanding specific performance, consistency, and scalability needs.

  11. 11
    Video
    Avatar of primeagenThePrimeTime·1y

    The SQLite Rewrite In Rust

    A new project, Limbo, is aiming to rewrite SQLite in Rust with improved features. The motivation behind this initiative is to create an open-source, memory-safe alternative with enhancements like native replication, vector search, and asynchronous I/O. Limbo is designed from the ground up for modern environments, including WebAssembly (wasm) support. The project already shows promising benchmarks and has gained substantial community interest and contributions. Deterministic simulation testing is being used to ensure reliability and robustness akin to SQLite.

  12. 12
    Article
    Avatar of tdsTowards Data Science·1y

    PostgreSQL: Query Optimization for Mere Humans

    Learn how to optimize PostgreSQL queries using the EXPLAIN and EXPLAIN ANALYZE commands. Understand the structure of execution plans to identify bottlenecks, and apply practical tips for improving performance through indexing and various scanning methods. Explore tools like eversql, metis, and QueryFlow for advanced optimization.

  13. 13
    Article
    Avatar of communityCommunity Picks·1y

    Document Store using JSONB in Postgres

    JSONB in Postgres allows the storage and querying of nested JSON-like data. This guide explains how to set up a table with a JSONB column, insert and query JSONB data, use Sequelize ORM, index JSONB fields, and perform type casting and updates. GIN indexes can improve query performance on JSONB properties.

  14. 14
    Article
    Avatar of lobstersLobsters·1y

    How bloom filters made SQLite 10x faster

    Researchers used Bloom filters to enhance SQLite's performance for analytical queries by 7x-10x. They focused on reducing expensive B-tree probes during join operations by implementing new opcodes that utilized Bloom filters, optimizing query execution without significant memory overhead. These changes were integrated into SQLite version 3.38.0.

  15. 15
    Article
    Avatar of lnLaravel News·1y

    Paginate Multiple Eloquent Models with the Union Paginator Package

    The Laravel Union Paginator package by Austin White allows combining data from multiple Eloquent models into a single query using SQL unions. This package provides consistent pagination and customization across different data sources. It supports both Laravel v10 and v11 and offers the ability to transform records from each model before pagination.

  16. 16
    Article
    Avatar of codemazeCode Maze·1y

    Global Query Filters in Entity Framework Core

    Global query filters in EF Core allow applying `WHERE` conditions to all queries on an entity type. Common use cases include row-level security, multitenancy, and implementing soft delete. This post explains how to set up EF Core, define a `DbContext`, set up entities, and apply global query filters. It also shows how to disable these filters for specific queries and highlights considerations with navigation properties to avoid pitfalls.

  17. 17
    Article
    Avatar of crunchydataCrunchy Data·1y

    Postgres Partitioning with a Default Partition

    Effective partitioning in PostgreSQL can be crucial for maintaining a database with growing application data. Default partitions serve as a catch-all for data that doesn't fit existing partitions and help manage unexpected or incorrect data entries. It's essential not to leave data in default partitions and regularly monitor and move valid data to appropriate child partitions. Tools like pg_partman can assist in managing this process, automatically creating child partitions and providing functions to check and handle data in default partitions.

  18. 18
    Article
    Avatar of lnLaravel News·1y

    Working with JSON Attributes Using Laravel's Array Casts

    Laravel provides AsArrayObject and AsCollection casts to handle complex JSON attributes effectively, facilitating intuitive manipulation of nested data structures. These casts offer seamless JSON data management while ensuring clean and maintainable code.

  19. 19
    Video
    Avatar of nickchapsasNick Chapsas·1y

    The Best Way to Run Database Migrations

    Learn how to properly manage database migrations in .NET applications to avoid common pitfalls and ensure smooth production deployments. Discover why running migrations at application startup is problematic and how to shift this process to the release pipeline. The post covers practical steps and tools, such as using Entity Framework's CLI and configuring GitHub Actions, to automate and secure the migration process.

  20. 20
    Article
    Avatar of ardlbsArdan Labs·1y

    Optimizing Databases on Kubernetes Ep.2: Automating Database Maintenance with Kubernetes and CNPG

    Jérôme Petazzoni explains how Kubernetes and CNPG (Cloud Native PostgreSQL) automate database maintenance, showcasing features like automated failover mechanisms and Pod Disruption Budgets to ensure minimal downtime and reliability. He also covers connection handling strategies to mitigate application disruptions during switchovers.

  21. 21
    Article
    Avatar of muratbuffaloMetadata·1y

    Use of Time in Distributed Databases (part 2): Use of logical clocks in databases

    Explores three approaches to using logical clocks in distributed databases: vector clocks, dependency graph maintenance, and epoch services. Discusses systems like Dynamo, ORBE, NAM-DB, COPS, Kronos, and Chardonnay to highlight their unique methods for ensuring causal consistency.

  22. 22
    Article
    Avatar of taiTowards AI·1y

    How to Build a Proactive Agent with Real-Time Event Processing

    Learn how combining streaming databases with large language models (LLMs) can enable proactive agents that take actions based on real-time events. The process involves setting up event listeners that can trigger the LLM to act upon specific conditions, much like setting an alarm. Utilization of SQL and materialized views in streaming databases allows efficient handling and monitoring of events, thus enabling the proactive behavior of intelligent agents.

  23. 23
    Article
    Avatar of fullstackdeveloperFullstack Developer·1y

    Optimizing GROUP BY in MySQL in real project

    Discover how to optimize the GROUP BY clause in MySQL using covering indexes, enhancing query performance in real-world projects.

  24. 24
    Article
    Avatar of communityCommunity Picks·1y

    SQLite optimisations in Laravel

    SQLite has regained popularity, with frameworks like Rails and Laravel adopting it as the default database. This guide demonstrates how to optimize SQLite in Laravel with multiple SQLite databases for scalability and the implementation of SQLite-specific PRAGMAs to enhance performance. These quick and effective configurations make SQLite more robust and performant.

  25. 25
    Article
    Avatar of webtoolsweeklyWeb Tools Weekly·1y

    CSS Tools, Databases/JSON, Vue Tools

    The newsletter highlights the addition of visited link styles to help users keep track of clicked links. It provides an overview of various CSS and HTML tools, JSON tools, databases, and Vue tools. Featured tools include BriCSS, just-styled, Keuss, Triplit, and various Vue components. The edition also offers commercial app recommendations and discusses a future marketplace for Tailwind-based templates.