prisma-dbml-generator icon indicating copy to clipboard operation
prisma-dbml-generator copied to clipboard

Performance: Prisma generate freezes with large schema with dbml generator

Open marcjulian opened this issue 2 years ago • 5 comments

image there seems to be another issue that isn't caught by the tests, because when generating in a reasonably sized project it's frozen, when removing the dbml generator provider it does generate correctly

Originally posted by @PabloSzx in https://github.com/notiz-dev/prisma-dbml-generator/issues/37#issuecomment-1174157553

marcjulian avatar Jul 18 '22 07:07 marcjulian

@PabloSzx let's track the performance issue here. We should setup a large dummy/test schema to find out the bottleneck of this generator. How large (lines of code) is the prisma.schema where it froze?

marcjulian avatar Jul 18 '22 07:07 marcjulian

Is ~650 lines

PabloSzx avatar Jul 18 '22 13:07 PabloSzx

Think I have another instance of this, my schema is ~400 lines long, with many enums peppered all over which I think is affecting graph complexity.

yourbuddyconner avatar Jan 10 '23 04:01 yourbuddyconner

@yourbuddyconner is it freezing or just taking for a long time to generate? Are thus enums with a few or a lot of entries?

I guess will need to create a test schema with lots of entries, relationships and enums to test it out.

marcjulian avatar Jan 10 '23 09:01 marcjulian

I feel like it was hanging, I profiled the process and it wasn't using a considerable amount of CPU or memory, so my conclusion was a weird hang of some kind but that wasn't based on a deep dive or anything.

I am using a schema generated by Prisma, which includes an average of ~1 enum across 20+ models with a web of relations across them. The enums have <10 options, averaging 2-4, and idk if that affects performance at all.

Anecdotally, I have been having difficulty generating ERDs with this schema across a variety of tools, with the only reliable one being PGAdmin. Prisma might be using some fancy Postgres stuff that is specific to a newer version of PSQL.

yourbuddyconner avatar Jan 13 '23 01:01 yourbuddyconner