Tag sql

18 bookmarks have this tag.

2024-03-07

549.

SQL Polyglot

codapi.org/sql

SQL Polyglot is a quick way to see if a particular SQL feature is supported in different database systems. Write a query and see it run anywhere from PostgreSQL to DuckDB without leaving your browser.

2023-12-05

451.

ORM для реальных приложений не окупается

habr.com/ru/companies/karuna/articles/774478

Из комментариев под статьёй:

Кто-то не очень понимает, что ORM в первую очередь - маппер. Да, и называется он Object-Relational Mapper. Отвечает за взаимосвязь между реляционными данными и объектно-ориентированным миром.

Тот, кто хотя бы раз сталкивался с опечаткой при загрузке поля в объект, уже не задаёт вопросы, оправдан ли ORM. Когда за тебя связку делает кодогенератор с нулевой возможностью ошибки на любой сложности схеме - начинаешь ценить надёжность такого решения.

Что касается SQL. ORM не может в принципе покрыть весь синтаксис SQL. И не должен, это не его задача. Его задача - сделать простым синтаксис 95% случаев, когда дальше джойна и WHERE ничего не надо. ORM не мешает использовать чистый SQL, а чаще всего может его дополнить, переводя результат сложного запроса в набор объектов.

2023-12-03

449.

Git Query language

amrdeveloper.github.io/gql

GQL is a query language with a syntax very similar to SQL with a tiny engine to perform queries on .git files instance of database files, the engine executes the query on the fly without the need to create database files or convert .git files into any other format, note that all Keywords in GQL are case-insensitive similar to SQL.

2023-11-16

422.

SQL indexes on user-defined functions

use-the-index-luke.com/sql/where-clause/functions/user-defined-functions

Функции должны быть чистыми, чтобы по ним работал индекс

421.

Case-Insensitive Search in SQL

use-the-index-luke.com/sql/where-clause/functions/case-insensitive-search

Using UPPER or LOWER for case-insensitive search is not a good practice. Prefer using a _CI collation if possible or at least add the right indexes to make your query fast.

420.

The right column order in multi-column indexes

use-the-index-luke.com/sql/where-clause/the-equals-operator/concatenated-keys

The most important consideration when defining a concatenated index is how to choose the column order so it can be used as often as possible.

Например, поиск по имени без фамилии бесполезен. Значит, составной индекс должен начинаться с фамилии, а потом уже будет имя.

419.

Slow Indexes in RDBMS

use-the-index-luke.com/sql/anatomy/slow-indexes

An index lookup requires three steps: (1) the tree traversal; (2) following the leaf node chain; (3) fetching the table data. The tree traversal is the only step that has an upper bound for the number of accessed blocks—the index depth. The other two steps might need to access many blocks—they cause a slow index lookup.

418.

Modern SQL: A lot has changed since SQL-92

modern-sql.com

SQL has evolved. Beyond the relational model. Discover it now.

2023-11-15

417.

Sort-Merge Join in SQL databases: Oracle, SQL Server, PostgreSQL

use-the-index-luke.com/sql/join/sort-merge-join

Sort-merge joins do not need indexes on the join predicates.
MySQL does not support sort-merge joins at all.

416.

Partial Objects in ORMs: loading a subset of properties

use-the-index-luke.com/sql/join/hash-join-partial-objects

Index the independent where predicates to improve hash join performance.

Indexing join predicates doesn’t improve hash join performance.

Indexing a hash join is independent of the join order.

Select fewer columns to improve hash join performance.

Hash joins do not need indexes on the join predicates. They use the hash table instead.
A hash join uses indexes only if the index supports the independent predicates.
Reduce the hash table size to improve performance; either horizontally (less rows) or vertically (less columns).
Hash joins cannot perform joins that have range conditions in the join predicates.

415.

Tuning SQL LIKE using indexes

use-the-index-luke.com/sql/where-clause/searching-for-ranges/like-performance-tuning

Avoid LIKE expressions with leading wildcards (e.g., '%TERM').

414.

Indexing SQL range conditions less than, greater than and between

use-the-index-luke.com/sql/where-clause/searching-for-ranges/greater-less-between-tuning-sql-access-filter-predicates

Rule of thumb: index for equality first—then for ranges.

2023-11-14

412.

LIMIT vs. FETCH in SQL

antonz.org/sql-fetch

Fun fact: There is no limit clause in the SQL standard.

Everyone uses limit.
And yet, according to the standard, we should be using fetch

2023-09-30

343.

SQL

grishaev.me/sql

Представьте, какой гемор был бы построить это в Экселе, Гугле или даже на языке программирования вроде Питона. Там с одним только парсингом дат и времени наешься, а тут все из коробки.

2023-09-14

326.

Антон Жиянов рассказывает про SQL

podlodka.io/321

2023-09-09

316.

Explaining The Postgres Meme

www.avestura.dev/blog/explaining-the-postgres-meme

2023-09-05

315.

PRQL

prql-lang.org

PRQL is a modern language for transforming data

Интересная замена SQL. Запросы для аналитики данных станет писать намного проще. Не думаю, что для чего-то другого этот проект подойдёт. Условный CRUD проще написать, используя именно SQL запросы, здесь PRQL излишен.

2023-07-25

249.

SQL-шпаргалка

antonz.ru/sql-cheatsheet

Для всех, кто знал SQL, но подзабыл