# Problem on getIdsFromRequest with "All records" selection

**URL:** <https://community.forestadmin.com/t/problem-on-getidsfromrequest-with-all-records-selection/3072>\
**Category:** Help me!\
**Created:** [August 7, 2021, 2:26pm UTC](https://community.forestadmin.com/t/problem-on-getidsfromrequest-with-all-records-selection/3072 "2021-08-07T14:26:27Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Louis-Marie](https://avatars.discourse-cdn.com/v4/letter/l/258eb7/32.png) [@Louis-Marie](https://community.forestadmin.com/u/Louis-Marie)\
**Post date:** [August 7, 2021, 2:26pm UTC](https://community.forestadmin.com/t/problem-on-getidsfromrequest-with-all-records-selection/3072/1 "2021-08-07T14:26:27Z")

</div>

Hi team,

I have some huge performance problems when using getIdsFromRequest along with “All records” selection.

Example usage:  
`const userIds = await new RecordsGetter(models.users, req.user, req.query).getIdsFromRequest(req);`

I can see that there is a batch that is retrieving all the records, per package of 1000 records, I am ok with that.

The problem is coming from the way in which the IDs are retrieved from database.  
I can see that, **while this function should retrieve only the Ids of my records, it will select all the attributes (I mean all the columns) of the current collection displayed**.  
This is generating very high useless CPU and memory usage.

It makes a big difference in the amount of data managed when you have an action that has to work on more than 50,000 records.

Could you please improve this method?  
When querying the database, please retrieve only the IDs when only the IDs are requested.  
This is the expected behaviour.

Thanks in advance for your help.

My current setup:

```javascript
  "meta": {
    "liana": "forest-express-sequelize",
    "liana_version": "8.0.2",
    "stack": {
      "database_type": "postgres",
      "engine": "nodejs",
      "engine_version": "14.16.0",
      "orm_version": "5.22.3"
    }
  }

```

---

<div class="post-metadata">

**Author:** ![Arnaud\_Moncel](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/arnaud_moncel/32/24_2.png) [@Arnaud\_Moncel](https://community.forestadmin.com/u/Arnaud_Moncel)\
**Post date:** [August 9, 2021, 8:50am UTC](https://community.forestadmin.com/t/problem-on-getidsfromrequest-with-all-records-selection/3072/2 "2021-08-09T08:50:16Z")

</div>

Hi @Louis-Marie unfortunately it’s a a real performance issue.  
I will open a bug report.  
You will be notified when the problem is resolved.  
Thank to your feedback 🙏

---

<div class="post-metadata">

**Author:** ![anon39940173](https://avatars.discourse-cdn.com/v4/letter/a/8c91f0/32.png) [@anon39940173](https://community.forestadmin.com/u/anon39940173)\
**Post date:** [August 25, 2021, 4:27pm UTC](https://community.forestadmin.com/t/problem-on-getidsfromrequest-with-all-records-selection/3072/3 "2021-08-25T16:27:31Z")

</div>

Hi @Louis-Marie

I’m posting a quick update, as this thread has been stale for two weeks.

I just finished the pull request that should fix that issue, it should go live in a couple days (it still needs to be reviewed / deployed)

Have a nice day!

---

<div class="post-metadata">

**Author:** ![Louis-Marie](https://avatars.discourse-cdn.com/v4/letter/l/258eb7/32.png) [@Louis-Marie](https://community.forestadmin.com/u/Louis-Marie)\
**Post date:** [August 25, 2021, 4:31pm UTC](https://community.forestadmin.com/t/problem-on-getidsfromrequest-with-all-records-selection/3072/4 "2021-08-25T16:31:42Z")

</div>

Hi @anon39940173

Thanks for this update.  
I appreciate.

---

<div class="post-metadata">

**Author:** ![Louis-Marie](https://avatars.discourse-cdn.com/v4/letter/l/258eb7/32.png) [@Louis-Marie](https://community.forestadmin.com/u/Louis-Marie)\
**Post date:** [September 13, 2021, 3:49pm UTC](https://community.forestadmin.com/t/problem-on-getidsfromrequest-with-all-records-selection/3072/5 "2021-09-13T15:49:40Z")

</div>

Hi @anon39940173,

Do you have any news on this request please?  
Thanks in advance

---

<div class="post-metadata">

**Author:** ![anon34731316](https://avatars.discourse-cdn.com/v4/letter/a/eada6e/32.png) [@anon34731316](https://community.forestadmin.com/u/anon34731316)\
**Post date:** [September 14, 2021, 9:23am UTC](https://community.forestadmin.com/t/problem-on-getidsfromrequest-with-all-records-selection/3072/6 "2021-09-14T09:23:27Z")

</div>

Hi @Louis-Marie,

Sorry for the delayed response, the issue should be fixed by now! 🎉

Can you confirm that the `8.1.1` version of `forest-express-sequelize` fixes the problem?

Thanks!

---

<div class="post-metadata">

**Author:** ![Louis-Marie](https://avatars.discourse-cdn.com/v4/letter/l/258eb7/32.png) [@Louis-Marie](https://community.forestadmin.com/u/Louis-Marie)\
**Post date:** [September 14, 2021, 9:34am UTC](https://community.forestadmin.com/t/problem-on-getidsfromrequest-with-all-records-selection/3072/7 "2021-09-14T09:34:07Z")

</div>

Hi @anon34731316

I was just testing with the last release of `forest-express-sequelize` : 8.2.0  
It seems to work in general cases, and the impact on performances is enormous…

Excellent!

However, there is still a problem with smart segments.  
It seems that it does not take into account the smart segment when “all records” is selected. It is selecting the whole collection.  
I was using the same route for my tests.  
Could you please check on your side?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![anon34731316](https://avatars.discourse-cdn.com/v4/letter/a/eada6e/32.png) [@anon34731316](https://community.forestadmin.com/u/anon34731316)\
**Post date:** [September 14, 2021, 9:55am UTC](https://community.forestadmin.com/t/problem-on-getidsfromrequest-with-all-records-selection/3072/8 "2021-09-14T09:55:11Z")

</div>

@Louis-Marie thanks for spotting this huge problem!  
We’re investigating at the moment and we’ll get back to you asap.

Thanks.

---

<div class="post-metadata">

**Author:** ![anon34731316](https://avatars.discourse-cdn.com/v4/letter/a/eada6e/32.png) [@anon34731316](https://community.forestadmin.com/u/anon34731316)\
**Post date:** [September 14, 2021, 11:01am UTC](https://community.forestadmin.com/t/problem-on-getidsfromrequest-with-all-records-selection/3072/9 "2021-09-14T11:01:31Z")

</div>

@Louis-Marie could you try to update your `forest-express-sequelize` to version `8.2.2` and tell me if it works better?  
Really sorry for the inconvenience!

---

<div class="post-metadata">

**Author:** ![Louis-Marie](https://avatars.discourse-cdn.com/v4/letter/l/258eb7/32.png) [@Louis-Marie](https://community.forestadmin.com/u/Louis-Marie)\
**Post date:** [September 14, 2021, 12:26pm UTC](https://community.forestadmin.com/t/problem-on-getidsfromrequest-with-all-records-selection/3072/10 "2021-09-14T12:26:20Z")

</div>

Hi @anon34731316

Yes, it works as expected now.  
Thank you very much

Have a nice day.
