偷偷摘套内射激情视频,久久精品99国产国产精,中文字幕无线乱码人妻,中文在线中文a,性爽19p

SQL Server數據庫測試索引的空間換時間

數據庫 SQL Server
本文我們主要介紹了SQL Server數據庫測試索引的空間換時間的操作,并給出了詳細的實例代碼,希望能夠對您有所幫助。

SQL Server數據庫中,我們經常使用索引來提高查詢的效率,但是如果索引使用不當就會適得其反。本文我們介紹一種測試索引空間換時間的操作,以方便找到適合利用索引的時機,接下來就讓我們一起來了解一下這部分內容吧。

  1. create table tb_test(  
  2.        t_id number,  
  3.        t_name nvarchar2(30)  
  4. );  
  5. create sequence seq_tid  
  6. start with 1  
  7. increment by 1  
  8. maxvalue 999999  
  9. minvalue 1  
  10. cache 10 

--項該表中插入99999條記錄

  1. begin  
  2.        for n in 1..99999 loop  
  3.            insert into tb_test values(seq_tid.nextval,'1234');  
  4.        end loop;  
  5. end;  
  6. --select count(*) from tb_test;  
  7. --select * from tb_test;  
  8. --select * from tb_test where t_id = 99999

--此處以下為測試代碼,分別在創(chuàng)建索引和沒有創(chuàng)建索引的情況下運行。
--你會發(fā)現創(chuàng)建索引后后運行的時間比沒有創(chuàng)建索引所需要的時間少很多。

  1. declare  
  2. num number;  
  3. begin  
  4.      for n in 1..9999 loop  
  5.          select t_id into num  from tb_test where t_id=n;  
  6.      end loop;  
  7.      dbms_output.put_line('nunm='||num);  
  8. end; 

--創(chuàng)建對應的索引suncs_space 為自己創(chuàng)建的一個表空間。

  1. create index testid on tb_test(t_id) tablespace suncs_space; 

--刪除索引

  1. drop index testid; 

關于SQL Server數據庫測試索引的空間換時間的操作就介紹到這里了,希望本次的介紹能夠對您有所幫助。

【編輯推薦】

  1. Oracle數據庫rman環(huán)境配置詳解
  2. Oracle數據庫不能使用索引的原因定位
  3. Oracle數據庫rman常用命令的使用示例
  4. Oracle性能分析工具statpack安裝使用詳解
  5. 如何查看和修改Oracle數據庫服務器端的字符集
責任編輯:趙鵬 來源: CSDN博客
相關推薦

2011-04-18 11:27:49

空間時間數據庫設計

2010-07-21 10:27:49

SQL Server

2010-07-21 10:05:29

SQL Server排

2010-05-10 18:54:12

Oracle數據庫索引

2010-07-01 14:18:09

SQL Server數

2010-07-09 11:28:12

SQL Server數

2010-07-15 17:28:50

SQL Server

2009-04-10 09:22:48

SQL Server并發(fā)測試

2025-01-10 11:42:13

2010-07-07 10:31:43

SQL Server數

2010-07-08 11:05:14

SQL Server數

2011-03-24 09:07:11

SQL Server數備份

2011-03-24 09:24:08

SQL Server數還原

2011-03-24 09:45:34

SQL Server數恢復

2021-05-08 14:07:26

SQLServer數據庫

2011-08-01 09:50:31

SQL Server數主鍵索引

2021-05-17 06:57:34

SQLServer數據庫

2011-04-02 13:21:34

SQL Server數據庫全文索引

2011-07-18 15:59:17

MySQL數據庫

2010-07-09 12:30:14

Sql Server數
點贊
收藏

51CTO技術棧公眾號