memory

MySQL临时表

假如想象 提交于 2020-04-07 17:18:31
概述 MySQL中临时表主要有两类,包括外部临时表和内部临时表。 外部临时表是通过语句create temporary table...创建的临时表,临时表只在本会话有效,会话断开后,临时表数据会自动清理。 内部临时表主要有两类,一类是information_schema中临时表,另一类是会话执行查询时,如果执行计划中包含有“Using temporary”时,会产生临时表。 内部临时表与外部临时表的一个区别在于,我们看不到内部临时表的表结构定义文件frm。 而外部临时表的表定义文件frm,一般是以#sql{进程id}_{线程id}_序列号组成,因此不同会话可以创建同名的临时表。 临时表 临时表与普通表的主要区别在于是否在实例,会话,或语句结束后,自动清理数据。 比如,内部临时表,我们在一个查询中,如果要存储中间结果集,而查询结束后,临时表就会自动回收,不会影响用户表结构和数据。 另外就是,不同会话的临时表可以重名,所有多个会话执行查询时,如果要使用临时表,不会有重名的担忧。 5.7引入了临时表空间后,所有临时表都存储在临时表空间(非压缩)中,临时表空间的数据可以复用。 临时表并非只支持Innodb引擎,还支持myisam引擎,memory引擎等。 因此,临时表我们看不到实体(idb文件),但其实不一定是内存表,也可能存储在临时表空间中。 临时表 VS 内存表

时势造英雄、仅此怀念伟大人(第十四周)

本秂侑毒 提交于 2020-04-07 14:34:20
一、 导入hellodb.sql生成数据库 1、打开数据库,然后使用mysql uroot -predhat打开数据库; 2、导入数据内容;rz导入hellodb_innodb数据库; 3、导入数据内容,数据库出现hellodb数据库; (1) 在students表中,查询年龄大于25岁,且为男性的同学的名字和年龄; (2) 以ClassID为分组依据,显示每组的平均年龄; (3) 显示第2题中平均年龄大于30的分组及平均年龄; (4) 显示以L开头的名字的同学的信息; 二、数据库授权magedu用户,允许192.168.1.0/24网段可以连接mysql 测试 三、总结mysql常见的存储引擎以及特点。 MyISAM ①不支持事务 ②表级锁定 ③读写相互阻塞,写入不能读,读时不能写 ④只缓存索引 ⑤不支持外键约束 ⑥不支持聚簇索引 ⑦读取数据较快,占用资源较少 ,不支持MVCC(多版本并发控制机制)高并发 ⑧崩溃恢复性较差 ⑨MySQL5.5.5前默认的数据库引擎 ,查询速度快、存储空间小,原因是在磁盘上分成三个文件存储:.frm(存储表定义),.MYD(MYData,存储数据),.MYI(MYIndex,存储索引),SELECT COUNT() FROM TABLE时,避免了全表扫描。 1、MyISAM存储引擎适用场景 只读(或者写较少)、表较小(可以接受长时间进行修复操作)

Setting -XX:MaxRam

你。 提交于 2020-04-06 04:38:01
问题 According to this link, there is an option to set MaxRamSize manually to restrict the JVM to not use memory beyond this. But I have not seen any documentation of the same. I've never known this. Is there anything like this or anything similar? PS. I know and I'm not looking to set heap/stack/metaspace/native memory sizes. I just would like to know if there is an overall memory limiting option. Trying it did not help as It errored out: Improperly specified VM option 'MaxRAM=1073741824B' Could

Setting -XX:MaxRam

北城以北 提交于 2020-04-06 04:35:28
问题 According to this link, there is an option to set MaxRamSize manually to restrict the JVM to not use memory beyond this. But I have not seen any documentation of the same. I've never known this. Is there anything like this or anything similar? PS. I know and I'm not looking to set heap/stack/metaspace/native memory sizes. I just would like to know if there is an overall memory limiting option. Trying it did not help as It errored out: Improperly specified VM option 'MaxRAM=1073741824B' Could

部分中断相关函数浅析

为君一笑 提交于 2020-04-05 23:37:12
1. /kernel/irq.c softirq_init 2.6.32.25 1.1 for_each_possible_cpu for ( ( ( cpu ) ) = - 1 ; ( ( cpu ) ) = cpumask_next ( ( ( cpu ) ) , ( cpu_possible_mask ) ) , ( ( cpu ) ) < nr_cpu_ids ; ) 1.2 per_cpu(tasklet_vec, cpu); //取per_cpu_tasklet_vec[cpu],即cpu的tasklet_vec结构。 per_cpu (tasklet_vec, cpu); ( * ( { unsigned long __ptr ; __ptr = ( unsigned long ) ( ( & per_cpu__tasklet_vec ) ) ; ( typeof ( ( & per_cpu__tasklet_vec ) ) ) ( __ptr + ( ( ( __per_cpu_offset [ cpu ] ) ) ) ) ; } ) ) ; 1.3 tasklet_vec / tasklet_hi_vec static DEFINE_PER_CPU( struct tasklet_head, tasklet_vec); static DEFINE_PER_CPU(

