11g新特性之忽快忽慢的执行速度
今天在调一些固定的SQL,调整一下写法,加点注释,改几个别名什么的,本身没什么事情。 结果在其中某一个SQL的时候,忽然卡住了。一共是三个左连接一个EXISTS,每张表都不超过一百万行。按道理说,这种SQL就算慢,也不会超过一分钟,就得出结果。结果执行的
今天在调一些固定的SQL,调整一下写法,加点注释,改几个别名什么的,本身没什么事情。
结果在其中某一个SQL的时候,忽然卡住了。一共是三个左连接一个EXISTS,每张表都不超过一百万行。按道理说,这种SQL就算慢,也不会超过一分钟,就得出结果。结果执行的效果让我很困惑。头一次执行的时候很快,非常快,两秒出结果。再执行一次,就要很久了,反正我是没等到过结果。最长一次等了半小时,我中午饭都吃完了思密达。。。
看计划,没问题,一点问题都没有。看数据库的负载,也没什么问题。可以说库是很闲的。那这是为啥?能执行,能有速度快的,说明Oracle能找到基本正确的计划。但是为什么第二次会慢呢?一下子就想到了一个新特性,11g里对执行计划的新改进。
_OPTIMIZER_USE_FEEDBACK
简单可以理解为这是Oracle对CBO的一种持续改进。本身PLAN就是基于各种数据对实际执行时间的一种推测,COST也是基于一些算法得到的结果,不是一个确切的值。当Oracle执行过这个语句以后,可以在实际环境中得到一些采样结果,这些结果是实际跑出来的,不是推测或者算出来的。这些值比计算得到的COST和ROWS要来的靠谱的多,于是11g就打算用这些值来做动态推测,基于一个可信的执行计划的详细明细来得到更加贴切实际的计划改进。
但是俗话说的好,Oracle不到R2不要用,咳咳。。。
我的SQL就是被这个参数给搞了一下,Oracle依据首次执行的结果优化了,然后我郁闷了。。。
说说验证和解决办法吧。验证的话可以加HINT,OPT_PARAM(’_OPTIMIZER_USE_FEEDBACK‘,‘FALSE’)。如果加过以后,执行效果不再乱飘了,那么就去把这个隐含参数改成false吧。
提示一下,改隐含参数要加引号,写成“a“=b的样子,具体怎么改就不说了,能看到这里的人,改个参数还是会的,是吧。可以改session和system,都不用重启。
原文地址:11g新特性之忽快忽慢的执行速度, 感谢原作者分享。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Will formatting a laptop make it faster? If you want to format your Windows laptop but want to know if it will make it faster, this article will help you know the right answer to this question. Will formatting a laptop make it faster? There are many reasons why users format their Windows laptops. But the most common reason is slow performance or speed of your laptop. Formatting a laptop will completely delete all data stored on the C drive or the hard drive partition where Windows operating system is installed. Therefore, every user will think twice before taking this step, especially when it comes to the performance of the laptop. This article will help you understand whether formatting your laptop will speed it up. Formatting your laptop helps

Laravel is a popular PHP development framework, but it is sometimes criticized for being as slow as a snail. What exactly causes Laravel's unsatisfactory speed? This article will provide an in-depth explanation of the reasons why Laravel is as slow as a snail from multiple aspects, and combine it with specific code examples to help readers gain a deeper understanding of this problem. 1. ORM query performance issues In Laravel, ORM (Object Relational Mapping) is a very powerful feature that allows

Is single-core Google Chrome slower than dual-core browsers? Nowadays, many people are using various browsers to surf the Internet, and Google Chrome is one of them. As the leader in browsers, its technology is unquestionable. Some friends often ask the editor, what do you mean by single- and dual-core browsers? Will this affect browser loading speed? Today I will talk to you about this issue. Single-core and dual-core browser speed PK of Google Chrome First of all, the editor will give you a conclusion: the single-core Google Chrome is not slower than the dual-core browser. The core of the browser is not like a battery, the more there are, the stronger it is. One of the cores of the dual-core browser is the IE browser core, and the other core is WebKit.

There is no concept of a class in the traditional sense in Golang (Go language), but it provides a data type called a structure, through which object-oriented features similar to classes can be achieved. In this article, we'll explain how to use structures to implement object-oriented features and provide concrete code examples. Definition and use of structures First, let's take a look at the definition and use of structures. In Golang, structures can be defined through the type keyword and then used where needed. Structures can contain attributes

With the rapid development of the Internet, programming languages are constantly evolving and updating. Among them, Go language, as an open source programming language, has attracted much attention in recent years. The Go language is designed to be simple, efficient, safe, and easy to develop and deploy. It has the characteristics of high concurrency, fast compilation and memory safety, making it widely used in fields such as web development, cloud computing and big data. However, there are currently different versions of the Go language available. When choosing a suitable Go language version, we need to consider both requirements and features. head

Recently, LG Display announced that its 27-inch 480Hz QHD gaming OLED panel has officially entered mass production. This panel has created a new high in refresh rate and response speed among OLED products. The 480Hz refresh rate is paired with a GtG grayscale response time of 0.02ms, which is a step further than the previous record of 0.03ms, bringing the ultimate experience to game types such as FPS and racing. . The new panel optimizes LG Display’s META Technology to improve the luminous efficiency of OLED materials. The image quality is enhanced and specular reflection is greatly reduced. The four-sided frameless design expands the field of view and brings an immersive experience. Pixel structure optimization WRGB pixel structure is optimized for gaming and document editing needs. Text display is clearer

As a flagship mobile phone that has attracted much attention, Kirin 9000s has attracted widespread discussion and attention since its launch. It is equipped with the latest flagship chip of the Kirin 9000 series, and its performance is very strong. So, what is the performance of Kirin 9000s? Let’s explore it together. First of all, Kirin 9000s is manufactured using a new 5nm process, which greatly improves the performance and power consumption control of the chip. Compared with previous Kirin processors, Kirin 9000s has significantly improved performance. Whether running big games, multitasking or

What are the advantages of Golang in cloud computing? With the rapid development of cloud computing technology, it has become particularly important for developers to choose the right programming language. Among many programming languages, Golang (Go language) has attracted much attention due to its excellent concurrency performance, simplicity and efficiency. This article will explore the advantages of Golang in cloud computing and illustrate it with specific code examples. 1. Excellent concurrency performance Golang is a programming language that supports concurrent programming through goroutine and channel
