Questions tagged [join]
An SQL join clause combines records from two or more tables or views.
2,020 questions
0 votes
1 answer
118 views
How does a join without any predicates estimate fewer rows than what go into it?
Consider the following script on the 10 GB StackOverflow2010 database. Be warned that it clears the plan cache. IF NOT EXISTS (SELECT * FROM sys.types WHERE is_table_type = 1 AND name = 'ExampleTvp') ...
0 votes
1 answer
54 views
What happens in MariaDB if an index is dropped from a table while a join is running on that table?
I am running Fedora 42 KDE spin, and the output from mysql -V is mysql Ver 15.1 Distrib 10.11.11-MariaDB, for Linux (x86_64) using EditLine wrapper I have a script that runs weekly that creates a ...
3 votes
1 answer
188 views
Merge two queries into one, involving aggregation
I have these two queries in Postgres. One is: SELECT _id, created_at FROM pedidos WHERE _id = '123abc; Works fine, returns: { "_id": "123abc", "created_at": &...
0 votes
1 answer
56 views
Different plan and slower query on smaller Postgres table
Running the same query on two tables that only differ in row count (~7.8M vs ~1.4M) results in two different plans, which sounds reasonable. But the execution on the smaller table is 4 to 5 times ...
0 votes
1 answer
163 views
How does the graph database (Neo4j) solve the `O(n)` problem as data grows compared to RDBMs
A training course in the Neo4j Academy mentions that: When querying across tables, the joins are computed at read-time, using an index to find the corresponding rows in the target table. The more ...
1 vote
2 answers
106 views
How to join rows pairwise randomly?
I have one table with player ids and names. For each round the table will be scrambled, split in half, and put side by side. Handling of unequal amount of rows in each group is not the scope of this ...
0 votes
1 answer
118 views
Left Join vs. Right Join [closed]
I have a question regarding LEFT JOIN and RIGHT JOIN in SQL. As I understood, both joins are the same depending upon the position of the tables. Why are LEFT JOINs more popular than RIGHT JOINs in SQL?...
1 vote
0 answers
44 views
How to join aggregated values from a different table to a filtered and paginated resultset
I'm trying to get products and their aggregated group information. I have three tables on Postgresql database: product, product_group, and product_group_product. This is how the end result should look ...