2015-01-23 3 views

답변

2
[email protected] testdb=# create table foo (col varchar(255) not null);  
CREATE TABLE                 
Temps : 8,425 ms                
[email protected] testdb=# insert into foo (col) values ('bar');    
INSERT 0 1                 
Temps : 2,286 ms                
[email protected] testdb=# select * from foo;        
col                   
-----                   
bar                   
(1 ligne)                  


Temps : 0,934 ms                
[email protected] testdb=# select * from foo where not(col ~~ 'some text'); 
col                   
-----                   
bar                   
(1 ligne)                  

[email protected] testdb=# explain select * from foo where not(col ~~ 'some text'); 
         QUERY PLAN              
--------------------------------------------------------        
Seq Scan on foo (cost=0.00..11.75 rows=139 width=516)        
    Filter: ((col)::text !~~ 'some text'::text)          
(2 lignes)                   


Temps : 3,011 ms                  
[email protected] testdb=# explain select * from foo where col !~~ 'some text';  
         QUERY PLAN              
--------------------------------------------------------        
Seq Scan on foo (cost=0.00..11.75 rows=139 width=516)        
    Filter: ((col)::text !~~ 'some text'::text)          
(2 lignes)                   

완전히 동일합니다.