Skip to content

Excessive number of queries for metadata by PDO #212

@repli2dev

Description

@repli2dev

Version: 2.4.6

When analysing queries from the DB side (PostgreSQL) we have discovered that the PDO is making a excessive number of queries for pgclass and pgtype... We investigated that these queries origin from PDO extension itself (hence not visible in any query monitoring done on PHP runtime) and are caused by nette/database from Helpers::detectTypes() where PDO::getColumnMeta() is called.

The excessiveness is that we have around 500 queries on page and this generates around 1500 additional queries (depends on number of columns and custom types), which are quite fast, but still takes around 5% of whole request.

Could the method detectTypes() be efficient? Maybe caching? (However that may not be a good idea as schema can change during execution.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions