ORA FAQ 性能调整系列之——为什么AUTOTRACE不会在执行计划中显示分区截断(partition pruning)?

ORA FAQ 性能调整系列之——本地管理表空间环境下查询dba_free_space很慢——有什么办法加速么? ORA FAQ 性能调整系列之——Queries against dba_free_space with locally managed tablespaces are slow - is there any way to speed them up ?本地管理表空间环境下查询dba_free_space很慢——有什么办法加速么?---------------------------------- 阅读详情

The Oracle (tm) Users' Co-Operative FAQ
Why does AUTOTRACE not show partition pruning in the explain plan ?
为什么AUTOTRACE不会在执行计划中显示分区截断(partition pruning)?
--------------------------------------------------------------------------------

Author's name: Norman Dunbar
作者:Norman Dunbar
Author's Email: Oracle (at) BountifulSolutions.co.uk
 Date written:  25  March 2004
写作日期:2004年3月25日
Oracle version(s): 9.2.0.3.0
Oracle版本: 9.2.0.3.0
Why is it that when I use AUTOTRACE in SQL*Plus, the explain plan never shows partition pruning taking place?
为什么当我在SQL*Plus中使用AUTOTRACE时,执行计划从不显示发生了分区截断呢?

 

--------------------------------------------------------------------------------

Autotrace not showing partition pruning/elimination is bug 1426992, but, after investigation Oracle has decided that this is not an optimiser bug, but a bug in SQL*Plus. You can, with a bit of knowledge of your data and a little experimentation, deduce that partition pruning is taking place from the output of autotrace, but there are much easier ways !
AUTOTRACE不显示分区截断/是错误(BUG)1426992,但调查后Oracle发现这不是优化器的错误,而是SQL*Plus的问题。对数据有所了解并经过一点试验后,你可以根据AUTOTRACE的输出推断出发生了分区截断,但有更简单的方法!
The following demonstration shows the failings in autotraceand demonstrates a couple of other methods of determining whether or not your partitions are being pruned - or not.
下面的演示显示了AUTOTRACE不能显示时用其他方法判断是否发生了分区截断。

--------------------------------------------------------------------------------

Autotrace
AUTOTRACE
First of all, create a simple table range partitioned over 6 different partitions, and fill it with some test data extracted from ALL_OBJECTS.
首先创建一个简单的根据区间分为6个分区(range partitioned)的表,并从ALL_OBJECTS填充一些测试数据。

SQL> create table tab_part (part_key number(1), some_text varchar2(500))
  2  partition by range (part_key) (
  3  partition part_1 values less than (2),
  4  partition part_2 values less than (3),
  5  partition part_3 values less than (4),
  6  partition part_4 values less than (5),
  7  partition part_5 values less than (6),
  8  partition part_6 values less than (MAXVALUE) );
Table created.

SQL> insert /*+ append */ into tab_part
  2  select mod(rownum, 10), object_name
  3  from all_objects;
24683 rows created.

SQL> commit;
Commit complete.
Once the table has been filled, analyse it and see how the data has been spread over the various partitions. The first and last partitions have more data in them that the remaining four, hence the differing totals.
一旦表中填入数据,分析并查看数据如何在不同的分区分布。第一和最后的分区比其他四个分区有更多的数据。

SQL> analyze table tab_part compute statistics;
Table analyzed.

SQL> select partition_name, num_rows
  2  from user_tab_partitions
  3  where table_name = 'TAB_PART'
  4  order by partition_name;
PARTITION_NAME                   NUM_ROWS
------------------------------ ----------
PART_1                               4937
PART_2                               2469
PART_3                               2469
PART_4                               2468
PART_5                               2468
PART_6                               9872
6 rows selected.
Now that we have a table to work with, we shall see what autotrace has to say about partition elimination. First, however, note how many logical reads a full scan of the entire table needs :
现在我们有了一个试验表,来看看AUTOTRACE是如何处理分区截断的。不过首先,注意全表扫描所需的逻辑读:

SQL> set autotrace on
SQL> select count(*) from tab_part;
  COUNT(*)
----------
     24683

Execution Plan
----------------------------------------------------------
   0      SELECT STATEMENT Optimizer=CHOOSE (Cost=42 Card=1)
   1    0   SORT (AGGREGATE)
   2    1     PARTITION RANGE (ALL)
   3    2       TABLE ACCESS (FULL) OF 'TAB_PART' (Cost=42 Card=24683)

Statistics
----------------------------------------------------------
          0  recursive calls
          0  db block gets
        135  consistent gets
          0  physical reads
          0  redo size
        381  bytes sent via SQL*Net to client
        499  bytes received via SQL*Net from client
          2  SQL*Net roundtrips to/from client
          0  sorts (memory)
          0  sorts (disk)
          1  rows processed
To read 24,683 rows of data Oracle had to perform 135 logical reads. Keep this in mind and note that the autotrace output shows a full table scan - as we would expect on an unindexed table. The next count should only look in a single partition :
为了读取24,683行数据,Oracle进行了135次逻辑读。记住这些,并注意AUTOTRACE输出显示了一个全表扫描——正如对于一个无索引表,我们所预期的。下面的COUNT只应当搜索一个单独的分区:

SQL> select count(*) from tab_part where part_key = 7;
  COUNT(*)
----------
      2468

Execution Plan
----------------------------------------------------------
   0      SELECT STATEMENT Optimizer=CHOOSE (Cost=17 Card=1 Bytes=2)
   1    0   SORT (AGGREGATE)
   2    1     TABLE ACCESS (FULL) OF 'TAB_PART' (Cost=17 Card=2468 Bytes=4936)
 
Statistics
----------------------------------------------------------
          0  recursive calls
          0  db block gets
         49  consistent gets
          0  physical reads
          0  redo size
        380  bytes sent via SQL*Net to client
        499  bytes received via SQL*Net from client
          2  SQL*Net roundtrips to/from client
          0  sorts (memory)
          0  sorts (disk)
          1  rows processed
This seems to have again carried out a full table scan, but as we already know that a real FTS takes 135 logical reads, the fact that only 49 were required here should indicate that something is different. Autotrace's output is not showing partition elimination. If you didn't know how many reads were required to full scan the table, you would be hard pressed to determine that partition elimination had taken place in this scan.
看起来又一次进行了全表扫描,但正如我们所知,一次真正的FTS需要135次逻辑读,事实上这里需要的49次说明有所改变了。AUTOTRACE的输出没有显示分区截断。如果你不知道全表扫描需要的读(次数),你很难判断这里的搜索发生了分区截断。

Event 10053
事件10053

There are other methods by which we can obtain a true picture of the plan used by the optimiser - a 10053 trace for example would show the details. I've never had to use a 10053 trace so I'm unfortunately not in a position to explain its use, I leave this as 'an exercise for the reader' as they say :o)
我们还有其他方法来获得优化器所用计划的全景——例如,一次10053跟踪将显示出详细信息。我从来都不是必须10053跟踪,所以很不幸我也不适合来解释它的用法,我把它留下来作为“读者的一个练习” :o)

SQL_TRACE and TKPROF
I have used SQL_TRACE and TKPROF though, so here's what shows up when SQL_TRACE is set true.
SQL_TRACE与TKPROF
我用SQL_TRACE与TKPROF,下面是当SQL_TRACE设为TRUE时的输出。

SQL> set autotrace off
SQL> alter session set sql_trace = true;
Session altered.
SQL> alter session set tracefile_identifier = 'PARTITION';
Session altered.

SQL> select count(*) from tab_part where part_key = 7;
  COUNT(*)
----------
      2468

SQL> alter session set sql_trace = false
Session altered.
At this point, exit from SQL*Plus and locate the trace file in USER_DUMP_DEST which has 'PARTITION' in it's name. This is the one you want to run through TKPROF. The output from this is shown below :
此时,退出SQL*Plus并根据USER_DUMP_DEST来定位名字含有“PARTITION”的跟踪文件。运行TKPROF来解释这个文件,输出如下:

select count(*) from tab_part where part_key = 7

call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse        1      0.00       0.00          0          0          0           0
Execute      1      0.01       0.00          0          0          0           0
Fetch        2      0.01       0.01          0         49          0           1
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total        4      0.02       0.01          0         49          0           1
Misses in library cache during parse: 0
Optimizer goal: CHOOSE
Parsing user id: 62 
Rows     Row Source Operation
-------  ---------------------------------------------------
      1  SORT AGGREGATE (cr=49 r=0 w=0 time=10353 us)
   2468   TABLE ACCESS FULL TAB_PART PARTITION: 6 6 (cr=49 r=0 w=0 time=6146 us)
