About me:Oracle ACE pro,optimistic,passionate and harmonious. Focus on ORACLE,MySQL and other database programming,peformance tuning,db design, j2ee,Linux/AIX,Architecture tech,etc
全部博文(191)
发布时间:2025-03-16 18:12:46
oracle,pg,mysql范围越界的选择率估算:
通过以下方式,防止突然变成1,导致笛卡尔积,当然,越界问题容易变成走索引(如果实际查的数据量大,则需要更新统计信息),另外越界的话还是可能估算
成1的,一般都是估算的很少行。......【阅读全文】
发布时间:2025-03-16 18:08:13
oracle读取数据分为物理读、逻辑读,其中大多数时候主要是逻辑读,因为热点数据存在buffer cache里。而物理读,除了direct path read,
也会产生逻辑读,所以逻辑读往往成为衡量SQL性能的重要指标。
逻辑读包括了consistent read(cr读)和db block gets(current reads),其中一致性读是遇到读取的块有DML的,需要从undo里进行一致性块重构,
所以如果select读取的block被修改未提交,读取的时候cr读会增加,这也是会影响性能的,而DML呢,查找时候会进行cr读,更新时候会进行
current reads。
另外注意:
1)如果select返回行很多,fetch size也会影响consistent reads,可能一个块被读取多次,因为每次fetch就要从buffer cache里获取数据。
2)逻辑读指标只会显示SGA里的操作,PGA里的比如hash join的IO操作,不会显示在逻辑读里,所以,逻辑读小的,如果是hash join之类的,不一定性能
就比逻......【阅读全文】
发布时间:2025-01-22 09:09:36
索引是有序存储的,查询最左或最右就可以查询最小,最大值,这是一种非常快的操作,因为min.max索引前导列,只需要从最左或最右侧
扫描到第一个非NULL值即可。
pg和mysql支持索引列min.max写在一起,会快速定位,而oracle不行,oracle可以拆分成两个标量子查询实现。
......【阅读全文】
发布时间:2024-04-07 17:27:47
ORACLE 11G支持NOT IN的NULL AWARE ANTI JOIN算法,但是相关参数要注意。......【阅读全文】
发布时间:2023-05-09 23:07:29
DETERMINISTIC不建立索引,缓存无效,执行的时候还是调用函数,DETERMINISTIC+索引才能缓存,执行的时候不再调用函数......【阅读全文】
吻的感觉适2025-07-18 23:11
https://txc.qq.com/products/762795/blog/2019636
https://txc.qq.com/products/762801/blog/2019637
https://txc.qq.com/products/762763/blog/2019638
https://txc.qq.com/products/762772/blog/2019639
https://txc.qq.com/products/762790/blog/2019641
https://txc.qq.com/products/762758/blog/2019640
https://txc.qq.com/products/762786/blog/2019642
https://txc.qq.com/products/762782/blog/2019643
https://txc.qq.com/products/762757/blog/2019644
https://txc.qq.com/products/762805/blog/2019645
https://txc.qq.com/products/762785/blog/2019647
https://txc.qq.com/products/762815/blog/2019646
https://txc.qq.com/products/762787/blog/2019648
https://txc.qq.com/products/762799/blog/2019649
https://txc.qq.com/products/762775/blog/2019650
https://txc.qq.com/products/762759/blog/2019651
https://txc.qq.com/products/762770/blog/2019652
https://txc.qq.com/products/762855/blog/2019654