Difference between std::uninitialized_copy & std::copy?

可紊 提交于 2020-04-05 08:04:07
问题 What is the difference between std::uninitialized_copy and std::copy and when should I use which? 回答1: Lets say you have allocated some memory on the heap via malloc and have a pointer T* p to it. You end up with uninitialized storage because all malloc does is mark a location of the size you asked for as allocated ( new on the other hand actually constructs objects and thus makes the allocated region initialized storage). Since the memory location starting from p does not have a valid object

java中volatile,synchronized关键字

人盡茶涼 提交于 2020-03-30 12:59:54
volatile是变量修饰符,而synchronized则是作用于一段代码或方法;如下三句get代码: 1 int i1; 2 int geti1() {return i1;} 3 4 volatile int i2; 5 int geti2() {return i2;} 6 7 int i3; 8 synchronized int geti3() {return i3;} geti1() 得到存储在当前线程中i1的数值。多个线程有多个i1变量拷贝,而且这些i1之间可以相互不同。换句话说,另一个线程可能已经改变了它线程内的i1值,而这个值可以和当前线程中的i1值不相同。 在Java内存模型中,有main memory(主内存区域),这里存放了变量目前的“准确值”,每个线程也有自己的memory(例如寄存器)。为了性能,一个线程会在自己的memory中保存要访问的变量的副本。这样就会出现同一个变量在某个瞬间,在一个线程的memory中的值可能与另外一个线程memory的值,或者main memory的值不一致的情况。因此实际上存在一种可能:main memory的值i1值是1,线程1里的i1是2,线程2里的i1值是3,这在线程1和线程2都改变了他们各自的i1值,而且这个改变还没来得及传给main memory 或其他线程时就会发生。 geti2() 得到的是main

Java中关键字volatile 和 synchronized 的作用和区别

邮差的信 提交于 2020-03-30 12:59:41
volatile是变量修饰符,而synchronized则是作用于一段代码或方法 ;如下三个get方法的代码: 1 int i1; 2 int geti1() {return i1;} 3 4 volatile int i2; 5 int geti2() {return i2;} 6 7 int i3; 8 synchronized int geti3() {return i3;} geti1() 得到存储在当前线程中i1的数值。多个线程有多个i1变量拷贝,而且这些i1之间可以相互不同。换句话说,另一个线程可能已经改变了它线程内的i1值,而这个值可以和当前线程中的i1值不相同。 在Java内存模型中,有main memory(主内存区域),这里存放了变量目前的“准确值”,每个线程也有自己的memory(例如寄存器)。为了性能,一个线程会在自己的memory中保存要访问的变量的副本。这样就会出现同一个变量在某个瞬间,在一个线程的memory中的值可能与另外一个线程memory的值,或者main memory的值不一致的情况。因此实际上存在一种可能:main memory的值i1值是1,线程1里的i1是2,线程2里的i1值是3,这在线程1和线程2都改变了他们各自的i1值,而且这个改变还没来得及传给main memory 或其他线程时就会发生。 geti2() 得到的是main

Redis服务器重要属性详解

一世执手 提交于 2020-03-30 10:15:18
Redis服务器重要属性详解 cronloops 属性 cronloops 属性是一个计数器,用于记录服务器的 serverCron 函数被执行的次数,是一个 int 类型的整数。 rdb_child_pid 与 aof_child_pid 属性 rdb_child_pid 和 aof_child_pid 属性用于检查 Redis 服务器持久化操作的运行状态,它们记录执行 BGSAVE 和 BGREWRITEAOF 命令的子进程的 ID。也常常使用这两个属性来判断 BGSAVE 和 BGREWRITEAOF 命令是否正在被执行。 当执行 serverCron 函数时,会检查 rdb_child_pid 和 aof_child_pid 属性的值,只要其中一个属性的值不等于-1,程序就会调用一次 wait3 函数来判断子进程是否发送信号到服务器中。 如果没有信号到达,则表示服务器持久化操作没有完成,程序不做任何处理。而如果有信号到达,那么,针对 BGSAVE 命令,表示新的 RDB 文件已经成功生成;针对 BGREWRITEAOF 命令,表示新的 AOF 文件生成完毕,然后服务器继续执行相应的后续操作。比如,将旧的 RDB 文件或 AOF 文件替换为新的 RDB 文件或 AOF 文件。 另外,当 rdb_child_pid 和 aof_child_pid 属性的值都为-1 时