Does prisma cap the number of data returned?
# orm-help
j
Does prisma cap the number of data returned?
d
Prisma returns pages of 1k nodes by default.
Note that this will be revised in future versions.
j
Ok. How do I get the count and is there a guide on pagination with prisma?
d
j
Note that by default, Prisma returns a maximum of 1000 nodes. This can be overridden by setting the pagination parameters accordingly. If you do not set any pagination parameters, Prisma will set a limit of 1000.
How do you do this?
I wanted to query all the data, 2500 per say, use some catching method on client side, filter client side.
d
Look at the
first
,
last
, etc. parameters, setting those to the desired amount should do the trick.
j
Yeah I didn't want to do pagination server side.
n
How did you want to do pagination then?
j
I did my pagination client side. I filtered client side. Since I am doing a real estate site, load more wouldn't be good for user experience as they could lose track of properties.
So in order to split my pages up I need to know how many is in the collection. I'm going to give the server side pagination and filtering a try, but I need to know the count ahead of time. I can't see to figure out the prisma bindings to return the count.
residentialsConnection{ aggregate{ count } }
This gives me in playground but trying to figure out on the server side in my resolvers.
count: (_, args, context, info) => { return context.prisma.query.residentialsConnection({ }, info); },
Doesn't work...
If I could over ride the 1000 node limit then I could skip all together. It only takes about 20 seconds to load 2500 records, but I have cached it. So I am going prefetch the data ahead of time before the user gets to the search page. So the data would be quicker than that.
Jesus, always one road block after another with prisma. Limits on nodes, limits on databases, limits on this, limits on that. I don't know why I keep trying it. So frustrating.
n
I saw that you managed to resolve it in the other thread 🙂 We are lifting the pagination limit soon - thanks for bringing this to our attention! I'm not entirely sure, but from what you mentioned about the database limit it sounds that you want to have a type with more than 8xxx fields. This seems to be an actual database limit, and there's nothing we can do about it in Prisma. I've suggested to split up the fields in your types into multiple types, have you tried this already? What other limits are you facing?
j
Trying to get around the limits of server side operations that can be shifted to client side. Sorting. Filtering. Pagination. So I’m trying to figure out how I can fetch all the data. So I’m using Apollo client and can use the fetch more but need to get my head around making it automatically do it. The data is updated every 2 hours. So I can leverage some kind of caching mechanism and have client side do bulk of the work. Or would this be a bad practice? So I went with Postgres to get around row size limit. Have things broken up. Before I was combining all kinds of properties fields into one. So now I split the data up. Residential. Lots / lands. Commercial. Etc. all split up.
So I managed to use prisma bindings to write my node scripts to pull the real estate data and do mutations. So that is a plus.
👍 1