1 21 22 package org.apache.derby.impl.sql.execute.rts; 23 24 import org.apache.derby.iapi.services.io.StoredFormatIds; 25 26 import org.apache.derby.iapi.services.i18n.MessageService; 27 import org.apache.derby.iapi.reference.SQLState; 28 29 import org.apache.derby.iapi.services.io.FormatableHashtable; 30 import org.apache.derby.iapi.services.io.FormatableProperties; 31 32 import java.io.ObjectOutput ; 33 import java.io.ObjectInput ; 34 import java.io.IOException ; 35 36 import java.util.Enumeration ; 37 import java.util.Properties ; 38 39 40 46 public class RealLastIndexKeyScanStatistics 47 extends RealNoPutResultSetStatistics 48 { 49 50 51 public String isolationLevel; 52 public String tableName; 53 public String indexName; 54 public String lockString; 55 56 58 62 public RealLastIndexKeyScanStatistics(int numOpens, 63 long constructorTime, 64 long openTime, 65 long nextTime, 66 long closeTime, 67 int resultSetNumber, 68 String tableName, 69 String indexName, 70 String isolationLevel, 71 String lockString, 72 double optimizerEstimatedRowCount, 73 double optimizerEstimatedCost 74 ) 75 { 76 super( 77 numOpens, 78 1, 79 0, 80 constructorTime, 81 openTime, 82 nextTime, 83 closeTime, 84 resultSetNumber, 85 optimizerEstimatedRowCount, 86 optimizerEstimatedCost 87 ); 88 this.tableName = tableName; 89 this.indexName = indexName; 90 this.isolationLevel = isolationLevel; 91 this.lockString = lockString; 92 } 93 94 96 103 public String getStatementExecutionPlanText(int depth) 104 { 105 String header; 106 String isolationString = null; 107 108 initFormatInfo(depth); 109 110 header = 111 indent + MessageService.getTextMessage( 112 SQLState.RTS_LKIS_RS, 113 tableName, 114 indexName); 115 116 header = header + MessageService.getTextMessage( 117 SQLState.RTS_LOCKING_OPTIMIZER, 118 isolationLevel, 119 lockString); 120 121 header = header + "\n"; 122 123 return 124 header + 125 indent + MessageService.getTextMessage(SQLState.RTS_NUM_OPENS) + 126 " = " + numOpens + "\n" + 127 indent + MessageService.getTextMessage(SQLState.RTS_ROWS_SEEN) + 128 " = " + numOpens + "\n" + 129 dumpTimeStats(indent, subIndent) + "\n" + 130 ((rowsSeen > 0) 131 ? 132 subIndent + MessageService.getTextMessage( 133 SQLState.RTS_NEXT_TIME) + 134 " = " + (nextTime / numOpens) + "\n" 135 : 136 "") + "\n" + 137 dumpEstimatedCosts(subIndent); 140 } 141 142 152 public String getScanStatisticsText(String tableName, int depth) 153 { 154 if ((tableName == null) || (tableName.equals(this.tableName))) 155 return getStatementExecutionPlanText(depth); 156 else 157 return (String )""; 158 } 159 160 162 public String toString() 163 { 164 return getStatementExecutionPlanText(0); 165 } 166 167 171 public String getNodeName(){ 172 return MessageService.getTextMessage( 173 indexName == null ? 174 SQLState.RTS_TABLE_SCAN : 175 SQLState.RTS_INDEX_SCAN); 176 } 177 178 183 public String getNodeOn(){ 184 if (indexName == null) 185 return MessageService.getTextMessage(SQLState.RTS_ON, tableName); 186 else 187 return MessageService.getTextMessage( 188 SQLState.RTS_ON_USING, 189 tableName, 190 indexName); 191 } 192 } 193 | Popular Tags |