2.37 ms (61.76%)
|
1 |
SELECT DISTINCT
d.id,
CASE WHEN d.annee IS NOT NULL AND d.annee <> 0 THEN d.annee ELSE d2.annee END AS date,
d.type_id AS TYPE,
STRING_AGG(CAST(dl.langue_id AS VARCHAR),' ' ORDER BY dl.langue_id ASC) AS langues,
d.editeur_id AS editeur,
d.collection_id AS collection,
'' AS roles, '' AS paratextes,
regexp_replace(regexp_replace(LOWER(unaccent(d.titre)), '[[:punct:]]', '', 'g'), '^\s+', '', 'g') AS titre_formate
FROM document d
LEFT JOIN document_langue dl ON d.id = dl.document_id
LEFT JOIN infos_element el ON d.infos_element_id = el.id
LEFT JOIN document d2 ON el.doc_hote_id = d2.id
WHERE d.validation = 1 AND d.collection_id = ?
GROUP BY d.id, date, TYPE, editeur, collection, titre_formate
ORDER BY titre_formate ASC, date DESC
SELECT DISTINCT
d.id,
CASE WHEN d.annee IS NOT NULL AND d.annee <> 0 THEN d.annee ELSE d2.annee END AS date,
d.type_id AS TYPE,
STRING_AGG(CAST(dl.langue_id AS VARCHAR),' ' ORDER BY dl.langue_id ASC) AS langues,
d.editeur_id AS editeur,
d.collection_id AS collection,
'' AS roles, '' AS paratextes,
regexp_replace(regexp_replace(LOWER(unaccent(d.titre)), '[[8007:]]', '', 'g'), '^\s+', '', 'g') AS titre_formate
FROM document d
LEFT JOIN document_langue dl ON d.id = dl.document_id
LEFT JOIN infos_element el ON d.infos_element_id = el.id
LEFT JOIN document d2 ON el.doc_hote_id = d2.id
WHERE d.validation = 1 AND d.collection_id = ?
GROUP BY d.id, date, TYPE, editeur, collection, titre_formate
ORDER BY titre_formate ASC, date DESC;
|
0.89 ms (23.16%)
|
1 |
SELECT t0.id AS id_1, t0.nom AS nom_2, t0.issn AS issn_3, t0.e_issn AS e_issn_4, t0.editeur_id AS editeur_id_5, t0.url_id AS url_id_6 FROM collections t0 WHERE t0.id = ?
SELECT t0.id AS id_1, t0.nom AS nom_2, t0.issn AS issn_3, t0.e_issn AS e_issn_4, t0.editeur_id AS editeur_id_5, t0.url_id AS url_id_6 FROM collections t0 WHERE t0.id = 8007;
|