The explain plan clearly shows that partition 6 was the start and stop partition in the scan. In addition, there were 49 logical reads performed to get at the count. This is identical to what we saw above with autotrace, except we get to see that partition pruning did actually take place.
执行计划清楚的显示了分区6是扫描的起始和结束分区。并且,进行了49次逻辑读。除了真实的看到分区截断的确发生了,这与我们在上面用AUTOTRACE的结果一致。

Explain Plan
执行计划
Back in SQL*Plus, there is another method that can be used. The old faithful EXPLAIN PLAN will show how partition pruning did take place.
回到SQL*Plus,还可以用另一种方法。古老而忠实的EXPLAIN PLAN将显示分区截断是如何发生的。

SQL> explain plan
  2  set statement_id = 'Norman'
  3  for
  4  select count(*) from tab_part where part_key = 7;
Explained.
SQL> set lines 132
SQL> set pages 10000
SQL> col operation format a20
SQL> col options format a15
SQL> col object_name format a15
SQL> col p_start format a15
SQL> col p_stop format a15
SQL> col level noprint
SQL>  select level,lpad('  ', 2*level-1)||operation as operation,
  2   options,
  3   object_name,
  4   partition_start as p_start,
  5   partition_stop as p_stop,
  6   cardinality
  7   from plan_table
  8   where statement_id = 'Norman'
  9   start with id=0
 10   connect by prior id=parent_id
 11   order by level
OPERATION            OPTIONS         OBJECT_NAME     P_START         P_STOP          CARDINALITY
-------------------- --------------- --------------- --------------- --------------- -----------
 SELECT STATEMENT                                                                              1
   SORT              AGGREGATE                                                                 1
     TABLE ACCESS    FULL            TAB_PART        6               6                      2468
Once again, the plan clearly shows that partition pruning takes place. The problem is that autotrace doesn't show it at all. Unless you really know how many blocks of data you have in a table and all of its partitions, you may find it difficult to determine whether or not you are seeing a 'true' plan when using partitioned tables and autotrace.
计划再次清楚的显示发生了分区截断。问题是AUTOTRACE不显示。除非真的知道表中有多少数据块与所有的分区,你会发现使用分区表和AUTOTRACE确实很难确定“真正”的计划。

Note: Do you ever suffer from the PLAN_TABLE growing too big as developers fail to delete old rows from the table? Alternatively, do you forget to delete rows from the table?
注意:有没有为PLAN_TABLE增长太快而开发人员不从表中删除旧行而痛苦?或者,你是否忘记从表中删除记录?

Take a copy of $ORACLE_HOME/rdbms/admin/utlxplan.sql and edit it.
复制一份$ORACLE_HOME/rdbms/admin/utlxplan.sql并编辑:
Change this :
修改:

create table PLAN_TABLE (
statement_id    varchar2(30), ...
filter_predicates varchar2(4000));
To this :
为:

create global temporary table PLAN_TABLE (
statement_id    varchar2(30), ...
filter_predicates varchar2(4000))
on commit preserve rows;
Now login to SQL*Plus as SYS and :
现在以SYS登陆SQL*Plus,并:

sql> @?/rdbms/admin/utlxplan_edited    /* Or whatever your copy is called */
sql> grant all on plan_table to public;
sql> create public synonym PLAN_TABLE for SYS.PLAN_TABLE;
Now when developers or DBAs use PLAN_TABLE and logout their rows will be deleted. A self-tidying PLAN_TABLE. Of course, this is no good if you want to keep rows in PLAN_TABLE between sessions.
现在当开发人员或DBA们使用PLAN_TABLE并登出时,他们的记录将被删除。一个自我清洁的PLAN_TABLE。当然,如果你需要在会话间保留PLAN_TABLE中的记录就不行了。

DBMS_XPLAN
Under Oracle 9i (release 2 I think) there is a new PL/SQL package which you can use to show explain plans. The above statement could have its plan shown using this command :
在Oracle 9i(我想是Release 2)中,有一个新的PL/SQL包可以用于显示执行计划。上面的语句可以用如下指令显示计划:

SQL> Select * from table(dbms_xplan.display(statement_id=>'Norman'));
or, if this was the only statement in my PLAN_TABLE :
或者,如果这时我PLAN_TABLE中唯一的语句:

