filter条件の処理時間影響

 

filter条件数30、1000万件の場合

MySQL          12 --> 30秒
Oracle           0.2 --> 18秒
PostgreSQL   0.8 --> 14秒
SQL Server    22 --> 22秒


(8.0.29)

 

drop table tab1;

create table tab1(
    col1 int primary key
   ,col2 int
   ,col3 int
   ,col4 int
   ,col5 int
   ,col6 int
   ,col7 int
   ,col8 int
   ,col9 int
   ,col10 int
   ,col11 varchar(30)
   ,col12 varchar(30)
   ,col13 varchar(30)
   ,col14 varchar(30)
   ,col15 varchar(30)
   ,col16 varchar(30)
   ,col17 varchar(30)
   ,col18 varchar(30)
   ,col19 varchar(30)
   ,col20 varchar(30)
   ,col21 datetime
   ,col22 datetime
   ,col23 datetime
   ,col24 datetime
   ,col25 datetime
   ,col26 datetime
   ,col27 datetime
   ,col28 datetime
   ,col29 datetime
   ,col30 datetime
   );

drop procedure proc1;

delimiter //
create procedure proc1(in x int)
begin
  declare i int;
  set i = 0;
  start transaction;
  while i < x do
    set i = i + 1;
    insert into tab1 values(
     i
    ,floor(rand() * 10000000)+1
    ,floor(rand() * 10000000)+1
    ,floor(rand() * 10000000)+1
    ,floor(rand() * 10000000)+1
    ,floor(rand() * 10000000)+1
    ,floor(rand() * 10000000)+1
    ,floor(rand() * 10000000)+1
    ,floor(rand() * 10000000)+1
    ,floor(rand() * 10000000)+1
    ,substring(md5(rand() ), 1, 30)
    ,substring(md5(rand() ), 1, 30)
    ,substring(md5(rand() ), 1, 30)
    ,substring(md5(rand() ), 1, 30)
    ,substring(md5(rand() ), 1, 30)
    ,substring(md5(rand() ), 1, 30)
    ,substring(md5(rand() ), 1, 30)
    ,substring(md5(rand() ), 1, 30)
    ,substring(md5(rand() ), 1, 30)
    ,substring(md5(rand() ), 1, 30)
    ,date_add('2001-01-01', interval floor(365*30*24*3600 * rand() ) second)
    ,date_add('2001-01-01', interval floor(365*30*24*3600 * rand() ) second)
    ,date_add('2001-01-01', interval floor(365*30*24*3600 * rand() ) second)
    ,date_add('2001-01-01', interval floor(365*30*24*3600 * rand() ) second)
    ,date_add('2001-01-01', interval floor(365*30*24*3600 * rand() ) second)
    ,date_add('2001-01-01', interval floor(365*30*24*3600 * rand() ) second)
    ,date_add('2001-01-01', interval floor(365*30*24*3600 * rand() ) second)
    ,date_add('2001-01-01', interval floor(365*30*24*3600 * rand() ) second)
    ,date_add('2001-01-01', interval floor(365*30*24*3600 * rand() ) second)
    ,date_add('2001-01-01', interval floor(365*30*24*3600 * rand() ) second)
    );
  end while;
  commit;
end
//
delimiter ;

call proc1(10000000);

select count(*) from tab1;

→ (12.17 sec)

select count(*) from tab1
where col1 != 1
or col2 != 1
or col3 != 1
or col4 != 1
or col5 != 1
or col6 != 1
or col7 != 1
or col8 != 1
or col9 != 1
or col10 != 1
or col11 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
or col12 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
or col13 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
or col14 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
or col15 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
or col16 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
or col17 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
or col18 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
or col19 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
or col20 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
or col21 != cast('2001-01-01 00:00:00' as datetime)
or col22 != cast('2001-01-01 00:00:00' as datetime)
or col23 != cast('2001-01-01 00:00:00' as datetime)
or col24 != cast('2001-01-01 00:00:00' as datetime)
or col25 != cast('2001-01-01 00:00:00' as datetime)
or col26 != cast('2001-01-01 00:00:00' as datetime)
or col27 != cast('2001-01-01 00:00:00' as datetime)
or col28 != cast('2001-01-01 00:00:00' as datetime)
or col29 != cast('2001-01-01 00:00:00' as datetime)
or col30 != cast('2001-01-01 00:00:00' as datetime)
;


→ (18.43 sec)

select count(*) from tab1
where col1 != 1
and col2 != 1
and col3 != 1
and col4 != 1
and col5 != 1
and col6 != 1
and col7 != 1
and col8 != 1
and col9 != 1
and col10 != 1
and col11 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
and col12 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
and col13 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
and col14 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
and col15 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
and col16 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
and col17 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
and col18 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
and col19 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
and col20 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
and col21 != cast('2001-01-01 00:00:00' as datetime)
and col22 != cast('2001-01-01 00:00:00' as datetime)
and col23 != cast('2001-01-01 00:00:00' as datetime)
and col24 != cast('2001-01-01 00:00:00' as datetime)
and col25 != cast('2001-01-01 00:00:00' as datetime)
and col26 != cast('2001-01-01 00:00:00' as datetime)
and col27 != cast('2001-01-01 00:00:00' as datetime)
and col28 != cast('2001-01-01 00:00:00' as datetime)
and col29 != cast('2001-01-01 00:00:00' as datetime)
and col30 != cast('2001-01-01 00:00:00' as datetime)
;

→ (30.18 sec)

(19c)

 

drop table tab1 purge;
create table tab1(
    col1 int primary key
   ,col2 int
   ,col3 int
   ,col4 int
   ,col5 int
   ,col6 int
   ,col7 int
   ,col8 int
   ,col9 int
   ,col10 int
   ,col11 varchar2(30)
   ,col12 varchar2(30)
   ,col13 varchar2(30)
   ,col14 varchar2(30)
   ,col15 varchar2(30)
   ,col16 varchar2(30)
   ,col17 varchar2(30)
   ,col18 varchar2(30)
   ,col19 varchar2(30)
   ,col20 varchar2(30)
   ,col21 timestamp
   ,col22 timestamp
   ,col23 timestamp
   ,col24 timestamp
   ,col25 timestamp
   ,col26 timestamp
   ,col27 timestamp
   ,col28 timestamp
   ,col29 timestamp
   ,col30 timestamp
   );

declare
begin
for i in 1..10000000 loop
  insert into tab1 values
  (i
  ,floor(dbms_random.value(1, 10000001) )
  ,floor(dbms_random.value(1, 10000001) )
  ,floor(dbms_random.value(1, 10000001) )
  ,floor(dbms_random.value(1, 10000001) )
  ,floor(dbms_random.value(1, 10000001) )
  ,floor(dbms_random.value(1, 10000001) )
  ,floor(dbms_random.value(1, 10000001) )
  ,floor(dbms_random.value(1, 10000001) )
  ,floor(dbms_random.value(1, 10000001) )
  ,substr(standard_hash(dbms_random.value(), 'MD5'),1,30)
  ,substr(standard_hash(dbms_random.value(), 'MD5'),1,30)
  ,substr(standard_hash(dbms_random.value(), 'MD5'),1,30)
  ,substr(standard_hash(dbms_random.value(), 'MD5'),1,30)
  ,substr(standard_hash(dbms_random.value(), 'MD5'),1,30)
  ,substr(standard_hash(dbms_random.value(), 'MD5'),1,30)
  ,substr(standard_hash(dbms_random.value(), 'MD5'),1,30)
  ,substr(standard_hash(dbms_random.value(), 'MD5'),1,30)
  ,substr(standard_hash(dbms_random.value(), 'MD5'),1,30)
  ,substr(standard_hash(dbms_random.value(), 'MD5'),1,30)
  ,to_date('20010101','yyyymmdd') + floor(dbms_random.value(0, 365*30*24*3600) )/24/3600
  ,to_date('20010101','yyyymmdd') + floor(dbms_random.value(0, 365*30*24*3600) )/24/3600
  ,to_date('20010101','yyyymmdd') + floor(dbms_random.value(0, 365*30*24*3600) )/24/3600
  ,to_date('20010101','yyyymmdd') + floor(dbms_random.value(0, 365*30*24*3600) )/24/3600
  ,to_date('20010101','yyyymmdd') + floor(dbms_random.value(0, 365*30*24*3600) )/24/3600
  ,to_date('20010101','yyyymmdd') + floor(dbms_random.value(0, 365*30*24*3600) )/24/3600
  ,to_date('20010101','yyyymmdd') + floor(dbms_random.value(0, 365*30*24*3600) )/24/3600
  ,to_date('20010101','yyyymmdd') + floor(dbms_random.value(0, 365*30*24*3600) )/24/3600
  ,to_date('20010101','yyyymmdd') + floor(dbms_random.value(0, 365*30*24*3600) )/24/3600
  ,to_date('20010101','yyyymmdd') + floor(dbms_random.value(0, 365*30*24*3600) )/24/3600
  );
end loop;
end;
/


commit;

set time on
set timing on


select count(*) from tab1;

→ 経過: 00:00:00.20

