question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Prisma multi-join query hanging on Windows 10

See original GitHub issue

Bug 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:

  1. Clone repo: https://github.com/jakexconniff/prisma-windows-multijoin-reproduction
  2. Set .env with the standard DATABASE_URL=x
  3. npm install, prisma generate, prisma migrate dev
  4. Run ts-node index.ts. This will populate the database with 250,000 records in each of the respective tables, with randomized data.
  5. 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:open
  • Created 2 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jakexconniffcommented, Jan 11, 2022

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.

1reaction
jakexconniffcommented, Jan 10, 2022

Just sent you a DM on Twitter, sorry if there’s an easier way to send private messages.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using joins to combine data from different tables in PostgreSQL
Joins allow you to bring together data from multiple tables by stitching together columns that contain common values. In this guide, we'll talk...
Read more >
Microsoft Query hangs/freezes when I try to pull from multiple
I'm trying to pull data from Quickbooks via ODBC and Microsoft Query into Excel. I've done this a few times, but usually only...
Read more >
Revisiting Pipelined Parallelism in Multi-Join Query Processing.
Multi-join queries are the core of any integration service that integrates data from multiple distributed data sources.
Read more >
Table of contents - IEEE Computer Society
... Guan Wang, and Wenliang DuLight-Weight, Runtime Verification of Query Sources . ... Session 10: Data Mining IUsing Anonymized Data for Classification ....
Read more >
Hortonworks Data Platform - HDP-2.3.4 on Windows Release Notes
HADOOP-11932: MetricsSinkAdapter may hang when being stopped. ... HIVE-10996 Aggregation / Projection over Multi-Join Inner Query producing incorrect.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found