Obtenir le plan d'exécution d'une requête (EXPLAIN)
Oracle
EXPLAIN PLAN FOR
SELECT * FROM customer WHERE city = 'Ankara';
SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY);
-- For the actual executed plan:
-- SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR('&sql_id', NULL, 'ALLSTATS LAST'));EXPLAIN PLAN donne le plan estimé ; pour les nombres de lignes réels, utilisez DISPLAY_CURSOR + STATISTICS_LEVEL=ALL.
PostgreSQL
EXPLAIN (ANALYZE, BUFFERS, FORMAT TEXT)
SELECT * FROM customer WHERE city = 'Ankara';ANALYZE exécute RÉELLEMENT la requête (prudence avec INSERT/UPDATE/DELETE ; testez dans une transaction puis ROLLBACK).
MySQL
EXPLAIN ANALYZE
SELECT * FROM customer WHERE city = 'Ankara';
-- Estimate only (does not execute): EXPLAIN FORMAT=JSON SELECT ...;EXPLAIN ANALYZE (MySQL 8.0.18+) exécute la requête ; FORMAT=JSON donne les détails sans l'exécuter.
SQL Server
SET STATISTICS PROFILE ON;
SELECT * FROM dbo.customer WHERE city = 'Ankara';
SET STATISTICS PROFILE OFF;
-- Estimated plan only (does not execute):
-- SET SHOWPLAN_XML ON;Dans SSMS, « Include Actual Execution Plan » (Ctrl+M) affiche le plan graphique.
MongoDB
db.customer.find({ city: "Ankara" }).explain("executionStats")executionStats indique le nombre réel de documents renvoyés et l'utilisation des index (IXSCAN vs COLLSCAN).
Redis
# Not applicable: Redis has no query planner.
# The complexity of each command is documented (e.g. GET O(1), SORT O(N+M*log(M))).Les performances dépendent de la complexité des commandes et de la taille des clés/structures de données ; mesurez-les avec SLOWLOG.