Excessive database query when getting resource index (select ... from ... where id is null) #6566
Replies: 8 comments 1 reply
-
Unable to reproduce the issue, please provide full reproducing repository based on fresh installation as suggested in the bug report template (or you can refer to https://github.com/nova-issues for example) |
Beta Was this translation helpful? Give feedback.
-
What happens if |
Beta Was this translation helpful? Give feedback.
-
In what scenario does it become |
Beta Was this translation helpful? Give feedback.
-
As far as I understand, this happens when the available actions are received.
|
Beta Was this translation helpful? Give feedback.
-
I saw this when I logged all the queries being executed to the database. |
Beta Was this translation helpful? Give feedback.
-
And in principle, it doesn't matter in what scenario this can happen, if the |
Beta Was this translation helpful? Give feedback.
-
Unable to replicate this on MySQL or SQLite. Seem to be specific issue to Oracle which we don't have official support. |
Beta Was this translation helpful? Give feedback.
-
Unable? ok I reproduced the same thing in Postgres. In
Then launch any page with the resource index. After that, look at the log. Line 16: Full log:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
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.
Beta Was this translation helpful? Give feedback.
All reactions