14.2.5.6 Adaptive Hash Indexes 自适应Hash Indexes

自适应Hash索引(AHI)为InnoDB提供内存数据库般的查询性能,通过监控索引搜索并自动创建Hash索引来加速查询。该功能可根据实际工作负载启用或禁用。
14.2.5.6 Adaptive Hash Indexes 自适应Hash Indexes


adaptive hash index(AHI) 让InnoDB 执行更加像在一个内存数据库里在,

在不牺牲任何事务功能或者可靠性。


这个功能是启动通过innodb_adaptive_hash_index option,或者关闭通过--skip-innodb_adaptive_hash_index  在服务器启动的

时候。

基于
观察到的模式搜索,MySQL 建立一个Hash index 使用一个index key的前缀。



key的前缀可以是任何长度,它可以是只有一些值在B-tree 出现在hash index,Hash indexes 是建立在

那些索引的pages 经常被访问的。



如果一个表填满整个在内存里,一个hash index 可以加速查询通过启用任何元素的直接查询,


把index 值变成一种指针。InnoDB 有一个机制来监控索引搜索,如果InnoDB 注意到查询可以从创建一个hash index 收益,

它会自动这么做。


一些工作负载,hash index 查找加速远远超过额外的工作来监控index 查找和维护hash index 结构。


有时候,read/write 锁 守护访问自适应索引可以变成一个竞争的源头 在负载比较大的情况下,

比如 多个并发连接。查询像 LIKE 操作和% 通配符也不倾向于从AHI 收益。


对于负载 自适应hash index是不需要的,关掉它降低不需要的性能负载。

因为它是很难预测的,这个功能是否适合一个特定的系统。

考虑到 运行基准 既启用和关闭 使用一个现实的工作负载。


默认启用

mysql> show variables like '%innodb_adaptive_hash_index%';
+----------------------------+-------+
| Variable_name              | Value |
+----------------------------+-------+
| innodb_adaptive_hash_index | ON    |
+----------------------------+-------+
1 row in set (0.00 sec)


hash index 总是基于现在存在的B-tree 索引创建,
InnoDB 可以创建一个hash index 在一个B-tree索引定义的任何长度的前缀。


根据搜索的模式,InnoDB 观察B-tree 索引,一个hash index 可以是部分的,只覆盖索引经常访问的pages.

转载于:https://www.cnblogs.com/zhaoyangjian724/p/6199889.html

