Loading skill
Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Query optimization, indexing, N+1 prevention.
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-02 | ✗→✓ | ▲ Improved | 3% | 0% |
| case-04 | ✗→✓ | ▲ Improved | -19% | 0% |
| case-09 | ✗→✓ | ▲ Improved | -12% | 0% |
| case-10 | ✗→✓ | ▲ Improved | 39% | 0% |
| case-11 | ✗→✓ | ▲ Improved | -34% | 0% |
php<?php // ❌ Bad: N+1 queries $users = $userModel->findAll(); foreach ($users as $user) { $user->orders; // Separate query per user } // ✅ Good: Single query with join $users = $this->db->table('users u') ->select('u.*, GROUP_CONCAT(o.id) as order_ids') ->join('orders o', 'o.user_id = u.id', 'left') ->groupBy('u.id') ->get() ->getResult();
php<?php $this->forge->addField([ 'email' => ['type' => 'VARCHAR', 'constraint' => 255] ]); $this->forge->addKey('email'); // Index $this->forge->addUniqueKey('email'); // Unique index
php<?php $db = \Config\Database::connect(); $db->query("SELECT * FROM users WHERE status = 'active'"); $db->showLastQuery(); // See exact query
Other measured skills in the registry, with their headline benchmark lift.