Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prisma studio easily hits Planetscale's 100,000 row read system limit #1260

Open
reubenjh opened this issue Jul 12, 2024 · 4 comments
Open
Labels
kind/bug A reported bug.

Comments

@reubenjh
Copy link

Bug description

When prisma studio spins up, it defaults to fetching all of the relations in order to show a count in the UI. This causes it to hit Planetscale's row read limit of 100,000 in a reasonably large project. The engine exits with a non 0 status code and I see an error including these blocks: PrismaClientKnownRequestError:x,PrismaClientRustPanicError:D,PrismaClientInitializationError:P,PrismaClientValidationError:A and rpc error: code = Aborted desc = Row count exceeded 100000.

Even if you toggle off the offending joined fields, that only toggles them out of visibility, but the underlying query still includes them.

This is confirmed by looking at the underlying query, which in both cases whether the fields are toggled on or off is as follows in my case:

Query:
{
  "modelName": "Card",
  "operation": "findMany",
  "args": {
    "take": 50,
    "skip": 0,
    "select": {
      "id": true,
      "slug": true,
      "name": true,
      "hotscore": true,
      "guardian": true,
      "reverse": true,
      "references": {
        "select": {
          "id": true
        }
      },
      "referencedBy": {
        "select": {
          "id": true
        }
      },
      "faqs": {
        "select": {
          "id": true
        }
      },
      "elements": {
        "select": {
          "id": true
        }
      },
      "keywords": {
        "select": {
          "id": true
        }
      },
      "variants": {
        "select": {
          "id": true
        }
      },
      "setCards": {
        "select": {
          "id": true
        }
      },
      "deckCards": {
        "select": {
          "id": true
        }
      },
      "avatarCards": {
        "select": {
          "id": true
        }
      },
      "sideboardCards": {
        "select": {
          "id": true
        }
      },
      "maybeboardCards": {
        "select": {
          "id": true
        }
      },
      "deckChange": {
        "select": {
          "id": true
        }
      },
      "collectionItems": {
        "select": {
          "id": true
        }
      },
      "collectionChange": {
        "select": {
          "id": true
        }
      },
      "tournamentDeckCards": {
        "select": {
          "id": true
        }
      },
      "tournamentAvatarCards": {
        "select": {
          "id": true
        }
      },
      "tournamentSideboardCards": {
        "select": {
          "id": true
        }
      }
    }
  }
}

How to reproduce

Not possible without a database with sufficient data.

Expected behavior

I have found a workaround which includes shrinking the number in the take argument down until the joined rows is low enough, but this won't scale as as some point I won't even be able to fetch 1 item.

I can no longer use prisma studio at this point, which is a major issue and has me considering an alternative, and I expect anyone else on Planetscale with a decent amount of data is experiencing the same thing.

My recommendation is to change those select: { id: true }statements in the underlying query to simple counts, or have toggling the fields off actually turn them off from the query and have them defaulted off.

Prisma information

version 5.16.2
schema doesnt matter, nothing else is broken.

Environment & setup

  • OS:
  • Browser:
  • Database:

Running npx prisma studio against a Planetscale database with sufficiently high data.

Prisma logs

No response

@reubenjh reubenjh added the kind/bug A reported bug. label Jul 12, 2024
@reubenjh reubenjh changed the title In a big project, this easily hits Planetscale's 100,000 row read system limit Prisma studio easily hits Planetscale's 100,000 row read system limit Jul 12, 2024
@connerludlow
Copy link

+1

@Rhys97W
Copy link

Rhys97W commented Oct 21, 2024

I'm getting this as well. The table I try and load only has 30 records in it but errors with the row limit exceeded error. I load a table with 100,000+ records and its absolutely fine.

@faugstad
Copy link

Same problem.

This would solve it for me also i think:

"My recommendation is to change those select: { id: true }statements in the underlying query to simple counts, or have toggling the fields off actually turn them off from the query and have them defaulted off."

@bautistaaa
Copy link

Is there a workaround?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A reported bug.
Projects
None yet
Development

No branches or pull requests

5 participants