スキップしてメイン コンテンツに移動

投稿

ラベル(tuning)が付いた投稿を表示しています

Oracle SQL Tuning(Index, Query) - チューニングに必要なクエリ

DBMSチューニングにはまずデータサイズが必要。 select segment_name, segment_type, bytes/1024/1024 MB from dba_segments where segment_type='TABLE' order by MB desc 容量が大きいテーブルを探したい時が多いので一応書いとく。 そしてインデックスを確認 select * from all_indexes where table_name = '<table name>'; 遅いQueryは大体テーブルのサイズのせいが多い。 PK名とPKに割り当てられたフィールドを表示 SELECT cons.constraint_name, cols.table_name, cols.column_name, cols.position, cons.status, cons.owner FROM all_constraints cons, all_cons_columns cols WHERE cols.table_name = '<table name>' AND cons.constraint_type = 'P' AND cons.constraint_name = cols.constraint_name AND cons.owner = cols.owner  ORDER BY cols.table_name, cols.position;