`
luhantu
  • 浏览: 199664 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论
文章列表
  package com.codahale.metrics; import java.util.concurrent.ConcurrentSkipListMap; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicLong; /** * 熔断机制的一种实-- 滑动窗口 * 清除超过一个窗口的,统计窗口内的 * 参考:https://github.com/infusionsoft/yammer-metrics/blob/master/metrics-core ...
package com.kenny.file; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.io.LineIterator; import org.junit.Test; import java.io.File; import java.io.FileInputStream; import java.io.IOException; /** * Created by kenny.dong on 2018/6 ...
import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.Dispatc ...
依赖jar包 <dependency> <groupId>org.json</groupId> <artifactId>json</artifactId> <version>20171018</version> </dependency> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId& ...
1.批量插入数据。 如果有需要插入100000条数据,那么就需要有100000条insert语句,每一句都需要提交到关系引擎那里去解析,优化,然后才能够到达存储引擎做真的插入工作。上述所说的同时插入多条就是一种优化。 2.truncate table    比delete速度要更快一些,但truncate删除后不记录mysql日志,不可以恢复数据   如果没有外键关联,innodb执行truncate是先drop table(原始表),再创建一个跟原始表一样空表,速度要远远快于delete逐条删除行记录。   如果表有外键关联,truncate table将会报错。如果外键指定级联删 ...
mysql索引分类 Innodb和MyISAM默认的索引是Btree索引;而Mermory默认的索引是Hash索引。 MyISAM叶子节点存储的是表的地址,所以说数据文件和索引文件是分开的,也称为非聚集 Innodb不同,主索引它的叶子节点存储的并不是表的地址,而是数据。辅助索引叶子节点存储的是主键的信息。称为聚集索引。 在利用辅助索引的时候,检索到主键信息,然后再通过主键去主索引中定位表中的数据,所以主键不宜用过长的字段,由于所有的辅助索引都包含主索引,很容易让辅助索引变得庞大。 Btree索引中的最左匹配原则: Btree是按照从左到右的顺序来建立搜索树的。比如索引是(nam ...
   数据: 1.把分数最好的学生的成绩减去1分(更新某个最大值的项目) UPDATE student a ,(SELECT MAX(score) score FROM student) b set a.score = a.score - 1 WHERE a.score = b.score;  2.查询每个学生所有课程中分数最高的课程 (查询所有分组中某个值最大的项) select a.name,a.className,a.score from (SELECT id,name,className,max(score) score from student s GROUP BY ...
public interface IUserDAO { @Transactional String add(); String query(); }     public class UserDAOImpl implements IUserDAO { public String add() { System.out.println("add ok!"); return "add"; } public String query() { ...
package com.dev.tool.log.service; import org.junit.Test; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; /** * Created by kenny.dong on 2018/4/2. */ public class CalendarTest { /** * Calendar.getTime 方法是返回自1970-01-01 00:00:0 ...
package com.dev.tool.log.service; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.util.Assert; import org.springframework.util.NumberUtils; import org.springframework.util.StringUtils; import redis.clients.jedis.Jedis; import redi ...
  public class Test { public static void main(String[] args) { int a = 1; int b = 1; Integer c = 3; Integer d = 3; Integer e = 321; Integer f = 321; System.out.println(a == b); System.out.println( ...
在Oracle中有个关键字叫NULL,它表示某个值是未知的、是不确定的。既然是未知的,就有无数种的可能性。因此,NULL并不是一个确定的值。 例1 set serverout on declare v_b1 boolean:=null; --布尔值可以赋值null.当然它另外两种值只能是true,false了 v_a int := null; v_b int := null; --整数可以给它赋值null v_s varchar2(20):= null ; --字符也可以赋值null begin if(v_a= v_b) then --v ...
准备工作: 创建表table_1并插入数据 CREATE TABLE table_1 ( id INT IDENTITY(1,1) PRIMARY KEY, name VARCHAR(50), classid INT ) GO INSERT INTO table_1(name,classid) SELECT'苹果',1 UNION ALL SELECT'香蕉',1 UNION ALL SELECT'草莓',1 UNION ALL SELECT'西瓜',1 UNION ALL SELECT'樱桃',1 UNION ALL SELECT'荔枝' ...
1)Not Null 约束 (防止NULL值进入指定的列) 不能包含Null值或者无值 只能在单个列上定义 同一个表中可以在多个列上分别定义NOT NULL约束 2)UNIQUE 约束 (唯一约束,保证指定的各列组合中没有重复的值) 不能包含重复的值,可以包含多个NULL值或者无值 可以定义在单个列上或者多个列的组合 Oracle会自动为UNIQUE约束的列建立一个唯一索引。如果已经有唯一或非唯一所以,将使用已有的索引。 3)Primary Key 约束(主键约束,唯一标示表的每一列,并防止出现NULL值。一个表只有一个主键约束) 不能有重复值,并且不能包含NULL ...
在sql server中执行1/2 和在oracle中执行1/2结果是不同的,sql server中结果为0,在oracle结果为0.5. 这是为什么呢?关键在于不同数据库对数据类型的默认转换。 在SQL Server中当每一步的计算式中计算符的两边全部为整型时,它会自作聪明的将结果转为整型(而且是舍去小数位,直接截断,而不是四舍五入)。  在Oracle中却不会这样自作聪明的。 所以在sql server中如果1.0/2 结果为0.500000,而在oracle中1/2 和1.0/2 结果都一样,都为0.5. 但是如果你想在sql server中得到想要的值,可以采用cast() ...
Global site tag (gtag.js) - Google Analytics