You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When we open the resource index, the system makes a strange query to the database like this: select * from (select * from "TABLE" where "TABLE"."ID" is null) where rownum = 1
In this case, "id" is the primary key. This behavior is implemented in the method findModel($resourceId = null) in the trait \vendor\laravel\nova\src\Http\Requests\InteractsWithResources.php
Such a query is executed every time when accessing the index of any resource that does not carry any logic. However, given a large table in the database, it greatly affects performance.
Then open the index page of any resource, for example https://site/nova/resources/users.
Next, look at the log file, where you will see something like this: [2024-10-24 03:52:32] local.DEBUG: select * from "users" where "users"."id" is null limit 1
If you also can't reproduce the problem and close this issue - I promise, I will not write about this problem here anymore. After that, for myself, I will correct this behavior locally of a patch. In this case, unfortunately, other Nova customers will sooner or later face this problem. Judging by the number of closed issues, where other people have already reported to you several times about problems with requests when opening the resource index page.
The text was updated successfully, but these errors were encountered:
Repo for reproduce: https://github.com/ruark/nova-issue-6564
Discussed in #6566
Originally posted by ruark October 23, 2024
Description:
When we open the resource index, the system makes a strange query to the database like this:
select * from (select * from "TABLE" where "TABLE"."ID" is null) where rownum = 1
In this case, "id" is the primary key. This behavior is implemented in the method
findModel($resourceId = null)
in the trait\vendor\laravel\nova\src\Http\Requests\InteractsWithResources.php
Such a query is executed every time when accessing the index of any resource that does not carry any logic. However, given a large table in the database, it greatly affects performance.
In continuation to issue #6564
This is not related to the database type. I tested with PostgreSQL - the same bug is present there too. Tried with a fresh installation.
To reproduce the problem, add the following code to the
register()
method of theApp\Providers\AppServiceProvider
class:Then open the index page of any resource, for example
https://site/nova/resources/users
.Next, look at the log file, where you will see something like this:
[2024-10-24 03:52:32] local.DEBUG: select * from "users" where "users"."id" is null limit 1
Full log: laravel.log
Repo for reproduce: https://github.com/ruark/nova-issue-6564
If you also can't reproduce the problem and close this issue - I promise, I will not write about this problem here anymore. After that, for myself, I will correct this behavior locally of a patch. In this case, unfortunately, other Nova customers will sooner or later face this problem. Judging by the number of closed issues, where other people have already reported to you several times about problems with requests when opening the resource index page.
The text was updated successfully, but these errors were encountered: