其實(shí)隨著技術(shù)的發(fā)展,大表和小表的概念也不停的變化的。
創(chuàng)新互聯(lián)公司是一家專注于成都網(wǎng)站制作、網(wǎng)站建設(shè)、外貿(mào)網(wǎng)站建設(shè)與策劃設(shè)計,潮陽網(wǎng)站建設(shè)哪家好?創(chuàng)新互聯(lián)公司做網(wǎng)站,專注于網(wǎng)站建設(shè)10余年,網(wǎng)設(shè)計領(lǐng)域的專業(yè)建站公司;建站業(yè)務(wù)涵蓋:潮陽等地區(qū)。潮陽做網(wǎng)站價格咨詢:18980820575
一般而言,大表的記錄數(shù)超過100萬吧
記錄數(shù)超過1000萬條,為超大表,一般就要分區(qū)了,否則性能沒辦法保證的。
1.?推薦一個使用平均值估算表空間的腳本:
--不適用windows
with t1 as (
select ss.run_time,ts.name,
decode((round(su.tablespace_usedsize*dt.block_size/1024/1024,2)),null,0,(round(su.tablespace_usedsize*dt.block_size/1024/1024,2))) used_size_mb
from
dba_hist_tbspc_space_usage su,
(select trunc(BEGIN_INTERVAL_TIME) run_time,max(snap_id) snap_id from dba_hist_snapshot
group by trunc(BEGIN_INTERVAL_TIME) ) ss,
v$tablespace ts,
dba_tablespaces dt
where su.snap_id = ss.snap_id
and su.tablespace_id = ts.ts#
and ts.name NOT LIKE '%TEMP%'
and ts.name NOT LIKE '%UNDO%'
and ts.name = dt.tablespace_name order by 2,1),
t2 as (
select e.run_time,e.name,e.used_size_mb,e.used_size_mb - b.used_size_mb growth
from t1 e, t1 b
where e.name = b.name and e.run_time = b.run_time +1),
t5 as (select a.TABLESPACE_NAME,
? ? ? ? a.FILE_NAME,
? ? ? ? a.FILE_ID,
? ? ? ? a.BYTES,
? ? ? ? a.AUTOEXTENSIBLE,
? ? ? ? a.ONLINE_STATUS,
? ? ? ? a.MAXBYTES,
? ? ? ? case
? ? ? ? ? when a.AUTOEXTENSIBLE = 'YES' and
? ? ? ? ? ? ? ? a.ONLINE_STATUS not in ('OFFLINE', 'SYSOFF') then
? ? ? ? ? ? nvl(a.MAXBYTES, 0)
? ? ? ? ? else
? ? ? ? ? ? nvl(a.BYTES, 0)
? ? ? ? end file_max_size
? ? from dba_data_files a
? ? where a.tablespace_name NOT LIKE '%TEMP%'
? ? and a.tablespace_name NOT LIKE '%UNDO%'
? ? ),
t3 as (
select tsz.tablespace_name,
tsz.alloc_size_mb,ave.avg_growth_per_day_mb,ave.avg_growth_per_day_mb*90 projected_growth_for_3mths_mb
from
(select tablespace_name, round(sum(file_max_size)/1024/1024,2) alloc_size_mb? from t5 group by tablespace_name) tsz,
(select name,decode(round(avg(growth),2),null,0.11,0,0.11, round(avg(growth),2)) avg_growth_per_day_mb from t2 group by name) ave
where tsz.tablespace_name = ave.name),
t6 as (select
d.tablespace_name tablespace_name,
round((d.sumbytes/1024/1024),2) total_g ,
round(decode(f.sumbytes,null,0,f.sumbytes)/1024/1024,2) free,
round(((d.sumbytes-f.sumbytes)/1024/1024),6) size_could_be_used,
round((d.sumbytes-decode(f.sumbytes,null,0,f.sumbytes))*100/d.sumbytes,2) used_pct,
(100-round((d.sumbytes-decode(f.sumbytes,null,0,f.sumbytes))*100/d.sumbytes,2))*round((d.sumbytes/1024/1024),2) real_free
from
(select
? tablespace_name,? sum(bytes) sumbytes
from dba_free_space? group by tablespace_name) f,
(select tablespace_name,? ? ? sum(bytes) sumbytes? ?
? from dba_data_files? ? group by tablespace_name) d
where f.tablespace_name(+) = d.tablespace_name)
select t4.tablespace_name,decode(t3.alloc_size_mb,null,0,t3.alloc_size_mb) alloc_sz_mb,
--t6.real_free/round(decode(avg_growth_per_day_mb,null,365,0,365,(t3.avg_growth_per_day_mb)),2) Days_To_Be_Used,
((100-decode(round(t6.size_could_be_used*100/t3.alloc_size_mb,2),null,0,round(t6.size_could_be_used*100/t3.alloc_size_mb,2)))/100*t3.alloc_size_mb)/avg_growth_per_day_mb? Days_To_Be_Used,
round(t6.size_could_be_used*100/t3.alloc_size_mb,4) used_pct_auto,
t6.used_pct used_pct_real
from t3,t6,
(select a.tablespace_name,
round(a.bytes/1024/1024/1024,2) alloc,
round(c.bytes/1024/1024/1024,2) free
from sys.sm$ts_avail a,
sys.sm$ts_free c
where a.tablespace_name = c.tablespace_name(+)
and a.tablespace_name NOT LIKE '%TEMP%'
and a.tablespace_name NOT LIKE '%UNDO%'
) t4
where t4.tablespace_name = t3.tablespace_name(+)
and t4.tablespace_name = t6.tablespace_name(+)
--and ((100-decode(round(t6.size_could_be_used*100/t3.alloc_size_mb,2),null,0,round(t6.size_could_be_used*100/t3.alloc_size_mb,2)))/100*t3.alloc_size_mb)/avg_growth_per_day_mb =30
and ((100-decode(round(t6.size_could_be_used*100/t3.alloc_size_mb,2),null,0,round(t6.size_could_be_used*100/t3.alloc_size_mb,2)))/100*t3.alloc_size_mb)/avg_growth_per_day_mb=0
order by 1;
2.?通過線性回歸參數(shù)預(yù)測未來使用量(待補(bǔ)充):
先預(yù)估數(shù)據(jù)量,然后用數(shù)據(jù)量乘上總字段長度,可以大致預(yù)估出表大小
通常對于小表,Oracle建議通過全表掃描進(jìn)行數(shù)據(jù)訪問,對于大表則應(yīng)該通過索引以
Oracle通過一個內(nèi)部參數(shù)_small_table_threshold來定義大表和小表的界限。
電腦電壓是怎么回事~!
自考中有拉長線的說法,什么是拉長線?
我們之前有遇到過這樣的情況,是采用分表來處理的,有一個實(shí)時表,僅存放本月數(shù)據(jù)(實(shí)時增加的),歷史數(shù)據(jù)按月分表存儲(每個表數(shù)據(jù)量大概是一百萬到400萬),分表命名根據(jù)時間設(shè)定一定規(guī)則(目的是為了能動態(tài)查詢)
分享題目:oracle大表怎么評估,oracle查大表
文章位置:http://aaarwkj.com/article48/dsigdep.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供面包屑導(dǎo)航、自適應(yīng)網(wǎng)站、做網(wǎng)站、網(wǎng)站設(shè)計、App開發(fā)、商城網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)