select count(*) from tab1
where col1 != 1
or col2 != 1
or col3 != 1
or col4 != 1
or col5 != 1
or col6 != 1
or col7 != 1
or col8 != 1
or col9 != 1
or col10 != 1
or col11 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
or col12 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
or col13 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
or col14 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
or col15 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
or col16 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
or col17 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
or col18 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
or col19 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
or col20 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
or col21 != to_date('2022/09/05 00:00:00','YYYY/MM/DD HH24:MI:SS')
or col22 != to_date('2022/09/05 00:00:00','YYYY/MM/DD HH24:MI:SS')
or col23 != to_date('2022/09/05 00:00:00','YYYY/MM/DD HH24:MI:SS')
or col24 != to_date('2022/09/05 00:00:00','YYYY/MM/DD HH24:MI:SS')
or col25 != to_date('2022/09/05 00:00:00','YYYY/MM/DD HH24:MI:SS')
or col26 != to_date('2022/09/05 00:00:00','YYYY/MM/DD HH24:MI:SS')
or col27 != to_date('2022/09/05 00:00:00','YYYY/MM/DD HH24:MI:SS')
or col28 != to_date('2022/09/05 00:00:00','YYYY/MM/DD HH24:MI:SS')
or col29 != to_date('2022/09/05 00:00:00','YYYY/MM/DD HH24:MI:SS')
or col30 != to_date('2022/09/05 00:00:00','YYYY/MM/DD HH24:MI:SS')
;


→ 経過: 00:00:17.96


select count(*) from tab1
where col1 != 1
and col2 != 1
and col3 != 1
and col4 != 1
and col5 != 1
and col6 != 1
and col7 != 1
and col8 != 1
and col9 != 1
and col10 != 1
and col11 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
and col12 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
and col13 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
and col14 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
and col15 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
and col16 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
and col17 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
and col18 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
and col19 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
and col20 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
and col21 != to_date('2022/09/05 00:00:00','YYYY/MM/DD HH24:MI:SS')
and col22 != to_date('2022/09/05 00:00:00','YYYY/MM/DD HH24:MI:SS')
and col23 != to_date('2022/09/05 00:00:00','YYYY/MM/DD HH24:MI:SS')
and col24 != to_date('2022/09/05 00:00:00','YYYY/MM/DD HH24:MI:SS')
and col25 != to_date('2022/09/05 00:00:00','YYYY/MM/DD HH24:MI:SS')
and col26 != to_date('2022/09/05 00:00:00','YYYY/MM/DD HH24:MI:SS')
and col27 != to_date('2022/09/05 00:00:00','YYYY/MM/DD HH24:MI:SS')
and col28 != to_date('2022/09/05 00:00:00','YYYY/MM/DD HH24:MI:SS')
and col29 != to_date('2022/09/05 00:00:00','YYYY/MM/DD HH24:MI:SS')
and col30 != to_date('2022/09/05 00:00:00','YYYY/MM/DD HH24:MI:SS')
;

→ 経過: 00:00:18.19

 


(14)

 

drop table tab1;

create table tab1(
    col1 int primary key
   ,col2 int
   ,col3 int
   ,col4 int
   ,col5 int
   ,col6 int
   ,col7 int
   ,col8 int
   ,col9 int
   ,col10 int
   ,col11 varchar(30)
   ,col12 varchar(30)
   ,col13 varchar(30)
   ,col14 varchar(30)
   ,col15 varchar(30)
   ,col16 varchar(30)
   ,col17 varchar(30)
   ,col18 varchar(30)
   ,col19 varchar(30)
   ,col20 varchar(30)
   ,col21 timestamp
   ,col22 timestamp
   ,col23 timestamp
   ,col24 timestamp
   ,col25 timestamp
   ,col26 timestamp
   ,col27 timestamp
   ,col28 timestamp
   ,col29 timestamp
   ,col30 timestamp
   );

start transaction;
insert into tab1 select
   g
  ,floor(random() * 10000000)+1
  ,floor(random() * 10000000)+1
  ,floor(random() * 10000000)+1
  ,floor(random() * 10000000)+1
  ,floor(random() * 10000000)+1
  ,floor(random() * 10000000)+1
  ,floor(random() * 10000000)+1
  ,floor(random() * 10000000)+1
  ,floor(random() * 10000000)+1
  ,substring(md5(random()::text), 1, 30)
  ,substring(md5(random()::text), 1, 30)
  ,substring(md5(random()::text), 1, 30)
  ,substring(md5(random()::text), 1, 30)
  ,substring(md5(random()::text), 1, 30)
  ,substring(md5(random()::text), 1, 30)
  ,substring(md5(random()::text), 1, 30)
  ,substring(md5(random()::text), 1, 30)
  ,substring(md5(random()::text), 1, 30)
  ,substring(md5(random()::text), 1, 30)
  ,'2001-01-01'::date + CAST( floor(365*30*24*3600*random() ) || 'second' AS interval)
  ,'2001-01-01'::date + CAST( floor(365*30*24*3600*random() ) || 'second' AS interval)
  ,'2001-01-01'::date + CAST( floor(365*30*24*3600*random() ) || 'second' AS interval)
  ,'2001-01-01'::date + CAST( floor(365*30*24*3600*random() ) || 'second' AS interval)
  ,'2001-01-01'::date + CAST( floor(365*30*24*3600*random() ) || 'second' AS interval)
  ,'2001-01-01'::date + CAST( floor(365*30*24*3600*random() ) || 'second' AS interval)
  ,'2001-01-01'::date + CAST( floor(365*30*24*3600*random() ) || 'second' AS interval)
  ,'2001-01-01'::date + CAST( floor(365*30*24*3600*random() ) || 'second' AS interval)
  ,'2001-01-01'::date + CAST( floor(365*30*24*3600*random() ) || 'second' AS interval)
  ,'2001-01-01'::date + CAST( floor(365*30*24*3600*random() ) || 'second' AS interval)
from generate_series(1,10000000) g;

commit;

\timing 1

select count(*) from tab1;

→ 時間: 787.234 ミリ秒

select count(*) from tab1
where col1 != 1
or col2 != 1
or col3 != 1
or col4 != 1
or col5 != 1
or col6 != 1
or col7 != 1
or col8 != 1
or col9 != 1
or col10 != 1
or col11 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
or col12 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
or col13 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
or col14 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
or col15 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
or col16 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
or col17 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
or col18 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
or col19 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
or col20 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
or col21 != '2001-01-01 00:00:00'::timestamp
or col22 != '2001-01-01 00:00:00'::timestamp
or col23 != '2001-01-01 00:00:00'::timestamp
or col24 != '2001-01-01 00:00:00'::timestamp
or col25 != '2001-01-01 00:00:00'::timestamp
or col26 != '2001-01-01 00:00:00'::timestamp
or col27 != '2001-01-01 00:00:00'::timestamp
or col28 != '2001-01-01 00:00:00'::timestamp
or col29 != '2001-01-01 00:00:00'::timestamp
or col30 != '2001-01-01 00:00:00'::timestamp
;

→ 時間: 13097.392 ミリ秒(00:13.097)

select count(*) from tab1
where col1 != 1
and col2 != 1
and col3 != 1
and col4 != 1
and col5 != 1
and col6 != 1
and col7 != 1
and col8 != 1
and col9 != 1
and col10 != 1
and col11 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
and col12 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
and col13 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
and col14 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
and col15 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
and col16 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
and col17 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
and col18 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
and col19 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
and col20 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
and col21 != '2001-01-01 00:00:00'::timestamp
and col22 != '2001-01-01 00:00:00'::timestamp
and col23 != '2001-01-01 00:00:00'::timestamp
and col24 != '2001-01-01 00:00:00'::timestamp
and col25 != '2001-01-01 00:00:00'::timestamp
and col26 != '2001-01-01 00:00:00'::timestamp
and col27 != '2001-01-01 00:00:00'::timestamp
and col28 != '2001-01-01 00:00:00'::timestamp
and col29 != '2001-01-01 00:00:00'::timestamp
and col30 != '2001-01-01 00:00:00'::timestamp
;


→ 時間: 14320.879 ミリ秒(00:14.321)

(2019)

 

drop table tab1;

create table tab1(
    col1 int primary key
   ,col2 int
   ,col3 int
   ,col4 int
   ,col5 int
   ,col6 int
   ,col7 int
   ,col8 int
   ,col9 int
   ,col10 int
   ,col11 nvarchar(30)
   ,col12 nvarchar(30)
   ,col13 nvarchar(30)
   ,col14 nvarchar(30)
   ,col15 nvarchar(30)
   ,col16 nvarchar(30)
   ,col17 nvarchar(30)
   ,col18 nvarchar(30)
   ,col19 nvarchar(30)
   ,col20 nvarchar(30)
   ,col21 datetime2
   ,col22 datetime2
   ,col23 datetime2
   ,col24 datetime2
   ,col25 datetime2
   ,col26 datetime2
   ,col27 datetime2
   ,col28 datetime2
   ,col29 datetime2
   ,col30 datetime2
   );

set nocount on
declare @i int;
set @i = 1;
begin transaction;
while @i <= 10000000
begin
  insert into tab1 values(
     @i
    ,floor(rand() * 10000000)+1
    ,floor(rand() * 10000000)+1
    ,floor(rand() * 10000000)+1
    ,floor(rand() * 10000000)+1
    ,floor(rand() * 10000000)+1
    ,floor(rand() * 10000000)+1
    ,floor(rand() * 10000000)+1
    ,floor(rand() * 10000000)+1
    ,floor(rand() * 10000000)+1
    ,substring(replace(NEWID(),'-',''),1,30)
    ,substring(replace(NEWID(),'-',''),1,30)
    ,substring(replace(NEWID(),'-',''),1,30)
    ,substring(replace(NEWID(),'-',''),1,30)
    ,substring(replace(NEWID(),'-',''),1,30)
    ,substring(replace(NEWID(),'-',''),1,30)
    ,substring(replace(NEWID(),'-',''),1,30)
    ,substring(replace(NEWID(),'-',''),1,30)
    ,substring(replace(NEWID(),'-',''),1,30)
    ,substring(replace(NEWID(),'-',''),1,30)
    ,dateadd(second,floor(365*30*24*3600 * rand() ),'2001-01-01')
    ,dateadd(second,floor(365*30*24*3600 * rand() ),'2001-01-01')
    ,dateadd(second,floor(365*30*24*3600 * rand() ),'2001-01-01')
    ,dateadd(second,floor(365*30*24*3600 * rand() ),'2001-01-01')
    ,dateadd(second,floor(365*30*24*3600 * rand() ),'2001-01-01')
    ,dateadd(second,floor(365*30*24*3600 * rand() ),'2001-01-01')
    ,dateadd(second,floor(365*30*24*3600 * rand() ),'2001-01-01')
    ,dateadd(second,floor(365*30*24*3600 * rand() ),'2001-01-01')
    ,dateadd(second,floor(365*30*24*3600 * rand() ),'2001-01-01')
    ,dateadd(second,floor(365*30*24*3600 * rand() ),'2001-01-01')
    );
  set @i = @i + 1;
end
commit;

 

set statistics time on;

select count(*) from tab1;

→ CPU 時間 = 2656 ミリ秒、経過時間 = 22025 ミリ秒。


select count(*) from tab1
where col1 != 1
or col2 != 1
or col3 != 1
or col4 != 1
or col5 != 1
or col6 != 1
or col7 != 1
or col8 != 1
or col9 != 1
or col10 != 1
or col11 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
or col12 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
or col13 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
or col14 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
or col15 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
or col16 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
or col17 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
or col18 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
or col19 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
or col20 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
or col21 != cast('2001-01-01 00:00:00' as datetime2)
or col22 != cast('2001-01-01 00:00:00' as datetime2)
or col23 != cast('2001-01-01 00:00:00' as datetime2)
or col24 != cast('2001-01-01 00:00:00' as datetime2)
or col25 != cast('2001-01-01 00:00:00' as datetime2)
or col26 != cast('2001-01-01 00:00:00' as datetime2)
or col27 != cast('2001-01-01 00:00:00' as datetime2)
or col28 != cast('2001-01-01 00:00:00' as datetime2)
or col29 != cast('2001-01-01 00:00:00' as datetime2)
or col30 != cast('2001-01-01 00:00:00' as datetime2)
;


→ CPU 時間 = 8860 ミリ秒、経過時間 = 22561 ミリ秒。

select count(*) from tab1
where col1 != 1
and col2 != 1
and col3 != 1
and col4 != 1
and col5 != 1
and col6 != 1
and col7 != 1
and col8 != 1
and col9 != 1
and col10 != 1
and col11 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
and col12 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
and col13 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
and col14 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
and col15 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
and col16 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
and col17 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
and col18 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
and col19 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
and col20 != 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
and col21 != cast('2001-01-01 00:00:00' as datetime2)
and col22 != cast('2001-01-01 00:00:00' as datetime2)
and col23 != cast('2001-01-01 00:00:00' as datetime2)
and col24 != cast('2001-01-01 00:00:00' as datetime2)
and col25 != cast('2001-01-01 00:00:00' as datetime2)
and col26 != cast('2001-01-01 00:00:00' as datetime2)
and col27 != cast('2001-01-01 00:00:00' as datetime2)
and col28 != cast('2001-01-01 00:00:00' as datetime2)
and col29 != cast('2001-01-01 00:00:00' as datetime2)
and col30 != cast('2001-01-01 00:00:00' as datetime2)
;

→ CPU 時間 = 9875 ミリ秒、経過時間 = 22511 ミリ秒。