Skip to content

Excessive database query when getting resource index (select ... from ... where id is null) #6564

@ruark

Description

@ruark
  • Laravel Version: 11.27.2
  • Nova Version: 4.35.3
  • PHP Version: 8.2.24
  • Database Driver & Version: oci8 (yajra/laravel-oci8 11.6.2)

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions