strayMat / sndsTools

https://straymat.github.io/sndsTools/
Other
0 stars 1 forks source link

improve `get_first_non_archived_year()` #30

Closed ThomasSoeiro closed 3 weeks ago

ThomasSoeiro commented 2 months ago

Changer : https://github.com/strayMat/sndsTools/blob/5242e9510630af93f9251d60cb4e9c973a75bee4/R/utils.R#L59

avec :

dbGetQuery(
    con,
    "SELECT max(synonym_name) FROM user_synonyms WHERE synonym_name LIKE 'ER_PRS_F_%';"
)

car c'est bien plus rapide :

old <- "SELECT object_name FROM all_objects WHERE object_name LIKE 'ER_PRS_F_%'"
new <- "SELECT max(synonym_name) FROM user_synonyms WHERE synonym_name LIKE 'ER_PRS_F_%';"

dbGetQuery(conn, old) |> system.time()
# utilisateur     système      écoulé 
#       0.015       0.006      19.354 

dbGetQuery(conn, new) |> system.time()
# utilisateur     système      écoulé 
#       0.004       0.000       0.098

Je pourrais m'en occuper après que Matthieu ait mergé #12