Tag sql
15 bookmarks have this tag.
15 bookmarks have this tag.
Функции должны быть чистыми, чтобы по ним работал индекс
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.
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.
Например, поиск по имени без фамилии бесполезен. Значит, составной индекс должен начинаться с фамилии, а потом уже будет имя.
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.
SQL has evolved. Beyond the relational model. Discover it now.
Sort-merge joins do not need indexes on the join predicates.
MySQL does not support sort-merge joins at all.
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.
Avoid LIKE expressions with leading wildcards (e.g., '%TERM').
Rule of thumb: index for equality first—then for ranges.
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
Представьте, какой гемор был бы построить это в Экселе, Гугле или даже на языке программирования вроде Питона. Там с одним только парсингом дат и времени наешься, а тут все из коробки.
PRQL is a modern language for transforming data
Интересная замена SQL. Запросы для аналитики данных станет писать намного проще. Не думаю, что для чего-то другого этот проект подойдёт. Условный CRUD проще написать, используя именно SQL запросы, здесь PRQL излишен.
Для всех, кто знал SQL, но подзабыл