关于数据库postgresql, delete 与 insert,create 的性能比较

关于数字索引与字符索引的性能比较
44w数据 固态硬盘:数字索引288ms,字符索 varchar(300)引 2 s 99 ms

 

hhy_event_fuse.public> create index tmp23_event_time_index
                           on tmp23 (event_time)
[2023-01-13 14:09:01] completed in 288 ms
hhy_event_fuse.public> create index tmp23format_index
                           on tmp23 (time_format)
[2023-01-13 14:09:04] completed in 2 s 99 ms


关于 delete 与 insert,create 的性能比较
create -->1 s 571 ms
insert -->6 s 308 ms
delete -->517 ms
所以在数据量不是很大,或者保留比不是很大(3kw保留50w)的情况下 该delete还是delete吧

hhy_event_fuse.public> create table tmp24 as select * from  ods_traffic_event_info  where time_format <'2023-01-03 00:00:00'
[2023-01-13 14:15:09] 444,269 rows affected in 1 s 571 ms

hhy_event_fuse.public> insert into tmp23 select * from ods_traffic_event_info where time_format <'2023-01-03 00:00:00'
[2023-01-13 14:11:17] 444,269 rows affected in 6 s 308 ms

hhy_event_fuse.public> delete  from tmp23 where time_format <'2023-01-03 00:00:00'
[2023-01-13 14:10:37] 444,269 rows affected in 517 ms

你可能感兴趣的:(数据库,数据库,sql,postgresql)