LOAD httpfs 对DuckDB加密的性能影响

DuckDB 1.4.0发版说明中提到

To encrypt data, DuckDB can use either the built-in mbedtls library or the OpenSSL library from the httpfs extension. Note that the OpenSSL versions are much faster due to hardware acceleration, so make sure to LOAD httpfs for good encryption performance.

同样的加密脚本,

load tpch;
call dbgen(sf=1);
ATTACH 'ENC_NO' as ENC_NO; 
use enc_no;
call dbgen(sf=1);
ATTACH 'ENC_GCM' as ENC_GCM (ENCRYPTION_KEY 'asdf', ENCRYPTION_CIPHER 'GCM'); 
use enc_gcm;
call dbgen(sf=1);
ATTACH 'ENC_CTR' as ENC_CTR (ENCRYPTION_KEY 'asdf', ENCRYPTION_CIPHER 'CTR');
use enc_ctr;
call dbgen(sf=1);

在Windows和Linux分别不load和load httpfs测试。
Windows 11

C:\d>duckdb140
DuckDB v1.4.0 (Andium) b8a06e4a22
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
D .read ENCRY.txt
100% ▕██████████████████████████████████████▏ (00:00:02.43 elapsed)

100% ▕██████████████████████████████████████▏ (00:00:08.71 elapsed)

100% ▕██████████████████████████████████████▏ (00:00:10.95 elapsed)

100% ▕██████████████████████████████████████▏ (00:00:08.73 elapsed)

注意需要退出后重新运行duckdb,否则会报IO Error:Cannot open file "ENC_NO": Permission denied错误。

C:\d>duckdb140
DuckDB v1.4.0 (Andium) b8a06e4a22
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
D load httpfs;
D .read ENCRY.txt
100% ▕██████████████████████████████████████▏ (00:00:02.30 elapsed)

100% ▕██████████████████████████████████████▏ (00:00:08.10 elapsed)

100% ▕██████████████████████████████████████▏ (00:00:07.59 elapsed)

100% ▕██████████████████████████████████████▏ (00:00:07.64 elapsed)

D .exit

Linux

DuckDB v1.4.0 (Andium) b8a06e4a22
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
D .read /par/ENCRY.txt
100% ▕██████████████████████████████████████▏ (00:00:03.45 elapsed)

100% ▕██████████████████████████████████████▏ (00:00:08.71 elapsed)

100% ▕██████████████████████████████████████▏ (00:00:09.50 elapsed)

100% ▕██████████████████████████████████████▏ (00:00:08.66 elapsed)

D .exit
root@DESKTOP-59T6U68:/par# ./duckdb140
DuckDB v1.4.0 (Andium) b8a06e4a22
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
D install httpfs;
100% ▕██████████████████████████████████████▏ (00:00:15.77 elapsed)
D .read /par/ENCRY.txt
100% ▕██████████████████████████████████████▏ (00:00:02.85 elapsed)

100% ▕██████████████████████████████████████▏ (00:00:07.76 elapsed)

100% ▕██████████████████████████████████████▏ (00:00:09.09 elapsed)

100% ▕██████████████████████████████████████▏ (00:00:08.55 elapsed)

可见LOAD httpfs 确实提高了DuckDB加密的性能,从零点几秒到1秒不等。Windows没有wsl的IO速度慢的影响,区别更明显。

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值