The table object in the where callback won’t have fields from with and extras. We removed them to be able to build more efficient relational queries, which improved row reads and performance.
If you have used those fields in the where callback before, there are several workarounds:
Applying those filters manually on the code level after the rows are fetched;
Using the core API.
Added Relational Queries mode config for mysql2 driver
Drizzle relational queries always generate exactly one SQL statement to run on the database and it has certain caveats. To have best in class support for every database out there we’ve introduced modes.
Drizzle relational queries use lateral joins of subqueries under the hood and for now PlanetScale does not support them.
When using mysql2 driver with regular MySQL database - you should specify mode: “default”.
When using mysql2 driver with PlanetScale - you need to specify mode: “planetscale”.
Improved IntelliSense performance for large schemas
We’ve run the diagnostics on a database schema with 85 tables, 666 columns, 26 enums, 172 indexes and 133 foreign keys. We’ve optimized internal types which resulted in 430% speed up in IntelliSense.
Improved Relational Queries Permormance and Read Usage
In this release we’ve fully changed a way query is generated for Relational Queri API.
As a summary we’ve made current set of changes in query generation startegy:
Lateral Joins: In the new version we’re utilizing lateral joins, denoted by the “LEFT JOIN LATERAL” clauses, to retrieve specific data from related tables efficiently For MySQL in PlanetScale and SQLite, we’ve used simple subquery selects, which improved a query plan and overall performance
Selective Data Retrieval: In the new version we’re retrieving only the necessary data from tables. This targeted data retrieval reduces the amount of unnecessary information fetched, resulting in a smaller dataset to process and faster execution.
Reduced Aggregations: In the new version we’ve reduced the number of aggregation functions (e.g., COUNT, json_agg). By using json_build_array directly within the lateral joins, drizzle is aggregating the data in a more streamlined manner, leading to improved query performance.
Simplified Grouping: In the new version the GROUP BY clause is removed, as the lateral joins and subqueries already handle data aggregation more efficiently.