SQL> Select * from table(dbms_xplan.display);
There is much more information shown with this new feature than with a 'normal' explain plan and you don't have to worry about all that formatting either.
其中比“正规”的执行计划显示了更多信息,并且你也不必为格式化操心。

Summary
总结

In summary, autotrace doesn't show partition elimination in Oracle up to versions 9i release 2. You should therefore be aware of this fact and use SQL_TRACE or EXPLAIN_PLAN to get at the true plan for the SQL you are trying to tune/debug.
AUTOTRACE到Oracle 9iR2为止不显示分区截断。所以你应当注意这个事实并使用SQL_TRACE或EXPLAIN_PLAN来获得你需要调整的SQL的真正的计划。

--------------------------------------------------------------------------------

Further reading:
进一步阅读:

Note: 166118.1 Partition Pruning/Elimination on Metalink. You will need a support contract to access Metalink.
注意:166118.1 Partition Pruning/Elimination on Metalink. 你需要一个支持合同来访问Metalink。

Bug: 1426992 SQLPlus AUTOTRACE does not show correct explain plan for partition elimination. Again on Metalink.
Bug: 1426992 SQLPlus AUTOTRACE does not show correct explain plan for partition elimination. 还是在Metalink。

--------------------------------------------------------------------------------
本文翻译自http://www.jlcomp.demon.co.uk/faq/autotrace_pruning.html  译者仅保留翻译版权

