studio icon indicating copy to clipboard operation
studio copied to clipboard

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

Open reubenjh opened this issue 1 year ago • 4 comments

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 avatar Jul 12 '24 03:07 reubenjh

+1

connerludlow avatar Jul 25 '24 04:07 connerludlow

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.

Rhys97W avatar Oct 21 '24 13:10 Rhys97W

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."

faugstad avatar Oct 29 '24 11:10 faugstad

Is there a workaround?

bautistaaa avatar Nov 11 '24 00:11 bautistaaa

Hey :wave:

Prisma ORM 7 introduces a brand new standalone Studio, built from the ground up to work everywhere, with or without Prisma ORM. Consequently, all "old Studio" issues are being closed as there won't be any further work on it. :mega:

The new Studio is also available in the Prisma VS Code extension and in the Prisma Console application. :electric_plug:

Help shape, improve and fix the new Studio with us in this repository by submitting bug reports and feature requests. :construction_worker:

igalklebanov avatar Nov 20 '25 00:11 igalklebanov