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.

`findMany` optimization

See original GitHub issue

While we will tackle combining multiple findOne calls into one findMany call, we also should optimize multiple findMany calls, that all have the same selection set, but a different relation filter like so in your GraphQL resolver.

resolve(parent) {
	return prisma.comment.findMany({
	  where: {
	    post: {
	      id: parent.id
	    }
	  }
	})
}

This optimization is a bit more complex to do though, so we will first tackle the optimimzation mentioned in https://github.com/prisma/prisma2/issues/1470

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:56
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

16reactions
Nicoowrcommented, Feb 24, 2022

This would be a big + for anyone using graphql thinking of migrating to Prisma

16reactions
bielscommented, Oct 10, 2021

Any updates on this? IMHO, performance optimizations like this should be top priority for an ORM.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Query optimization - Prisma
Query optimization. This guide describes ways to optimize query performance, ... Each group is optimized into a single findMany .
Read more >
Need Help How to Implement Prisma Query Optimization Look ...
findMany () return posts } //I want this export const posts = async (dynamicRequestedFields ) => { // { // id: true, //...
Read more >
mongodb/mongoose findMany - find all documents with IDs ...
The find function in mongoose is a full query to mongoDB. This means you can use the handy mongoDB $in clause, which works...
Read more >
Setting up an optimization engine
Sign up for a free IBM Cloud account and you'll find many Decision Optimization Notebooks already available in Watson Studio Cloud.
Read more >
Wolfram Optimization: Model, Solve, Analyze Designs
Solve families of optimization problems by using parameters in objectives and constraints. Find many solutions efficiently (parameter sweeps), safe solutions ...
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