esim分布式云卡池技术 eSIM卡,即Embedded-SIM,嵌入式SIM卡。eSIM卡的概念就是将传统SIM卡直接嵌入到设备芯片上,而不是作为独立的可移除零部件加入设备中,用户无需插入物理SIM卡。这一做法将允许用户更加灵活的选择运营商套餐,或者在无需解锁设备、购买新设备的前提下随时更换运营商。未来通用的eSIM标准建立将为普通消费者、企业用户节省更多移动设备使用成本,并带来更多的便利、安全性。 2018年 3月7日,中国联通宣布,正式在上海、天津、广州、深圳、郑州、长沙6座城市率先启动“eSIM一号双终端”业务的办理。[. 阅读详情

相关推荐

小曾WRF自学日记(3)渐入佳境 ——WRF实例-数据下载与WPS前处理

ww

weixin_46297571的博客 1484

oracle分区表执行计划

分区表有很多好处,以大化小,一小化了,加上并行的使用,在loap中能往往能提高几十倍甚至几百倍的效果。当然表设计得不好也会适得其反,效果比普通表跟糟糕。 为了更好的使用分区表,这里看一下分区表的执行计划。 PARTITION RANGE ALL:扫描所有分区 PARTITION RANGE ITERATOR:扫描多个分区,小于所有个分区数量 PARTITION RANGE SINGLE:扫描单一的

莫等闲 3964

linux上使用tun/tap设备模拟一个虚拟网卡,并将该虚拟网卡连接到新创建的网桥上

tun/tap设备是操作系统内核中的虚拟网络设备,是用软件模拟的网络设备,提供与硬件网络设备完全相同的功能。主要用于用户空间和内核空间传递报文。tun/tap对于硬件网络设备而言,一端连接的是物理网络,一端连接的是网络协议栈。对于tun/tap设备而言,一端连接的是应用程序(通过 字符设备文件),一端连接的是网络协议栈。

糖果墙的博客 6416

ORACLE-关于分区表的执行计划

执行计划中的关键字partition list single     --扫描单个分区partition list iterator   --连续扫描N个分区partition list inlist       --不连续扫描N个分区partition list full         --扫描全部分区?测试结果SQL> drop table test purge; SQL> re...

不懂不懂 2853

摄像头模组CCM简介

摄像头模组,全称Camera Compact Module,简写为CCM。CCM 包含几大件: 镜头(lens)、音圈马达(VCM)、传感器(sensor)、软板(FPC)、图像处理芯片(DSP)。工作原理:物体通过镜头(lens)聚集的光,通过CMOS或CCD集成电路,把光信号转换成电信号,再经过内部图像处理器(ISP)转换成数字图像信号输出到数字信号处理器(DSP)加工处理,转换成标准的GRB、YUV等格式图像信号。摄像头模组主要由以下几个部分组成:镜头(Lens):将光线汇聚到图像传感器上。

m0_73482095的博客 1万+

5分钟搞懂MSDNet:用Transformer实现小样本语义分割的保姆级教程

本文详细介绍了MSDNet(Multi-Scale Decoder Network)如何利用Transformer架构实现小样本语义分割。通过多尺度解码器和空间Transformer解码器,MSDNet能够在仅有1-5张标注图像的情况下完成精确分割任务。文章提供了PyTorch代码实例和优化技巧,帮助开发者快速掌握这一前沿技术。

weixin_30832143的博客 510

Apache Doris 实践

apache doris学习与实战

qq_26817225的博客 6463

从零到一:Qt与PCL的跨平台开发环境搭建全攻略

本文详细介绍了从零开始搭建Qt与PCL跨平台开发环境的完整流程,涵盖Windows、Linux和macOS三大平台。重点解析了Qt5与Qt6版本选择、PCL库安装配置、VTK集成等关键技术要点,并提供跨平台CMake项目模板和常见问题解决方案,助力开发者快速构建三维点云处理应用。

weixin_29280657的博客 390

Oracle 分区执行计划详解

Part1. 分区执行计划的区别 在F5中查看执行计划的时候总是看到很多信息: range分区 执行计划中出现的: 分区表,按 n1 ,n2 分区 partition range single:访问单个分区 partition range iterator:访问多个分区 ---执行计划中的 PSTART/PSTOP 值代表什么 KEY...

Richie's 残酷舞台 3398

WinCC 7.5 读取 SQL server2016 中的表格数据

环境 win10 SQL Server 2016 WinCC V7.5 SP2 1 安装SQL Server 2016 2 选择服务器名称 .\WINCC 3 建数据库

skr? 7149

vscode中运行gcc -v命令失败了,提示:gcc不是内部或外部命令...如何解决?

🏆本文收录于 《全栈Bug调优(实战版)》 专栏,该专栏专注于分享我在真实项目开发中遇到的各类疑难Bug及其深层成因,并系统提供高效、可复现的解决思路和实操方案。无论你是刚入行的新手开发者,还是拥有多年项目经验的资深工程师,本专栏都将为你提供一条系统化、高质量的问题排查与优化路径,助力你加速成长,攻克技术壁垒,迈向技术价值最大化与职业发展的更高峰🚀!

**My Coding Family** 982

截断分区(truncate)/重命名分区(rename)/移动分区(move)

截断分区(truncate):截断分区和drop分区类似,但是区别在于他只是截断数据,并且降低HWM,同时不同还包括其可以对HASH分区使用限制:1、如果此分区中包含了数据,截断后全局索引和普通索引均失效,除非带上update ...

cri5768的博客 746

115网页版VR模式终于能用了!电脑直接播放vr视频沉浸感满满 115vr播放 无需vr头盔播放vr视频 在线vr播放器 115网盘360度视频播放方法 115全景视频播放教程

油猴 + 脚本让你网页端直接开启 VR 模式支持 360 视频拖动视角,非常沉浸适合电脑设备直接用无需vr头盔也能轻松畅看vr视频,希望也能帮到你。如果你也被 115 的限制搞烦了,不妨试试这招。

代码简单说 Vue、JAVA、PHP、Node.js 熟练运用,接口、架构、性能全搞定。 5752

jquery auto-complete问题

如果用jsp默认的documte type,那么会出现auto-complete的宽度不对的情况,要用默认的<!DOCTYPE HTML> 转载于:https://www.cnblogs.com/yanjunwu/archive/2013/05/16/3081468.html...

dinglongpei8983的博客 182

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

分区表查询带分区条件,没有分区消除

1、数据库中交易流水表越来越大,对流水表以create_time列做了分区,开发配合对sql改进,加了create_time做查询条件。但是观察sql执行情况,查询sql的where条件中虽然有create_time,但是却是全表扫描所有分区,性能甚至低于分区之前  分区情况如下:    sql文本和执行计划如下:    对应的java代码如下,其中使用了timestamp类型:

he3912377的博客 1万+

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

分区修剪(Partition Pruning)

Partition Pruning Partition pruning is an essential performance feature for data warehouses. In partition pruning, the optimizer analyzes FROM and WHERE clauses in SQL statements to eliminate u

blockheading的博客 3796

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

分区表创建与截断

创建: CREATE TABLE EVENT_TABLE ( NAME VARCHAR2(100 BYTE) NOT NULL, OCCUR_TIME DATE NOT NULL, MSECOND NUMBER(10) NOT

皓月如我的专栏 1315

截断、移动和重命名表分区!

截断表分区(Truncate Partition) Truncate partition就像truncate table一样,直接从头部截断数据,用来删除数据那是效率超高无比。但是如果该表有外键引用的话,ddl的truncate就不好使了,这时候你只能要么使用delete,要么

事后诸葛亮的程序人生(微信:zq9017197) 2142

Expert One-on-One Oracle阅读笔记

Expert One-on-One Oracle阅读笔记 第 6 章 数据库表6.1 表的类型1.        堆组织表2.        索引组织表3.        聚簇表4.        散列聚簇表5.        嵌套表6.        临时表7.        对象表一张表最多有1000列;表的行数理论上没有限制;表上索引个数可

C'est la vie 9326

Library Cache Lock的解决

昨晚业务系统导入资料并重建索引时一个会话突然停滞不前,用TOAD一看,一直在等待Library Cache Lock。TOAD、OEM中都看不到此锁,会话每三秒启动一次,但每次都是等待这个锁。显然,这和数据字典有关,应该是一个索引的数据字典中的记录被锁住了,导致无法重建。可是杀光了其他ACTIVE的会话,问题仍然没有得到解决,看来是某一个被杀死的会话持有该锁,而会话尚未回滚完全,进程仍然吊死着。现

C'est la vie 8328

Install Oracle 9i/10g On RHEL AS 3

Install Oracle 9i/10g On RHEL AS 3 作者:ern (yaoyongping@gmail.com) 本文描述了在Red Hat Enterprise Linux Advanced Server 3 (RHEL AS 3)上安装Oracle 9i/10g 必要的步骤和相关知识。相关文章很多,本文主要着重于整理和总结了网友(特别是Fenng)的文档、Red

C'est la vie 4076

ORA FAQ 性能调整系列之——压缩索引会提高性能么?

Will compressing my indexes improve performance ?压缩索引会提高性能么?Authors name: Jonathan LewisAuthors Email: Jonathan@jlcomp.demon.co.uk Date written: 26th Feb 2003Oracle version(s): 8.1 - 9.2Comp

C'est la vie 3895

ORA-01591故障处理

早晨到办公室听同事说表被锁了,一试,发现表中某字段为1111111的行都被锁了,SELECT都不行。报错误ORA-01591,打开TOAD的Knowledge eXpert,描述很少,只是说由于分布式事务错误而造成锁定。询问同事,昨天通过一个存储过程调用另一个存储过程出了错误,而后者通过透明网关insert一些数据到SQl Server数据库。立即想到打开OEM,谁知道大失所望,进入锁,根本没发现

C'est la vie 3890

国产数据库?

http://www.csdn.net/news/newstopic/20/20911.shtml多好的一篇帖子啊,和Oracle、Sybase等可以媲美啊。怀着无比的憧憬到http://www.kingbase.com.cn/docc/download_cp.htm下载了一个,刚下来的时候我以为自己看错了,7.6M?不管它,小个头的正好,免费下载的是forWin32的版本,环境也

C'est la vie 3459

Bug2108072导致Instance Crash

中午11时40分左右,QDCJ(132.113.64.68)数据库所有连接断开。远程登录主机后发现InstanceCrash。立即进入SQLPLUS手动重启,并检查Alert.log。发现类似下面的错误(截取为之后一次宕机信息):Thu Aug 25 12:11:11 2005Errors in file d:/oracle/admin/xdcj/udump/xdcj_ora_

C'est la vie 2608

T-SQL中的正则表达式

T-SQL中的正则表达式原作者:Cory Koski发表时间:2003/06/24        本文来自Cory Koski。Cory写道:“我最近遇到一个问题,就是试图在数据库域中搜索一个正则表达式。还没有一个版本的SQLServer内部支持正则表达式,但我发现了一个将正则表达式的所有优点添加到你的T_SQL应用的方法。为了更容易的使用正则表达式,我们可以使用自定义函数(User De

C'est la vie 2372
上一篇: 又有新CD
下一篇: 中秋节
ern
ern
博客等级 码龄24年 25粉丝 115原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址