maven

来源:互联网 发布:知乎回答可以删除吗 编辑:程序博客网 时间:2024/06/03 20:09

========================================================================================================================================================================
EXPLAIN SELECT MAX(t.birthday) from bh_auth_user_main t

create index idx_birthday on 表(列)

select count(release_year='2006' or null) as 'sd',count(release_year='2006' or null) as '2007' from film;

1查询重复和冗余索引
int_aton() inet_ntoa()
=========================================================================================================================================================================
=========================================================================================================================================================================
maven
一 :依赖的范围  (1编译 2 测试 3运行)
<scope>import</scope>
1 compile (1编译 2 测试 3运行)。默认使用此依赖范围
2 provied (1编译 2 测试)
3 runtime (2 测试 3运行)
4 test  (2 测试 )
5 system (1编译 2 测试) 不可移植性
6 import  导入的范围 ,它只用在dependcyManagement中
表示从其他的pom中导入dependency 配置
二 依赖传递
eg:山鸡跟楠哥混  南哥跟b哥混====》等价于山鸡间接跟b哥混
Run as===》maven build ===> clean package //打包
install //安装到本地仓库 [INFO] Installing D:\kaifaHuanjing\lijufa\workspase\hongxing-bge\pom.xml to C:\Users\ljf\.m2\repository\com\hongxing\hongxing-bge\0.0.1-SNAPSHOT\hongxing-bge-0.0.1-SNAPSHOT.pom
clean compile
 <exclusions>
          <exclusion>
            <groupId>com.hongxing</groupId>
            <artifactId>hongxing-bge</artifactId>
          </exclusion>
  </exclusions>
三 依赖冲突
1 短路优先
a-b-c-x(jar)
a-d-x(jar)
2 先声明先优先
四 聚合和继承
聚合(其他项目的容器) <modules>..............    <module>BigHealth-Ehr</module>..........</modules>
继承:父类有的子类就有  
Maven 中央仓库地址:

    1. http://www.sonatype.org/nexus/

    2. http://mvnrepository.com/ (本人推荐仓库)

    3. http://repo1.maven.org/maven2

==========================
1.打开eclipse
2.window-->references-->Maven0-->
User Settings:修改User Settings,
Browse重新选择新位置D:\gongsi\apache-maven-3.1.0\conf\settings.xml。


当你在eclipse中集成了maven2后,默认情况下,
eclipse会在你的系统盘(c:/)下创建一个目录,
C:/Documents and Settings/danlley/.m2/repository
并将其作为数据仓库目录。如果有一天当你很不幸的需要重做系统,
而又无法将maven2仓库目录下的数据及时转移的时候,
你此前对maven2仓库所做的一切维护都将意味着竹篮打水一场空。为了让你的在maven2中的损失最小,
提高你所谓劳动成果的安全系数,建议将你的数据仓库进行迁移,具体设置方式如下:
1.打开eclipse
2.window-->references-->Java-->build path-->classpath variables
3.通过上面两部操作你将看到一个名为M2_REPO的variables属性
4.双击属性或者点击edit按钮
5.修改属性C:/Documents and Settings/danlley/.m2/repository 为 E:/maven-2.0.4/.m2/repository
 
OK,从此你就可以高枕无忧喽!
===========================================
<groupId>反写的公司网址+项目名</groupId>
<artifactId>项目名+模块名<artifactId>
<version></version>
<!-- 默认 jar
war
zip
pom
-->
<packaging></packaging>
<name>项目描述名</name>
<url>项目地址</url>
<description>项目描述</description>
<parent>
        <groupId>com.dcits.djk</groupId>
        <artifactId>BigHealth</artifactId>
        <version>0.0.1-SNAPSHOT</version>
</parent>
//
<modules>
      <module>BigHealth-Core</module>
      <module>BigHealth-Web</module>
      <module>BigHealth-Auth</module>
      <module>BigHealth-Manager</module>
      <module>BigHealth-Img</module>
      <module>BigHealth-Mis</module>
      <module>BigHealth-Consult</module>
      <module>BigHealth-Selftest</module>
      <module>BigHealth-Telserv</module>
      <module>BigHealth-Ohar</module>
      <module>BigHealth-Medicalabroad</module>
      <module>BigHealth-Examination</module>
      <module>BigHealth-Examcenter</module>
      <module>BigHealth-Familydoctor</module>
      <module>BigHealth-Ncd</module>
      <module>BigHealth-Ehr</module>
  </modules>
<build>
//插件
<plugins>
<!-- compiler插件, 设定JDK版本 -->
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.5</version>
    <configuration>
        <source>1.8</source>
        <target>1.8</target>
        <showWarnings>true</showWarnings>
    </configuration>
</plugin>
</plugins>
<defaultGoal>compile</defaultGoal>
    </build>
<!-- 依赖管理 -->
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-framework-bom</artifactId>
                <version>4.2.4.RELEASE</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
<!-- 列表依赖-->
<dependencies>
   <dependency>
    <groupId>cglib</groupId>
           <artifactId>cglib-nodep</artifactId>
        <version>3.2.0</version>
        //依赖范围
        <scope>runtime</scope>
       </dependency>

</dependencies>


============================================


一:开启慢查询日志
1 查看是否开启慢查询日志
show variables like 'slow_query_log';
2查看
show variables like '%log%';
3 开启
set global log_queries_not_using_indexes=on;
4 查看多少时间计入慢查询日志
show variables like 'long_query_time';
5 开启
set global slow_query_log=on;
6 查看慢查询日志的位置
show variables like 'slow%';
cd /var/lib/mysql/hadoop03-slow.log
二 慢查询分析工具mysqldumpslow
[root@hadoop03 ~]# mysqldumpslow -h
mysqldumpslow -t 3 /var/lib/mysql/hadoop03-slow.log  | more
pt-query-digest -h
===========
MySQL慢查日志分析工具之pt-query-digest
pt-query-digest  -h
pt-query-digest  -limit
pt-query-digest  /var/lib/mysql/hadoop03-slow.log  | more

三  explain 查询sql的执行计划
table:显示这一行的数据是关于哪张表的

type:这是重要的列,显示连接使用了何种类型。从最好到最差的连接类型为const、eq_reg、ref、range、indexhe和ALL

possible_keys:显示可能应用在这张表中的索引。如果为空,没有可能的索引。可以为相关的域从WHERE语句中选择一个合适的语句

key: 实际使用的索引。如果为NULL,则没有使用索引。很少的情况下,MYSQL会选择优化不足的索引。这种情况下,
可以在SELECT语句中使用USE INDEX(indexname)来强制使用一个索引或者用IGNORE INDEX(indexname)来强制MYSQL忽略索引

key_len:使用的索引的长度。在不损失精确性的情况下,长度越短越好

ref:显示索引的哪一列被使用了,如果可能的话,是一个常数

rows:MYSQL认为必须检查的用来返回请求数据的行数

Extra:关于MYSQL如何解析查询的额外信息。将在表4.3中讨论,但这里可以看到的坏的例子是Using temporary和Using filesort,
意思MYSQL根本不能使用索引,结果是检索会很慢

0 0
原创粉丝点击