# Disable lookup calls to database

**URL:** <https://community.dreamfactory.com/t/disable-lookup-calls-to-database/5675>\
**Category:** uncategorized\
**Created:** [November 30, 2025, 12:45pm UTC](https://community.dreamfactory.com/t/disable-lookup-calls-to-database/5675 "2025-11-30T12:45:18Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hussain\_Fakhruddin](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/hussain_fakhruddin/32/935_2.png) [@Hussain\_Fakhruddin](https://community.dreamfactory.com/u/Hussain_Fakhruddin)\
**Post date:** [November 30, 2025, 12:45pm UTC](https://community.dreamfactory.com/t/disable-lookup-calls-to-database/5675/1 "2025-11-30T12:45:18Z")

</div>

How can I disable lookup calls or at-lease cache it ? Its constantly hitting the database.

There are some constraints sql queries also which is constantly hitting.

---

<div class="post-metadata">

**Author:** ![KonnoK](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/konnok/32/1407_2.png) [@KonnoK](https://community.dreamfactory.com/u/KonnoK)\
**Post date:** [December 1, 2025, 6:09pm UTC](https://community.dreamfactory.com/t/disable-lookup-calls-to-database/5675/2 "2025-12-01T18:09:21Z")

</div>

Hi Hussain,

Thanks for the question! If you can share a specific example of the lookup or query that is causing issues, that will help ensure I point you in the right direction. But if I’m understanding the question correctly - DreamFactory does not currently cache lookup queries, so they do run against the database each time a session is initialized. There is not a built-in way to disable or locally cache these calls at this time, but this is an area we are actively evaluating for future improvements. We will update this thread once additional lookup caching options become available.

In the meantime, you can still improve overall performance by enabling and configuring a caching service such as Redis or Memcached within DreamFactory. While this will not cache lookups specifically, it can reduce load by caching other frequently accessed platform data, which may help offset the repeated lookup queries.

---

<div class="post-metadata">

**Author:** ![Hussain\_Fakhruddin](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/hussain_fakhruddin/32/935_2.png) [@Hussain\_Fakhruddin](https://community.dreamfactory.com/u/Hussain_Fakhruddin)\
**Post date:** [December 1, 2025, 6:21pm UTC](https://community.dreamfactory.com/t/disable-lookup-calls-to-database/5675/3 "2025-12-01T18:21:36Z")

</div>

its select \* from lookup table. Even though I don’t have anything in this but it keeps doing this again and again, for each request I feel. Can you help me go in the code to disable the call. Its really consuming my connection pool…Any pointer to disable the call will help, I am not using it at all.

---

<div class="post-metadata">

**Author:** ![KonnoK](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/konnok/32/1407_2.png) [@KonnoK](https://community.dreamfactory.com/u/KonnoK)\
**Post date:** [December 4, 2025, 10:35pm UTC](https://community.dreamfactory.com/t/disable-lookup-calls-to-database/5675/4 "2025-12-04T22:35:01Z")

</div>

Hi Hussain,

Is this for the DreamFactory system database or is it a separate database that you’ve connected to with DreamFactory? If it’s for a separate database, could you please send the response of the GET schema/{table\_name}/\_related endpoint? If you’d rather not post it here, you can send us an email with the response at [dspsupport@dreamfactory.com](mailto:dspsupport@dreamfactory.com)

Once I have this info I should be able to get you pointed in the right direction for how we can best address this.

Thanks!

---

<div class="post-metadata">

**Author:** ![Hussain\_Fakhruddin](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/hussain_fakhruddin/32/935_2.png) [@Hussain\_Fakhruddin](https://community.dreamfactory.com/u/Hussain_Fakhruddin)\
**Post date:** [December 5, 2025, 5:01am UTC](https://community.dreamfactory.com/t/disable-lookup-calls-to-database/5675/5 "2025-12-05T05:01:36Z")

</div>

This is system table of Dreamfactory. I have found the solution. I have disabled the lookup. However, it would be worth caching this in local cache.

I have done this :  
**File 1: Session.php** - Line 831

```auto
public static function setSessionLookups()
{
    // Skip lookup query if table is empty or disabled
    if (env('SKIP_LOOKUP_QUERIES', false)) {
        Session::put('lookup', []);
        Session::put('lookup_secret', []);
        return;
    }
    
    $map = [];
    $mapSecret = [];
    // Loop through and add the system lookups
    $lookups = BaseSystemLookup::get();
    // ... rest of code unchanged

```

I added a variable SKIP\_LOOKUP\_QUERIES

---

<div class="post-metadata">

**Author:** ![KonnoK](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/konnok/32/1407_2.png) [@KonnoK](https://community.dreamfactory.com/u/KonnoK)\
**Post date:** [December 5, 2025, 6:22pm UTC](https://community.dreamfactory.com/t/disable-lookup-calls-to-database/5675/6 "2025-12-05T18:22:27Z")

</div>

Hi Hussain,

Thank you for the update. I’m glad to hear you were able to resolve the issue, and I appreciate you sharing the change you implemented. Adding an option to skip or cache lookup queries could be valuable in certain environments, so I’ll bring this to the team for review as a potential supported feature or .env setting in a future release.

If you have any further questions or issues, feel free to let me know.