PowerShell 7 环境已加载 (版本: 7.5.2) PS C:\Users\Administrator\Desktop> cd E:\PyTorch_Build\pytorch PS E:\PyTorch_Build\pytorch> python -m venv rtx5070_env PS E:\PyTorch_Build\pytorch> .\rtx5070_env\Scripts\activate (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 确保当前在 pytorch 源码目录 (rtx5070_env) PS E:\PyTorch_Build\pytorch> cd E:\PyTorch_Build\pytorch (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 删除构建目录(如果存在) (rtx5070_env) PS E:\PyTorch_Build\pytorch> Remove-Item -Recurse -Force build -ErrorAction SilentlyContinue (rtx5070_env) PS E:\PyTorch_Build\pytorch> Remove-Item -Recurse -Force .cmake_build -ErrorAction SilentlyContinue (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 删除可能的临时文件 (rtx5070_env) PS E:\PyTorch_Build\pytorch> Remove-Item -Recurse -Force *.egg-info -ErrorAction SilentlyContinue (rtx5070_env) PS E:\PyTorch_Build\pytorch> Remove-Item -Recurse -Force dist -ErrorAction SilentlyContinue (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 谨慎操作!以下命令会删除所有未跟踪的源码文件(除了您自己的修改)。 (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 如果您在源码中有任何重要更改,请先备份。 (rtx5070_env) PS E:\PyTorch_Build\pytorch> git clean -xdf Removing CMakeFiles/ Removing CTestTestfile.cmake Removing Repair-Libuv.ps1 Removing __pycache__/ Removing adaptive_builder.ps1 Removing analyze_cudnn.ps1 Removing architecture_patch.py Removing aten/src/ATen/Config.h Removing aten/src/ATen/cuda/CUDAConfig.h Removing build.log Removing build_20250902_220733.log Removing build_20250902_230239.log Removing build_20250902_230532.log Removing build_20250902_230545.log Removing build_20250902_230555.log Removing build_20250902_230603.log Removing build_custom.ps1 Removing build_enhanced.ps1 Removing build_error.log Removing build_fixed.ps1 Removing build_fixed_v2.ps1 Removing build_log.txt Removing build_openblas_from_source.ps1 Removing build_openblas_no_asm.ps1 Removing build_optimized.ps1 Removing build_optimized_v10.ps1 Removing build_optimized_v11.ps1 Removing build_optimized_v2.ps1 Removing build_optimized_v3.ps1 Removing build_optimized_v4.ps1 Removing build_optimized_v5.ps1 Removing build_optimized_v6.ps1 Removing build_optimized_v8.ps1 Removing build_out/ Removing build_pytorch_cuda.ps1 Removing build_safe_v1.ps1 Removing build_simple.ps1 Removing clean_and_setup.ps1 Removing cmake/Cuda.cmake Removing cmake/Modules/FindLibuv.cmake Removing cmake/Modules/win_toolchain.cmake Removing cmake_config.ps1 Removing cmake_install.cmake Removing compile_cuda_test.ps1 Removing compile_cudnn912.ps1 Removing compile_win.ps1 Removing compile_win_fixed.ps1 Removing complete_install_fix.ps1 Removing configure_cudnn.ps1 Removing create_missing_cmake.ps1 Removing cuda_test.cpp Removing cuda_test.cu Removing cuda_test.exe Removing cuda_test.py Removing cudnn_compat.patch Removing cudnn_path_mapper.py Removing dependency_resolver.py Removing diagnose.py Removing diagnose_fixed.py Removing diagnose_fixed_v3.py Removing diagnose_fixed_v4.py Removing diagnose_fixed_v5.py Removing diagnose_fixed_v6.py Removing diagnose_fixed_v8.py Removing diagnostic_test.py Removing download_enhanced.ps1 Removing enhanced_diagnostic.py Removing enhanced_file_search.ps1 Removing enhanced_test.py Removing env_diagnostic.ps1 Removing environment_blueprint.psd1 Removing fallback_to_cpu.py Removing fbgemm_fix.patch Removing find_cuda_path(v2).ps1 Removing find_cuda_path.ps1 Removing find_cudnn.ps1 Removing find_cudnn_fixed.ps1 Removing find_cudnn_path.ps1 Removing fix_cudnn_path.ps1 Removing fix_encoding.ps1 Removing fix_environment.ps1 Removing fixed_build_openblas.ps1 Removing fixed_build_openblas_from_source.ps1 Removing fixed_build_script.ps1 Removing fixed_compile.ps1 Removing fixed_complete_install_fix.ps1 Removing fixed_diagnostic_test.py Removing fixed_hash_validation.ps1 Removing fixed_manual_build.ps1 Removing full_build.ps1 Removing full_fix_script.ps1 Removing functorch/_C.cp310-win_amd64.pyd Removing functorch/functorch.pyd Removing generate_compat.py Removing gpu_compatibility.py Removing install/ Removing install_openblas.ps1 Removing install_openblas_enhanced.ps1 Removing install_openblas_fixed.ps1 Removing install_openblas_mirror.ps1 Removing install_openblas_mirror_fixed.ps1 Removing install_openblas_ps7.ps1 Removing load_vs_env.ps1 Removing manual_build.ps1 Removing manual_install_openblas.ps1 Removing openblas.zip Removing pagefile.sys Removing prepare_build.ps1 Removing pytorch_fix_cmake.ps1 Removing rtx5070_env/ Removing rtx5070_test.py Removing setup_compiler.ps1 Removing setup_environment.ps1 Removing test.cpp Removing test.cu Removing test_gpu.exe Removing test_gpu.py Removing test_simple.py Removing third_party/cuda_compat/ Removing third_party/libuv/ Removing third_party/nccl/ Removing tools/__pycache__/ Removing tools/generate_missing_symbols.py Removing tools/setup_helpers/__pycache__/ Removing tools/shared/_utils_internal.py Removing torch/csrc/CMakeLists.txt Removing torch/csrc/api/include/torch/version.h Removing torchgen/__pycache__/ Removing torchgen/aoti/__pycache__/ Removing torchgen/api/__pycache__/ Removing torchgen/api/types/__pycache__/ Removing torchgen/dest/__pycache__/ Removing torchgen/packaged/ Removing torchgen/selective_build/__pycache__/ Removing use_precompiled.ps1 Removing verify_cuda.ps1 Removing verify_final.py Removing verify_final_v2.py Removing verify_installation.ps1 Removing verify_openblas.ps1 Removing verify_openblas_fixed.ps1 Removing verify_paths.ps1 Removing verify_pytorch.ps1 Removing verify_pytorch.py Removing verify_pytorch_fixed.py Removing verify_pytorch_fixed_v2.py Removing verify_torch.py Removing vs_env_setup.ps1 Removing windows_pytorch_deps.ps1 Removing "\346\226\260\345\273\272 \346\226\207\346\234\254\346\226\207\346\241\243.txt" (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 仅重置已跟踪的文件,丢弃所有修改(如果您确认不需要任何源码改动) (rtx5070_env) PS E:\PyTorch_Build\pytorch> git reset --hard HEAD is now at 2d31c3d99d9 Pass shared_ptr by value (#161834) (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 执行最终构建脚本 (rtx5070_env) PS E:\PyTorch_Build\pytorch> .\build_final.ps1 &: E:\PyTorch_Build\pytorch\build_final.ps1:11 Line | 11 | & ".\rtx5070_env\Scripts\activate.ps1" | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | The term '.\rtx5070_env\Scripts\activate.ps1' is not recognized as a name of a cmdlet, function, script file, or | executable program. Check the spelling of the name, or if a path was included, verify that the path is correct | and try again. (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 尝试添加可能支持的计算能力 (rtx5070_env) PS E:\PyTorch_Build\pytorch> $env:TORCH_CUDA_ARCH_LIST = "8.9;9.0" (rtx5070_env) PS E:\PyTorch_Build\pytorch> pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu130 Looking in indexes: https://download.pytorch.org/whl/nightly/cu130 ERROR: Could not find a version that satisfies the requirement torch (from versions: none) ERROR: No matching distribution found for torch (rtx5070_env) PS E:\PyTorch_Build\pytorch>
最新发布
09-03
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值