<?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <configuration> <property> <name>io.sort.factor</name> <value>10</value> <description>The number of streams to merge at once while sorting files. This determines the number of open file handles.</description> </property> <property> <name>dfs.name.dir</name> <value>${hadoop.tmp.dir}/dfs/name</value> <description>Determines where on the local filesystem the DFS name nodeshould store the name table(fsimage). ……</description> </property> <property> <name>dfs.web.ugi</name> <value>webuser,webgroup</value> <final>true</final> <description>The user account used by the web interface. Syntax: USERNAME,GROUP1,GROUP2, ……</description> </property> </configuration>Hadoop配置文件的根元素是configuration,一般只包含子元素property。每一个property元素就是一个配置 项,配置文件不支持分层或分级。每个配置项一般包括配置属性的名称name、值value和一个关于配置项的描述description;元素final 和Java中的关键字final类似,意味着这个配置项是“固定不变的”。final一般不出现,但在合并资源的时候,可以防止配置项的值被覆盖。
在 上面的示例文件中,配置项dfs.web.ugi的值是“webuser,webgroup”,它是一个final配置项;从description看, 这个配置项配置了Hadoop Web界面的用户账号,包括用户名和用户组信息。这些信息可以通过Configuration类提供的方法访问。
在 Configuration中,每个属性都是String类型的,但是值类型可能是以下多种类型,包括Java中的基本类型,如 boolean(getBoolean)、int(getInt)、long(getLong)、float(getFloat),也可以是其他类型,如 String(get)、java.io.File(getFile)、String数组(getStrings)等。以上面的配置文件为 例,getInt("io.sort.factor")将返回整数10;而getStrings("dfs.web.ugi")返回一个字符串数组,该数 组有两个元素,分别是webuser和webgroup。
合并资源指将多个配置文件合并,产生一个配置。如果有两个配置文件,也就是两个资源,如core-default.xml和core-site.xml,通过Configuration类的loadResources()方法,把它们合并成一个配置。代码如下:
Configurationconf = new Configuration();
conf.addResource("core-default.xml");
conf.addResource("core-site.xml");
如 果这两个配置资源都包含了相同的配置项,而且前一个资源的配置项没有标记为final,那么,后面的配置将覆盖前面的配置。上面的例子中,core- site.xml中的配置将覆盖core-default.xml中的同名配置。如果在第一个资源(core-default.xml)中某配置项被标记 为final,那么,在加载第二个资源的时候,会有警告提示。3 直接运行Configuration.java则会调用默认配置文件部分结果如下:
<?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <configuration> <property> <name>io.sort.factor</name> <value>10</value> <description>The number of streams to merge at once while sorting files. This determines the number of open file handles.</description> </property> <property> <name>dfs.name.dir</name> <value>${hadoop.tmp.dir}/dfs/name</value> <description>Determines where on the local filesystem the DFS name nodeshould store the name table(fsimage). ……</description> </property> <property> <name>dfs.web.ugi</name> <value>webuser,webgroup</value> <final>true</final> <description>The user account used by the web interface. Syntax: USERNAME,GROUP1,GROUP2, ……</description> </property> </configuration><?xml version="1.0" encoding="UTF-8" standalone="no"?> <configuration> <property> <name>ipc.client.fallback-to-simple-auth-allowed</name> <value>false</value> <source>core-default.xml</source> </property> <property> <name>file.bytes-per-checksum</name> <value>512</value> <source>core-default.xml</source> </property> <property> <name>ipc.server.tcpnodelay</name> <value>false</value> <source>core-default.xml</source> </property> <property> <name>ftp.client-write-packet-size</name> <value>65536</value> <source>core-default.xml</source> </property> <property> <name>nfs3.mountd.port</name> <value>4272</value> <source>core-site.xml</source> </property> </configuration>Hadoop配置文件的根元素是configuration,一般只包含子元素property。每一个property元素就是一个配置 项,配置文件不支持分层或分级。每个配置项一般包括配置属性的名称name、值value和一个关于配置项的描述description;元素final 和Java中的关键字final类似,意味着这个配置项是“固定不变的”。final一般不出现,但在合并资源的时候,可以防止配置项的值被覆盖。
在 上面的示例文件中,配置项dfs.web.ugi的值是“webuser,webgroup”,它是一个final配置项;从description看, 这个配置项配置了Hadoop Web界面的用户账号,包括用户名和用户组信息。这些信息可以通过Configuration类提供的方法访问。
在 Configuration中,每个属性都是String类型的,但是值类型可能是以下多种类型,包括Java中的基本类型,如 boolean(getBoolean)、int(getInt)、long(getLong)、float(getFloat),也可以是其他类型,如 String(get)、java.io.File(getFile)、String数组(getStrings)等。以上面的配置文件为 例,getInt("io.sort.factor")将返回整数10;而getStrings("dfs.web.ugi")返回一个字符串数组,该数 组有两个元素,分别是webuser和webgroup。
合并资源指将多个配置文件合并,产生一个配置。如果有两个配置文件,也就是两个资源,如core-default.xml和core-site.xml,通过Configuration类的loadResources()方法,把它们合并成一个配置。代码如下:
Configurationconf = new Configuration();
conf.addResource("core-default.xml");
conf.addResource("core-site.xml");
如 果这两个配置资源都包含了相同的配置项,而且前一个资源的配置项没有标记为final,那么,后面的配置将覆盖前面的配置。上面的例子中,core- site.xml中的配置将覆盖core-default.xml中的同名配置。如果在第一个资源(core-default.xml)中某配置项被标记 为final,那么,在加载第二个资源的时候,会有警告提示。3 直接运行Configuration.java则会调用默认配置文件部分结果如下:
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <configuration> <property> <name>ipc.client.fallback-to-simple-auth-allowed</name> <value>false</value> <source>core-default.xml</source> </property> <property> <name>file.bytes-per-checksum</name> <value>512</value> <source>core-default.xml</source> </property> <property> <name>ipc.server.tcpnodelay</name> <value>false</value> <source>core-default.xml</source> </property> <property> <name>ftp.client-write-packet-size</name> <value>65536</value> <source>core-default.xml</source> </property> <property> <name>nfs3.mountd.port</name> <value>4272</value> <source>core-site.xml</source> </property> </configuration>
<?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <configuration> <property> <name>io.sort.factor</name> <value>10</value> <description>The number of streams to merge at once while sorting files. This determines the number of open file handles.</description> </property> <property> <name>dfs.name.dir</name> <value>${hadoop.tmp.dir}/dfs/name</value> <description>Determines where on the local filesystem the DFS name nodeshould store the name table(fsimage). ……</description> </property> <property> <name>dfs.web.ugi</name> <value>webuser,webgroup</value> <final>true</final> <description>The user account used by the web interface. Syntax: USERNAME,GROUP1,GROUP2, ……</description> </property> </configuration>Hadoop配置文件的根元素是configuration,一般只包含子元素property。每一个property元素就是一个配置 项,配置文件不支持分层或分级。每个配置项一般包括配置属性的名称name、值value和一个关于配置项的描述description;元素final 和Java中的关键字final类似,意味着这个配置项是“固定不变的”。final一般不出现,但在合并资源的时候,可以防止配置项的值被覆盖。
在 上面的示例文件中,配置项dfs.web.ugi的值是“webuser,webgroup”,它是一个final配置项;从description看, 这个配置项配置了Hadoop Web界面的用户账号,包括用户名和用户组信息。这些信息可以通过Configuration类提供的方法访问。
在 Configuration中,每个属性都是String类型的,但是值类型可能是以下多种类型,包括Java中的基本类型,如 boolean(getBoolean)、int(getInt)、long(getLong)、float(getFloat),也可以是其他类型,如 String(get)、java.io.File(getFile)、String数组(getStrings)等。以上面的配置文件为 例,getInt("io.sort.factor")将返回整数10;而getStrings("dfs.web.ugi")返回一个字符串数组,该数 组有两个元素,分别是webuser和webgroup。
合并资源指将多个配置文件合并,产生一个配置。如果有两个配置文件,也就是两个资源,如core-default.xml和core-site.xml,通过Configuration类的loadResources()方法,把它们合并成一个配置。代码如下:
Configurationconf = new Configuration();
conf.addResource("core-default.xml");
conf.addResource("core-site.xml");
如 果这两个配置资源都包含了相同的配置项,而且前一个资源的配置项没有标记为final,那么,后面的配置将覆盖前面的配置。上面的例子中,core- site.xml中的配置将覆盖core-default.xml中的同名配置。如果在第一个资源(core-default.xml)中某配置项被标记 为final,那么,在加载第二个资源的时候,会有警告提示。3 直接运行Configuration.java则会调用默认配置文件部分结果如下:
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <configuration> <property> <name>ipc.client.fallback-to-simple-auth-allowed</name> <value>false</value> <source>core-default.xml</source> </property> <property> <name>file.bytes-per-checksum</name> <value>512</value> <source>core-default.xml</source> </property> <property> <name>ipc.server.tcpnodelay</name> <value>false</value> <source>core-default.xml</source> </property> <property> <name>ftp.client-write-packet-size</name> <value>65536</value> <source>core-default.xml</source> </property> <property> <name>nfs3.mountd.port</name> <value>4272</value> <source>core-site.xml</source> </property> </configuration>
<?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <configuration> <property> <name>io.sort.factor</name> <value>10</value> <description>The number of streams to merge at once while sorting files. This determines the number of open file handles.</description> </property> <property> <name>dfs.name.dir</name> <value>${hadoop.tmp.dir}/dfs/name</value> <description>Determines where on the local filesystem the DFS name nodeshould store the name table(fsimage). ……</description> </property> <property> <name>dfs.web.ugi</name> <value>webuser,webgroup</value> <final>true</final> <description>The user account used by the web interface. Syntax: USERNAME,GROUP1,GROUP2, ……</description> </property> </configuration>Hadoop配置文件的根元素是configuration,一般只包含子元素property。每一个property元素就是一个配置 项,配置文件不支持分层或分级。每个配置项一般包括配置属性的名称name、值value和一个关于配置项的描述description;元素final 和Java中的关键字final类似,意味着这个配置项是“固定不变的”。final一般不出现,但在合并资源的时候,可以防止配置项的值被覆盖。
在 上面的示例文件中,配置项dfs.web.ugi的值是“webuser,webgroup”,它是一个final配置项;从description看, 这个配置项配置了Hadoop Web界面的用户账号,包括用户名和用户组信息。这些信息可以通过Configuration类提供的方法访问。
在 Configuration中,每个属性都是String类型的,但是值类型可能是以下多种类型,包括Java中的基本类型,如 boolean(getBoolean)、int(getInt)、long(getLong)、float(getFloat),也可以是其他类型,如 String(get)、java.io.File(getFile)、String数组(getStrings)等。以上面的配置文件为 例,getInt("io.sort.factor")将返回整数10;而getStrings("dfs.web.ugi")返回一个字符串数组,该数 组有两个元素,分别是webuser和webgroup。
合并资源指将多个配置文件合并,产生一个配置。如果有两个配置文件,也就是两个资源,如core-default.xml和core-site.xml,通过Configuration类的loadResources()方法,把它们合并成一个配置。代码如下:
Configurationconf = new Configuration();
conf.addResource("core-default.xml");
conf.addResource("core-site.xml");
如 果这两个配置资源都包含了相同的配置项,而且前一个资源的配置项没有标记为final,那么,后面的配置将覆盖前面的配置。上面的例子中,core- site.xml中的配置将覆盖core-default.xml中的同名配置。如果在第一个资源(core-default.xml)中某配置项被标记 为final,那么,在加载第二个资源的时候,会有警告提示。3 直接运行Configuration.java则会调用默认配置文件部分结果如下:
<?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <configuration> <property> <name>io.sort.factor</name> <value>10</value> <description>The number of streams to merge at once while sorting files. This determines the number of open file handles.</description> </property> <property> <name>dfs.name.dir</name> <value>${hadoop.tmp.dir}/dfs/name</value> <description>Determines where on the local filesystem the DFS name nodeshould store the name table(fsimage). ……</description> </property> <property> <name>dfs.web.ugi</name> <value>webuser,webgroup</value> <final>true</final> <description>The user account used by the web interface. Syntax: USERNAME,GROUP1,GROUP2, ……</description> </property> </configuration><?xml version="1.0" encoding="UTF-8" standalone="no"?> <configuration> <property> <name>ipc.client.fallback-to-simple-auth-allowed</name> <value>false</value> <source>core-default.xml</source> </property> <property> <name>file.bytes-per-checksum</name> <value>512</value> <source>core-default.xml</source> </property> <property> <name>ipc.server.tcpnodelay</name> <value>false</value> <source>core-default.xml</source> </property> <property> <name>ftp.client-write-packet-size</name> <value>65536</value> <source>core-default.xml</source> </property> <property> <name>nfs3.mountd.port</name> <value>4272</value> <source>core-site.xml</source> </property> </configuration>Hadoop配置文件的根元素是configuration,一般只包含子元素property。每一个property元素就是一个配置 项,配置文件不支持分层或分级。每个配置项一般包括配置属性的名称name、值value和一个关于配置项的描述description;元素final 和Java中的关键字final类似,意味着这个配置项是“固定不变的”。final一般不出现,但在合并资源的时候,可以防止配置项的值被覆盖。
在 上面的示例文件中,配置项dfs.web.ugi的值是“webuser,webgroup”,它是一个final配置项;从description看, 这个配置项配置了Hadoop Web界面的用户账号,包括用户名和用户组信息。这些信息可以通过Configuration类提供的方法访问。
在 Configuration中,每个属性都是String类型的,但是值类型可能是以下多种类型,包括Java中的基本类型,如 boolean(getBoolean)、int(getInt)、long(getLong)、float(getFloat),也可以是其他类型,如 String(get)、java.io.File(getFile)、String数组(getStrings)等。以上面的配置文件为 例,getInt("io.sort.factor")将返回整数10;而getStrings("dfs.web.ugi")返回一个字符串数组,该数 组有两个元素,分别是webuser和webgroup。
合并资源指将多个配置文件合并,产生一个配置。如果有两个配置文件,也就是两个资源,如core-default.xml和core-site.xml,通过Configuration类的loadResources()方法,把它们合并成一个配置。代码如下:
Configurationconf = new Configuration();
conf.addResource("core-default.xml");
conf.addResource("core-site.xml");
如 果这两个配置资源都包含了相同的配置项,而且前一个资源的配置项没有标记为final,那么,后面的配置将覆盖前面的配置。上面的例子中,core- site.xml中的配置将覆盖core-default.xml中的同名配置。如果在第一个资源(core-default.xml)中某配置项被标记 为final,那么,在加载第二个资源的时候,会有警告提示。3 直接运行Configuration.java则会调用默认配置文件部分结果如下:
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <configuration> <property> <name>ipc.client.fallback-to-simple-auth-allowed</name> <value>false</value> <source>core-default.xml</source> </property> <property> <name>file.bytes-per-checksum</name> <value>512</value> <source>core-default.xml</source> </property> <property> <name>ipc.server.tcpnodelay</name> <value>false</value> <source>core-default.xml</source> </property> <property> <name>ftp.client-write-packet-size</name> <value>65536</value> <source>core-default.xml</source> </property> <property> <name>nfs3.mountd.port</name> <value>4272</value> <source>core-site.xml</source> </property> </configuration>
<?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <configuration> <property> <name>io.sort.factor</name> <value>10</value> <description>The number of streams to merge at once while sorting files. This determines the number of open file handles.</description> </property> <property> <name>dfs.name.dir</name> <value>${hadoop.tmp.dir}/dfs/name</value> <description>Determines where on the local filesystem the DFS name nodeshould store the name table(fsimage). ……</description> </property> <property> <name>dfs.web.ugi</name> <value>webuser,webgroup</value> <final>true</final> <description>The user account used by the web interface. Syntax: USERNAME,GROUP1,GROUP2, ……</description> </property> </configuration>Hadoop配置文件的根元素是configuration,一般只包含子元素property。每一个property元素就是一个配置 项,配置文件不支持分层或分级。每个配置项一般包括配置属性的名称name、值value和一个关于配置项的描述description;元素final 和Java中的关键字final类似,意味着这个配置项是“固定不变的”。final一般不出现,但在合并资源的时候,可以防止配置项的值被覆盖。
在 上面的示例文件中,配置项dfs.web.ugi的值是“webuser,webgroup”,它是一个final配置项;从description看, 这个配置项配置了Hadoop Web界面的用户账号,包括用户名和用户组信息。这些信息可以通过Configuration类提供的方法访问。
在 Configuration中,每个属性都是String类型的,但是值类型可能是以下多种类型,包括Java中的基本类型,如 boolean(getBoolean)、int(getInt)、long(getLong)、float(getFloat),也可以是其他类型,如 String(get)、java.io.File(getFile)、String数组(getStrings)等。以上面的配置文件为 例,getInt("io.sort.factor")将返回整数10;而getStrings("dfs.web.ugi")返回一个字符串数组,该数 组有两个元素,分别是webuser和webgroup。
合并资源指将多个配置文件合并,产生一个配置。如果有两个配置文件,也就是两个资源,如core-default.xml和core-site.xml,通过Configuration类的loadResources()方法,把它们合并成一个配置。代码如下:
Configurationconf = new Configuration();
conf.addResource("core-default.xml");
conf.addResource("core-site.xml");
如 果这两个配置资源都包含了相同的配置项,而且前一个资源的配置项没有标记为final,那么,后面的配置将覆盖前面的配置。上面的例子中,core- site.xml中的配置将覆盖core-default.xml中的同名配置。如果在第一个资源(core-default.xml)中某配置项被标记 为final,那么,在加载第二个资源的时候,会有警告提示。3 直接运行Configuration.java则会调用默认配置文件部分结果如下:
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <configuration> <property> <name>ipc.client.fallback-to-simple-auth-allowed</name> <value>false</value> <source>core-default.xml</source> </property> <property> <name>file.bytes-per-checksum</name> <value>512</value> <source>core-default.xml</source> </property> <property> <name>ipc.server.tcpnodelay</name> <value>false</value> <source>core-default.xml</source> </property> <property> <name>ftp.client-write-packet-size</name> <value>65536</value> <source>core-default.xml</source> </property> <property> <name>nfs3.mountd.port</name> <value>4272</value> <source>core-site.xml</source> </property> </configuration>当在生产环境里面,由于这个索引提示的原因,优化器一般不会再去考虑其他的索引,那有时候这个索引提示可能会导致查询变慢
经过你的测试,发现确实是因为这个索引提示的关系导致查询变慢,但是SQL服务器已经缓存了这条SQL语句的执行计划,如果修改SQL语句的话可能会有影响
而且,可能不单只一条SQL语句用了索引提示,还有其他的SQL语句也用了索引提示,你不可能马上去修改这些SQL语句的时候可以使用SQLSERVER里面的一个trace flag
这个trace flag能忽略SQL语句里面的索引提示和存储过程里面的索引提示
不需要修改SQL语句,就可以进行性能排查
运行下面脚本创建数据库和相关索引
<?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <configuration> <property> <name>io.sort.factor</name> <value>10</value> <description>The number of streams to merge at once while sorting files. This determines the number of open file handles.</description> </property> <property> <name>dfs.name.dir</name> <value>${hadoop.tmp.dir}/dfs/name</value> <description>Determines where on the local filesystem the DFS name nodeshould store the name table(fsimage). ……</description> </property> <property> <name>dfs.web.ugi</name> <value>webuser,webgroup</value> <final>true</final> <description>The user account used by the web interface. Syntax: USERNAME,GROUP1,GROUP2, ……</description> </property> </configuration>Hadoop配置文件的根元素是configuration,一般只包含子元素property。每一个property元素就是一个配置 项,配置文件不支持分层或分级。每个配置项一般包括配置属性的名称name、值value和一个关于配置项的描述description;元素final 和Java中的关键字final类似,意味着这个配置项是“固定不变的”。final一般不出现,但在合并资源的时候,可以防止配置项的值被覆盖。
在 上面的示例文件中,配置项dfs.web.ugi的值是“webuser,webgroup”,它是一个final配置项;从description看, 这个配置项配置了Hadoop Web界面的用户账号,包括用户名和用户组信息。这些信息可以通过Configuration类提供的方法访问。
在 Configuration中,每个属性都是String类型的,但是值类型可能是以下多种类型,包括Java中的基本类型,如 boolean(getBoolean)、int(getInt)、long(getLong)、float(getFloat),也可以是其他类型,如 String(get)、java.io.File(getFile)、String数组(getStrings)等。以上面的配置文件为 例,getInt("io.sort.factor")将返回整数10;而getStrings("dfs.web.ugi")返回一个字符串数组,该数 组有两个元素,分别是webuser和webgroup。
合并资源指将多个配置文件合并,产生一个配置。如果有两个配置文件,也就是两个资源,如core-default.xml和core-site.xml,通过Configuration类的loadResources()方法,把它们合并成一个配置。代码如下:
Configurationconf = new Configuration();
conf.addResource("core-default.xml");
conf.addResource("core-site.xml");
如 果这两个配置资源都包含了相同的配置项,而且前一个资源的配置项没有标记为final,那么,后面的配置将覆盖前面的配置。上面的例子中,core- site.xml中的配置将覆盖core-default.xml中的同名配置。如果在第一个资源(core-default.xml)中某配置项被标记 为final,那么,在加载第二个资源的时候,会有警告提示。3 直接运行Configuration.java则会调用默认配置文件部分结果如下:
<?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <configuration> <property> <name>io.sort.factor</name> <value>10</value> <description>The number of streams to merge at once while sorting files. This determines the number of open file handles.</description> </property> <property> <name>dfs.name.dir</name> <value>${hadoop.tmp.dir}/dfs/name</value> <description>Determines where on the local filesystem the DFS name nodeshould store the name table(fsimage). ……</description> </property> <property> <name>dfs.web.ugi</name> <value>webuser,webgroup</value> <final>true</final> <description>The user account used by the web interface. Syntax: USERNAME,GROUP1,GROUP2, ……</description> </property> </configuration><?xml version="1.0" encoding="UTF-8" standalone="no"?> <configuration> <property> <name>ipc.client.fallback-to-simple-auth-allowed</name> <value>false</value> <source>core-default.xml</source> </property> <property> <name>file.bytes-per-checksum</name> <value>512</value> <source>core-default.xml</source> </property> <property> <name>ipc.server.tcpnodelay</name> <value>false</value> <source>core-default.xml</source> </property> <property> <name>ftp.client-write-packet-size</name> <value>65536</value> <source>core-default.xml</source> </property> <property> <name>nfs3.mountd.port</name> <value>4272</value> <source>core-site.xml</source> </property> </configuration>Hadoop配置文件的根元素是configuration,一般只包含子元素property。每一个property元素就是一个配置 项,配置文件不支持分层或分级。每个配置项一般包括配置属性的名称name、值value和一个关于配置项的描述description;元素final 和Java中的关键字final类似,意味着这个配置项是“固定不变的”。final一般不出现,但在合并资源的时候,可以防止配置项的值被覆盖。
在 上面的示例文件中,配置项dfs.web.ugi的值是“webuser,webgroup”,它是一个final配置项;从description看, 这个配置项配置了Hadoop Web界面的用户账号,包括用户名和用户组信息。这些信息可以通过Configuration类提供的方法访问。
在 Configuration中,每个属性都是String类型的,但是值类型可能是以下多种类型,包括Java中的基本类型,如 boolean(getBoolean)、int(getInt)、long(getLong)、float(getFloat),也可以是其他类型,如 String(get)、java.io.File(getFile)、String数组(getStrings)等。以上面的配置文件为 例,getInt("io.sort.factor")将返回整数10;而getStrings("dfs.web.ugi")返回一个字符串数组,该数 组有两个元素,分别是webuser和webgroup。
合并资源指将多个配置文件合并,产生一个配置。如果有两个配置文件,也就是两个资源,如core-default.xml和core-site.xml,通过Configuration类的loadResources()方法,把它们合并成一个配置。代码如下:
Configurationconf = new Configuration();
conf.addResource("core-default.xml");
conf.addResource("core-site.xml");
如 果这两个配置资源都包含了相同的配置项,而且前一个资源的配置项没有标记为final,那么,后面的配置将覆盖前面的配置。上面的例子中,core- site.xml中的配置将覆盖core-default.xml中的同名配置。如果在第一个资源(core-default.xml)中某配置项被标记 为final,那么,在加载第二个资源的时候,会有警告提示。3 直接运行Configuration.java则会调用默认配置文件部分结果如下:
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <configuration> <property> <name>ipc.client.fallback-to-simple-auth-allowed</name> <value>false</value> <source>core-default.xml</source> </property> <property> <name>file.bytes-per-checksum</name> <value>512</value> <source>core-default.xml</source> </property> <property> <name>ipc.server.tcpnodelay</name> <value>false</value> <source>core-default.xml</source> </property> <property> <name>ftp.client-write-packet-size</name> <value>65536</value> <source>core-default.xml</source> </property> <property> <name>nfs3.mountd.port</name> <value>4272</value> <source>core-site.xml</source> </property> </configuration>
<?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <configuration> <property> <name>io.sort.factor</name> <value>10</value> <description>The number of streams to merge at once while sorting files. This determines the number of open file handles.</description> </property> <property> <name>dfs.name.dir</name> <value>${hadoop.tmp.dir}/dfs/name</value> <description>Determines where on the local filesystem the DFS name nodeshould store the name table(fsimage). ……</description> </property> <property> <name>dfs.web.ugi</name> <value>webuser,webgroup</value> <final>true</final> <description>The user account used by the web interface. Syntax: USERNAME,GROUP1,GROUP2, ……</description> </property> </configuration>Hadoop配置文件的根元素是configuration,一般只包含子元素property。每一个property元素就是一个配置 项,配置文件不支持分层或分级。每个配置项一般包括配置属性的名称name、值value和一个关于配置项的描述description;元素final 和Java中的关键字final类似,意味着这个配置项是“固定不变的”。final一般不出现,但在合并资源的时候,可以防止配置项的值被覆盖。
在 上面的示例文件中,配置项dfs.web.ugi的值是“webuser,webgroup”,它是一个final配置项;从description看, 这个配置项配置了Hadoop Web界面的用户账号,包括用户名和用户组信息。这些信息可以通过Configuration类提供的方法访问。
在 Configuration中,每个属性都是String类型的,但是值类型可能是以下多种类型,包括Java中的基本类型,如 boolean(getBoolean)、int(getInt)、long(getLong)、float(getFloat),也可以是其他类型,如 String(get)、java.io.File(getFile)、String数组(getStrings)等。以上面的配置文件为 例,getInt("io.sort.factor")将返回整数10;而getStrings("dfs.web.ugi")返回一个字符串数组,该数 组有两个元素,分别是webuser和webgroup。
合并资源指将多个配置文件合并,产生一个配置。如果有两个配置文件,也就是两个资源,如core-default.xml和core-site.xml,通过Configuration类的loadResources()方法,把它们合并成一个配置。代码如下:
Configurationconf = new Configuration();
conf.addResource("core-default.xml");
conf.addResource("core-site.xml");
如 果这两个配置资源都包含了相同的配置项,而且前一个资源的配置项没有标记为final,那么,后面的配置将覆盖前面的配置。上面的例子中,core- site.xml中的配置将覆盖core-default.xml中的同名配置。如果在第一个资源(core-default.xml)中某配置项被标记 为final,那么,在加载第二个资源的时候,会有警告提示。3 直接运行Configuration.java则会调用默认配置文件部分结果如下:
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <configuration> <property> <name>ipc.client.fallback-to-simple-auth-allowed</name> <value>false</value> <source>core-default.xml</source> </property> <property> <name>file.bytes-per-checksum</name> <value>512</value> <source>core-default.xml</source> </property> <property> <name>ipc.server.tcpnodelay</name> <value>false</value> <source>core-default.xml</source> </property> <property> <name>ftp.client-write-packet-size</name> <value>65536</value> <source>core-default.xml</source> </property> <property> <name>nfs3.mountd.port</name> <value>4272</value> <source>core-site.xml</source> </property> </configuration>
<?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <configuration> <property> <name>io.sort.factor</name> <value>10</value> <description>The number of streams to merge at once while sorting files. This determines the number of open file handles.</description> </property> <property> <name>dfs.name.dir</name> <value>${hadoop.tmp.dir}/dfs/name</value> <description>Determines where on the local filesystem the DFS name nodeshould store the name table(fsimage). ……</description> </property> <property> <name>dfs.web.ugi</name> <value>webuser,webgroup</value> <final>true</final> <description>The user account used by the web interface. Syntax: USERNAME,GROUP1,GROUP2, ……</description> </property> </configuration>Hadoop配置文件的根元素是configuration,一般只包含子元素property。每一个property元素就是一个配置 项,配置文件不支持分层或分级。每个配置项一般包括配置属性的名称name、值value和一个关于配置项的描述description;元素final 和Java中的关键字final类似,意味着这个配置项是“固定不变的”。final一般不出现,但在合并资源的时候,可以防止配置项的值被覆盖。
在 上面的示例文件中,配置项dfs.web.ugi的值是“webuser,webgroup”,它是一个final配置项;从description看, 这个配置项配置了Hadoop Web界面的用户账号,包括用户名和用户组信息。这些信息可以通过Configuration类提供的方法访问。
在 Configuration中,每个属性都是String类型的,但是值类型可能是以下多种类型,包括Java中的基本类型,如 boolean(getBoolean)、int(getInt)、long(getLong)、float(getFloat),也可以是其他类型,如 String(get)、java.io.File(getFile)、String数组(getStrings)等。以上面的配置文件为 例,getInt("io.sort.factor")将返回整数10;而getStrings("dfs.web.ugi")返回一个字符串数组,该数 组有两个元素,分别是webuser和webgroup。
合并资源指将多个配置文件合并,产生一个配置。如果有两个配置文件,也就是两个资源,如core-default.xml和core-site.xml,通过Configuration类的loadResources()方法,把它们合并成一个配置。代码如下:
Configurationconf = new Configuration();
conf.addResource("core-default.xml");
conf.addResource("core-site.xml");
如 果这两个配置资源都包含了相同的配置项,而且前一个资源的配置项没有标记为final,那么,后面的配置将覆盖前面的配置。上面的例子中,core- site.xml中的配置将覆盖core-default.xml中的同名配置。如果在第一个资源(core-default.xml)中某配置项被标记 为final,那么,在加载第二个资源的时候,会有警告提示。3 直接运行Configuration.java则会调用默认配置文件部分结果如下:
<?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <configuration> <property> <name>io.sort.factor</name> <value>10</value> <description>The number of streams to merge at once while sorting files. This determines the number of open file handles.</description> </property> <property> <name>dfs.name.dir</name> <value>${hadoop.tmp.dir}/dfs/name</value> <description>Determines where on the local filesystem the DFS name nodeshould store the name table(fsimage). ……</description> </property> <property> <name>dfs.web.ugi</name> <value>webuser,webgroup</value> <final>true</final> <description>The user account used by the web interface. Syntax: USERNAME,GROUP1,GROUP2, ……</description> </property> </configuration><?xml version="1.0" encoding="UTF-8" standalone="no"?> <configuration> <property> <name>ipc.client.fallback-to-simple-auth-allowed</name> <value>false</value> <source>core-default.xml</source> </property> <property> <name>file.bytes-per-checksum</name> <value>512</value> <source>core-default.xml</source> </property> <property> <name>ipc.server.tcpnodelay</name> <value>false</value> <source>core-default.xml</source> </property> <property> <name>ftp.client-write-packet-size</name> <value>65536</value> <source>core-default.xml</source> </property> <property> <name>nfs3.mountd.port</name> <value>4272</value> <source>core-site.xml</source> </property> </configuration>
Hadoop配置文件的根元素是configuration,一般只包含子元素property。每一个property元素就是一个配置 项,配置文件不支持分层或分级。每个配置项一般包括配置属性的名称name、值value和一个关于配置项的描述description;元素final 和Java中的关键字final类似,意味着这个配置项是“固定不变的”。final一般不出现,但在合并资源的时候,可以防止配置项的值被覆盖。
在 上面的示例文件中,配置项dfs.web.ugi的值是“webuser,webgroup”,它是一个final配置项;从description看, 这个配置项配置了Hadoop Web界面的用户账号,包括用户名和用户组信息。这些信息可以通过Configuration类提供的方法访问。
在 Configuration中,每个属性都是String类型的,但是值类型可能是以下多种类型,包括Java中的基本类型,如 boolean(getBoolean)、int(getInt)、long(getLong)、float(getFloat),也可以是其他类型,如 String(get)、java.io.File(getFile)、String数组(getStrings)等。以上面的配置文件为 例,getInt("io.sort.factor")将返回整数10;而getStrings("dfs.web.ugi")返回一个字符串数组,该数 组有两个元素,分别是webuser和webgroup。
合并资源指将多个配置文件合并,产生一个配置。如果有两个配置文件,也就是两个资源,如core-default.xml和core-site.xml,通过Configuration类的loadResources()方法,把它们合并成一个配置。代码如下:
Configurationconf = new Configuration();
conf.addResource("core-default.xml");
conf.addResource("core-site.xml");
如 果这两个配置资源都包含了相同的配置项,而且前一个资源的配置项没有标记为final,那么,后面的配置将覆盖前面的配置。上面的例子中,core- site.xml中的配置将覆盖core-default.xml中的同名配置。如果在第一个资源(core-default.xml)中某配置项被标记 为final,那么,在加载第二个资源的时候,会有警告提示。
3 直接运行Configuration.java则会调用默认配置文件部分结果如下:
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <configuration> <property> <name>ipc.client.fallback-to-simple-auth-allowed</name> <value>false</value> <source>core-default.xml</source> </property> <property> <name>file.bytes-per-checksum</name> <value>512</value> <source>core-default.xml</source> </property> <property> <name>ipc.server.tcpnodelay</name> <value>false</value> <source>core-default.xml</source> </property> <property> <name>ftp.client-write-packet-size</name> <value>65536</value> <source>core-default.xml</source> </property> <property> <name>nfs3.mountd.port</name> <value>4272</value> <source>core-site.xml</source> </property> </configuration>
<?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <configuration> <property> <name>io.sort.factor</name> <value>10</value> <description>The number of streams to merge at once while sorting files. This determines the number of open file handles.</description> </property> <property> <name>dfs.name.dir</name> <value>${hadoop.tmp.dir}/dfs/name</value> <description>Determines where on the local filesystem the DFS name nodeshould store the name table(fsimage). ……</description> </property> <property> <name>dfs.web.ugi</name> <value>webuser,webgroup</value> <final>true</final> <description>The user account used by the web interface. Syntax: USERNAME,GROUP1,GROUP2, ……</description> </property> </configuration>
Hadoop配置文件的根元素是configuration,一般只包含子元素property。每一个property元素就是一个配置 项,配置文件不支持分层或分级。每个配置项一般包括配置属性的名称name、值value和一个关于配置项的描述description;元素final 和Java中的关键字final类似,意味着这个配置项是“固定不变的”。final一般不出现,但在合并资源的时候,可以防止配置项的值被覆盖。
在 上面的示例文件中,配置项dfs.web.ugi的值是“webuser,webgroup”,它是一个final配置项;从description看, 这个配置项配置了Hadoop Web界面的用户账号,包括用户名和用户组信息。这些信息可以通过Configuration类提供的方法访问。
在 Configuration中,每个属性都是String类型的,但是值类型可能是以下多种类型,包括Java中的基本类型,如 boolean(getBoolean)、int(getInt)、long(getLong)、float(getFloat),也可以是其他类型,如 String(get)、java.io.File(getFile)、String数组(getStrings)等。以上面的配置文件为 例,getInt("io.sort.factor")将返回整数10;而getStrings("dfs.web.ugi")返回一个字符串数组,该数 组有两个元素,分别是webuser和webgroup。
合并资源指将多个配置文件合并,产生一个配置。如果有两个配置文件,也就是两个资源,如core-default.xml和core-site.xml,通过Configuration类的loadResources()方法,把它们合并成一个配置。代码如下:
Configurationconf = new Configuration();
conf.addResource("core-default.xml");
conf.addResource("core-site.xml");
如 果这两个配置资源都包含了相同的配置项,而且前一个资源的配置项没有标记为final,那么,后面的配置将覆盖前面的配置。上面的例子中,core- site.xml中的配置将覆盖core-default.xml中的同名配置。如果在第一个资源(core-default.xml)中某配置项被标记 为final,那么,在加载第二个资源的时候,会有警告提示。
3 直接运行Configuration.java则会调用默认配置文件部分结果如下:
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <configuration> <property> <name>ipc.client.fallback-to-simple-auth-allowed</name> <value>false</value> <source>core-default.xml</source> </property> <property> <name>file.bytes-per-checksum</name> <value>512</value> <source>core-default.xml</source> </property> <property> <name>ipc.server.tcpnodelay</name> <value>false</value> <source>core-default.xml</source> </property> <property> <name>ftp.client-write-packet-size</name> <value>65536</value> <source>core-default.xml</source> </property> <property> <name>nfs3.mountd.port</name> <value>4272</value> <source>core-site.xml</source> </property> </configuration>
当在生产环境里面,由于这个索引提示的原因,优化器一般不会再去考虑其他的索引,那有时候这个索引提示可能会导致查询变慢
经过你的测试,发现确实是因为这个索引提示的关系导致查询变慢,但是SQL服务器已经缓存了这条SQL语句的执行计划,如果修改SQL语句的话可能会有影响
而且,可能不单只一条SQL语句用了索引提示,还有其他的SQL语句也用了索引提示,你不可能马上去修改这些SQL语句的时候可以使用SQLSERVER里面的一个trace flag
这个trace flag能忽略SQL语句里面的索引提示和存储过程里面的索引提示
不需要修改SQL语句,就可以进行性能排查
运行下面脚本创建数据库和相关索引