Skip to content

Optimisation des requêtes SQL #625

@dba-sig-sfepm

Description

@dba-sig-sfepm

A l'initialisation des pages sont exécutées un bon nombre de requêtes du type :

SELECT ... FROM ... 
WHERE obs.cd_ref in (
                select * from atlas.find_all_taxons_childs(:thiscdref)
            )
            OR obs.cd_ref = :thiscdref
order by ...

Lorsqu'il y a un grand nombre d'observations certaines de ces requêtes peuvent être couteuses en temps d'exécution. Ce temps peut être divisé par presque 4 en réécrivant ces requêtes de la manière suivante :

SELECT ... FROM ... 
     JOIN (select * from atlas.find_all_taxons_childs(:thiscdref)) as fatc on cd_ref = find_all_taxons_childs
UNION
SELECT ... FROM ... 
     WHERE cd_ref = :thiscdref
order by ...

Metadata

Metadata

Assignees

Type

Projects

Status

Backlog

Relationships

None yet

Development

No branches or pull requests

Issue actions