Structured primary keys are an alternative to surrogate keys that base a table's primary key on a meaningful foreign key plus additional columns needed for uniqueness. Using a web shop schema as example, the approach shows how surrogate-only primary keys create 'walled gardens' that force expensive joins and prevent the database from filtering rows early. By including the parent's foreign key columns in the child's primary key (e.g., using (customer_id, order_no) instead of just order_id), child tables inherit the parent's context, enabling queries to skip joins entirely or dramatically reduce the rows scanned. Benchmarks show 4–10x query speedups. The approach also enables cyclic consistency enforcement via foreign keys that span multiple columns, preventing cross-tenant or cross-customer data corruption that denormalization cannot guarantee. Trade-offs include slightly longer insert times (~33% overhead for per-parent sequence generation), more verbose join conditions, and variable space usage depending on data distribution. The author recommends applying surrogate proxy columns only to the 'plus-columns' (the non-FK portion of the key) while keeping the parent FK columns intact.
Nguồn: https://modern-sql.com/blog/2026-06/structured-primary-keys. 8sync News chỉ tóm tắt và dẫn link; bản quyền nội dung thuộc tác giả và nguồn gốc.

Một nhà phát triển tên Gretchen gia nhập dự án Node.js cũ kỹ sau khi bị mua lại và phát hiện hàng loạt lỗi nghiêm trọng: logging bị hỏng chỉ in ra "DEBUG", lỗ hổng SQL injection từ truy vấn thô, thiếu middleware phân quyền trên hầu hết endpoints (kể cả API admin), codebase dừng ở Node.js 14, và dữ liệu request được đưa trực tiếp vào database mà không qua bất kỳ validation nào.
Lập trình viên nên đọc bài này để tránh rơi vào những sai lầm an toàn và thiết kế không hiệu quả trong dự án Node.js, từ đó học cách cải thiện bảo mật, quản lý lỗi và tối ưu hóa hệ thống ngay từ giai đoạn đầu.

postgres-lsp là một triển khai mới theo giao thức Language Server (LSP) dành cho SQL và PL/pgSQL của PostgreSQL, sử dụng tree-sitter-postgres. Nó cung cấp các tính năng IDE như chẩn đoán lỗi, gợi ý ngữ nghĩa, điều hướng định nghĩa, định vị tham chiếu, hoàn thành thông minh, hỗ trợ chữ ký, đổi tên, hành động mã hóa và định dạng SQL với nhiều kiểu cài đặt sẵn.
Lập trình viên PostgreSQL nên đọc bài này để khám phá cách postgres-lsp nâng cao hiệu suất IDE với các tính năng như hoàn thành ngữ cảnh, định nghĩa và tham chiếu nhanh, và định dạng SQL theo nhiều phong cách chuyên nghiệp, thay vì phụ thuộc vào các công cụ cũ dựa trên regex.
Nhóm kỹ thuật GitGuardian đã giảm thời gian phản hồi p95 của dashboard từ 8 giây xuống 1 giây nhờ 5 tối ưu hóa PostgreSQL trên hệ thống Django, bao gồm: deferred JOINs bằng prefetch_related, đếm bất đồng bộ, replica đọc premium, cải tiến full-text search (pg_trgm), và denormalization để hỗ trợ composite indexes. Việc nâng cấp lên PostgreSQL 18 cũng mang lại lợi ích nhỏ. Họ sử dụng OpenTelemetry và EXPLAIN ANALYZE để theo dõi tiến trình.
Nếu bạn đang làm việc với ứng dụng backend sử dụng PostgreSQL và Django, bài viết này sẽ giúp bạn tìm hiểu cách tối ưu hóa hiệu suất dashboard hiệu quả bằng những kỹ thuật cụ thể, từ đó tiết kiệm thời gian và chi phí phát triển.
Postgres 19 bổ sung hỗ trợ sao chép logic (logical replication) cho sequences, vốn bị loại trừ suốt gần một thập kỷ do tính phi giao dịch. Tính năng mới tự động đồng bộ sequences tại các thời điểm xác định như tạo/refresh subscription, cùng công cụ hỗ trợ như hàm pg_get_sequence_data() và cột sync_seq_error_count. Cách tiếp cận này tương tự pglogical nhưng được tích hợp sẵn vào Postgres.
Lập trình viên cần đọc bài này để hiểu cách PostgreSQL 19 tự động đồng bộ hóa các chuỗi (sequences) trong cơ sở dữ liệu replication, giúp tránh lỗi thủ công và bảo đảm tính nhất quán khi chuyển đổi từ máy chủ sang subscriber mà không cần script bổ sung.

Phiên bản pgAdmin 4 v9.16 vừa ra mắt với 64 bản sửa lỗi và tính năng mới, trong đó có 7 lỗ hổng bảo mật nghiêm trọng (CVE-2026-12044 đến CVE-2026-12050) như SQL injection, bypass giao dịch read-only, XSS lưu trữ, và lỗ hổng chuyển hướng mở. Ngoài ra, phiên bản này bổ sung giao diện mã màu cho server, hỗ trợ đóng tab bằng click giữa, cấu hình bảo mật Helm chart, và hỗ trợ TOAST tuple trong Materialized View. pgAgent đã bị loại bỏ và sẽ bị gỡ bỏ trong vòng 6 tháng tới.
Lập trình viên phát triển ứng dụng sử dụng PostgreSQL nên đọc bài này để cập nhật về các lỗ hổng bảo mật mới trong pgAdmin 4 (v9.16), đặc biệt là các vấn đề như SQL injection, XSS và RCE có thể ảnh hưởng đến tính bảo mật của hệ thống quản lý cơ sở dữ liệu mà họ sử dụng.
PostgreSQL 17 and 18 introduced two planner GUCs — enable_group_by_reordering and enable_distinct_reordering — that allow the query planner to permute the keys of GROUP BY and SELECT DISTINCT operations to minimize comparison costs and avoid redundant sorts. Since column order in these clauses carries no semantic meaning, the planner can reorder keys based on cardinality and comparison cost statistics, or align them with existing sort orders to skip explicit sorts. Both default to on and are micro-optimizations that matter mainly for large multi-key operations. The primary diagnostic use case is a query that regressed after upgrading to PostgreSQL 17 or 18, where the plan shows a key order different from what was written. The recommended fix is usually improving statistics via ANALYZE rather than disabling the GUC permanently.

PostgreSQL 19 introduces SQL/PGQ support for property graphs, and this post dives into heterogeneous graphs with multiple vertex and edge types. Using a social+work dataset (persons, companies, knows, works_at), it demonstrates how to define a multi-label property graph and write GRAPH_TABLE queries spanning different node types. Key topics include: traversing mixed-type paths (person→person→company), a workaround for PostgreSQL 19's lack of comma-separated MATCH patterns (join two GRAPH_TABLE results instead), the pitfall of anonymous edge patterns in multi-label graphs (they match all edge types via an Append plan), and the current limitation around quantified path hops ({1,3} syntax not yet supported).
A guide to building an AI-powered database migration assistant using .NET, Entity Framework Core, and Azure AI. The assistant analyzes migration scripts before execution, detects risky operations (like dropping columns or tables), generates human-readable documentation, and provides deployment recommendations. The architecture combines ASP.NET Core Web API with Azure OpenAI to add an intelligent validation layer to the standard EF Core migration workflow, keeping AI recommendations advisory rather than automatic.