Optimasi Query Laporan Desa Aktif#623
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
issue #618
Ringkasan Perubahan
Pull request ini bertujuan untuk mengoptimalkan performa halaman Laporan Desa Aktif guna menghindari masalah "Slow Query" dan error 504 (timeout) di server.
Masalah utama sebelumnya adalah query yang sangat berat karena mengambil seluruh kolom data desa (SELECT *) serta menghitung jumlah akses desa tanpa index yang tepat.
Detail Perubahan
1. Optimasi Controller (
LaporanDesaAktifController.php)withCountyang berat dengan query manual yang sudah dioptimalkan untuk menghitung akses desa selama 30 hari terakhir.2. Penambahan Index Database
Menambahkan index baru untuk mempercepat proses pencarian data:
akses: Menambahkan index pada kolomdesa_iddancreated_at. Ini membuat proses penghitungan jumlah akses menjadi sangat cepat.desa: Menambahkan index pada kolomupdated_atuntuk mempercepat filter pencarian desa aktif.3. Peningkatan Keamanan & Testing
LaporanDesaAktifTest.php) untuk memastikan fitur tetap berjalan dengan benar setelah optimasi. Seluruh test (5 test case) telah lolos 100%.Cara Verifikasi
php artisan test --filter=LaporanDesaAktifTest