Prisma multi-join query hanging on Windows 10
See original GitHub issueBug description
I have a schema with 8 tables that all join up and I am attempting to query them all joined together, and it is hanging when I run it on my Windows machine.
On MacOS it is running in about 16 seconds. On my Windows machine it is hanging indefinitely. I put DEBUG=*
logging on, but it is not super useful. No real difference in the logs between the two machines.
The database it is pulling from has about 250k records in each of the respective tables.
Setting the take
parameter down to about 10,000, the query works on Windows. Much above that hangs.
How to reproduce
The steps to reproduce are roughly:
- Clone repo: https://github.com/jakexconniff/prisma-windows-multijoin-reproduction
- Set .env with the standard
DATABASE_URL=x
npm install
,prisma generate
,prisma migrate dev
- Run
ts-node index.ts
. This will populate the database with 250,000 records in each of the respective tables, with randomized data. - Run
ts-node query.ts
.
That should be it for the repro case.
On MacOS, the following works without a hitch. On WIndows, it hangs indefinitely.
Expected behavior
Query should behave as it does on MacOS. Completes with no issues in about 16 seconds each run, where it hangs on Windows 10.
Prisma information
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
}
model facilities {
id Int @id @default(autoincrement())
cancellation_allowed_by_customer Boolean
cancellation_allowed_by_spothero_customer_service Boolean
cancellation_minutes Int
clearance_inches Int
description String @db.VarChar(128)
facility_type String @db.VarChar(64)
always_open Boolean
hours_of_operation_text String @db.VarChar(64)
navigation_tip String @db.VarChar(64)
rating_average Float
rating_count Int
required_license_plate Boolean
required_phone_number Boolean
required_printout Boolean
reservation_extension_enabled Boolean
slug String @db.VarChar(64)
title String @db.VarChar(128)
status String @db.VarChar(64)
is_commuter_card_eligible Boolean
results results[]
facility_addresses facility_addresses[]
facility_hours_of_operation_periods facility_hours_of_operation_periods[]
}
model facility_addresses {
id Int @id @default(autoincrement())
facility_id Int
city String @db.VarChar(64)
country String @db.VarChar(2)
lat Float
long Float
postal_code Int
state String @db.VarChar(2)
street_address String @db.VarChar(64)
time_zone String @db.VarChar(32)
facilities facilities? @relation(fields: [facility_id], references: [id])
facility_address_types facility_address_types[]
}
model facility_address_types {
id Int @id @default(autoincrement())
facility_address_id Int
type String @db.VarChar(64)
facility_addresses facility_addresses? @relation(fields: [facility_address_id], references: [id])
}
model facility_hours_of_operation_periods {
id Int @id @default(autoincrement())
facility_id Int
day_of_week String @db.VarChar(8)
end_time DateTime @db.Time
end_time_secs Int
first_day String @db.VarChar(8)
hours_type String @db.VarChar(16)
last_day String @db.VarChar(8)
start_time DateTime @db.Time
start_time_secs Int
facilities facilities? @relation(fields: [facility_id], references: [id])
}
model pull {
id Int @id @default(autoincrement())
lat Float
long Float
time_range time_range[]
results results[]
}
model time_range {
id Int @id @default(autoincrement())
pull_id Int
start_time DateTime
end_time DateTime
pull pull? @relation(fields: [pull_id], references: [id])
}
model results {
id Int @id @default(autoincrement())
pull_id Int
facility_id Int
pull pull? @relation(fields: [pull_id], references: [id])
facilities facilities? @relation(fields: [facility_id], references: [id])
result_rate_quotes result_rate_quotes[]
}
model result_rate_quotes {
id Int @id @default(autoincrement())
results_id Int
advertised_price Float
total_price Float
results results? @relation(fields: [results_id], references: [id])
}
You can also see the schema in the repo provided, probably in a more ideal format.
Environment & setup
- OS: Windows 10 Home 10.0.19043 Build 19043
- Database: MySQL 8.0.23, hosted on AWS RDS
- Node.js version: 16.13.1 (also tried on 14.18.1)
Prisma Version
prisma : 3.7.0
@prisma/client : 3.7.0
Current platform : windows
Query Engine (Node-API) : libquery-engine 8746e055198f517658c08a0c426c7eec87f5a85f (at ..\..\AppData\Roaming\nvm\v16.13.1\node_modules\prisma\node_modules\@prisma\engines\query_engine-windows.dll.node)
Migration Engine : migration-engine-cli 8746e055198f517658c08a0c426c7eec87f5a85f (at ..\..\AppData\Roaming\nvm\v16.13.1\node_modules\prisma\node_modules\@prisma\engines\migration-engine-windows.exe)
Introspection Engine : introspection-core 8746e055198f517658c08a0c426c7eec87f5a85f (at ..\..\AppData\Roaming\nvm\v16.13.1\node_modules\prisma\node_modules\@prisma\engines\introspection-engine-windows.exe)
Format Binary : prisma-fmt 8746e055198f517658c08a0c426c7eec87f5a85f (at ..\..\AppData\Roaming\nvm\v16.13.1\node_modules\prisma\node_modules\@prisma\engines\prisma-fmt-windows.exe)
Default Engines Hash : 8746e055198f517658c08a0c426c7eec87f5a85f
Studio : 0.445.0
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (6 by maintainers)
Top GitHub Comments
I have a few other cloud databases hooked up to this project so let me run the query on those in the next few hours and I’ll follow up.
Although I do have a coworker who is able to run the query just fine on his Windows machine, targetting the same AWS RDS database I gave you access to so it must be some ambient factor but I am not positive it is (or atleast, is solely) the database.
Just sent you a DM on Twitter, sorry if there’s an easier way to send private messages.