Skip to content

Instantly share code, notes, and snippets.

View lamskoy's full-sized avatar

Eugene Lamskoy lamskoy

  • Ukraine
View GitHub Profile
@lamskoy
lamskoy / sql_profiling.php
Created February 3, 2026 15:46 — forked from yaronish/sql_profiling.php
Enable sql profiling for Magento2
<?php
/**
* Enable sql profiling for each page.
*
* Put code to index file in two parts
*/
// place it BEFORE application run
$profiler = \Magento\Framework\App\ObjectManager::getInstance()
->get('Magento\Framework\App\ResourceConnection')
<?php
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
$trace = '';
foreach ($backtrace as $i=>$r) {
$trace .= "[$i] {$r['file']}:{$r['line']}\n";
}