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.
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.
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.
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.
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
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!
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
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
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.