I’m currently trying to create a query that fetches everything from table A that has a one-to-one relation with table B. From table B I only want TWO fields, but as of right now this fetches everything in table B as well, this creates a huge increase in loading time for me… From instant to over 4 seconds…
I’ve tried to use the properties variable as well as queryOptions.related but with .related it seems like it forces to fetch everything from the relation even if I put it like columnRelated.columnInTableB… With properties I can’t get it to work, how should I write to use properties?
Or is this impossible with Backendless database…?
Unfortunately, this feature is not supported by the Backendless server. You can retrieve a full related object only.
Okay, thanks for your answer!
One more thing then related to this. Is there a way to “side load”? Lets say I load whole Table B in one query, is there a way, without loading related, on the query on Table A to get the objectId of the object that is the related? So I can match the results from the first query on Table B with the result from the query on Table A?
You can’t get objectId of relation by making a query to Table A without loading relation.
I don’t see the whole picture, but I think you should make refactoring of your Table B, if it possible.
Maybe the best way, in this case, will be creating Table C related with Table B one-to-one and moving all overweight columns there.
In this case in Table B will be only lightweight data wich you can retrieve in a query to Table A.
I hope it will be helpful for you.
Thanks for answer Ilya!
This was just me trying to think “out of the box” cause Table B only contains 14 entries with some columns (which I only need one but after more investigation I don’t think is the amount of columns that increases the load time) but Table A has around 100 entries with a relation to Table B. So I was thinking about fetching these 14 entries only once instead of one time for each result in the query (As of now it seems that even if two results have the same object related to it it fetches it two times and not once).
But since it’s not possible to get objectId without fetching the relation it was a bust for me anyway!
Thanks for your help!