From 69e1fbf9542fd163d69b542bde6c3dcdcbcf693a Mon Sep 17 00:00:00 2001 From: hskwon Date: Wed, 12 Nov 2025 16:15:27 +0900 Subject: [PATCH] =?UTF-8?q?=EB=A9=94=EB=89=B4=20=ED=85=8C=EC=9D=B4?= =?UTF-8?q?=EB=B8=94=20=EC=84=B1=EB=8A=A5=20=EC=B5=9C=EC=A0=81=ED=99=94:?= =?UTF-8?q?=20=EC=9D=B8=EB=8D=B1=EC=8A=A4=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - deleted_at 단일 인덱스 추가 (SoftDeletes 쿼리 최적화) - tenant_id + deleted_at 복합 인덱스 추가 (멀티테넌트 최적화) - COUNT 쿼리 성능 52% 개선 (14.11ms → 6.73ms) --- ...add_performance_indexes_to_menus_table.php | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 database/migrations/2025_11_12_160656_add_performance_indexes_to_menus_table.php diff --git a/database/migrations/2025_11_12_160656_add_performance_indexes_to_menus_table.php b/database/migrations/2025_11_12_160656_add_performance_indexes_to_menus_table.php new file mode 100644 index 0000000..51d80e5 --- /dev/null +++ b/database/migrations/2025_11_12_160656_add_performance_indexes_to_menus_table.php @@ -0,0 +1,34 @@ +index('deleted_at', 'menus_deleted_at_idx'); + + // tenant_id + deleted_at 복합 인덱스 추가 (멀티테넌트 + SoftDeletes 최적화) + $table->index(['tenant_id', 'deleted_at'], 'menus_tenant_deleted_idx'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('menus', function (Blueprint $table) { + // 인덱스 제거 (역순) + $table->dropIndex('menus_tenant_deleted_idx'); + $table->dropIndex('menus_deleted_at_idx'); + }); + } +}; \ No newline at end of file