# Performance of fetching pointers

**URL:** <https://community.parseplatform.org/t/performance-of-fetching-pointers/3178>\
**Category:** Cloud Code\
**Tags:** query\
**Created:** [January 12, 2023, 9:02pm UTC](https://community.parseplatform.org/t/performance-of-fetching-pointers/3178 "2023-01-12T21:02:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![reptilehaus](https://community.parseplatform.org/user_avatar/community.parseplatform.org/reptilehaus/32/1259_2.png) [@reptilehaus](https://community.parseplatform.org/u/reptilehaus)\
**Post date:** [January 12, 2023, 9:02pm UTC](https://community.parseplatform.org/t/performance-of-fetching-pointers/3178/1 "2023-01-12T21:02:19Z")

</div>

Is there any way to perform queries on pointers more performant. Lets say we have a collection called blog posts which references another by pointer collection called categories, in order to retrieve all the references i must do a for loop over books and then perform away on each books reference to categories which can be quite slow depending on the number of books I have. for example

```auto

... query for books  

for (let index = 0; index < books.length; index++) {
    const book = books[index];
    let cat = book.get('category')
        cat = await cat.fetch(masterKey)
        ... do stuff with category before reassigning back to book object 
    let refactorBook = JSON.parse(JSON.stringify(book))                
        refactorBook = { ...refactorBook, category }
        returnBooks.push(refactorBook)
}

```

---

<div class="post-metadata">

**Author:** ![dblythy](https://community.parseplatform.org/user_avatar/community.parseplatform.org/dblythy/32/231_2.png) [@dblythy](https://community.parseplatform.org/u/dblythy)\
**Post date:** [January 14, 2023, 5:20pm UTC](https://community.parseplatform.org/t/performance-of-fetching-pointers/3178/2 "2023-01-14T17:20:40Z")

</div>

Best not to use await in a loop, use Promise.all instead.

You can also use `include` or `matchesQuery`
