一, filter daemon host
Returns information on the current activity of the filter daemon host or hosts on the server instance.
fdhost_process_id:Windows process ID of the filter daemon host.
max_thread:Maximum number of threads in the filter daemon host.
batch_count:Number of batches that are being processed in the filter daemon host. Monitors how many batches are currently being processed in the filter daemon.
查看 filter daemon host的ProcessID,最大线程数量和当前被处理的Batch数量。
select fdhost_process_id,max_thread,batch_count from sys.dm_fts_fdhosts
通过ProcessID,能够在Task Manager中查看该Process当前消耗的CPU和内存资源。
二,Crawl
使用Base table对 fulltext index进行填充,称作Population 或 Crawl。populating the fulltext index by using a process called a population (also known as a crawl).
1,在SQL Server中,关于Crawl的配置共有3个,使用sys.sp_configure 配置,使用sys.configurations查看配置信息
select * from sys.configurations where name like N‘%crawl%‘
2,在fulltext index crawl时,查看当前消耗的memory
Returns information about the shared memory pools available to the Full-Text Gatherer component for a full-text crawl or a full-text crawl range.
buffer_size:Size of each allocated buffer in the memory pool. 单位是Byte
buffer_count:Current number of shared memory buffers in the memory pool.
min_buffer_limit 和 max_buffer_limit :Minimum/Maximum number of buffers allowed in the memory pool. 可以通过 sp_configure来修改配置。
Returns information about memory buffers belonging to a specific memory pool that are used as part of a full-text crawl or a full-text crawl range.
--returns the total shared memory owned by the Microsoft Full-Text Gatherer component SELECT SUM(buffer_size * buffer_count)/1024 AS total_memory_KB FROM sys.dm_fts_memory_pools --return buffer details select mp.pool_id, mp.buffer_size/1024 as buffer_size_KB, mp.buffer_count, mp.max_buffer_limit, mb.is_free, mb.row_count, mb.bytes_used, mb.percent_used from sys.dm_fts_memory_pools mp left join sys.dm_fts_memory_buffers mb on mp.pool_id=mb.pool_id
3,Population flow
通过sys.dm_fts_index_population 查看当前正在运行的crawl,每一次crawl都会分多个Ranges并行crawl,每一个Range可以分多个Batch进行。
population_type :Type of population. One of the following:
- 1 = Full population
- 2 = Incremental timestamp-based population
- 3 = Manual update of tracked changes
- 4 = Background update of tracked changes.
range_count:Number of sub-ranges into which this population has been parallelized.
outstanding_batch_count:Current number of outstanding batches for this population. “outstanding” 翻译为尚待解决的,未解决的。
status:Status of this Population. Note: some of the states are transient. One of the following:
- 3 = Starting
- 5 = Processing normally
- 7 = Has stopped processing
- 11 = Population aborted
- 12 = Processing a semantic similarity extraction
Fulltext Index的Population,range和 batch通过Memory Address 进行Join,例句如下
SELECT ip.database_id, object_name(ip.table_id,ip.database_id) as TableName, c.name as CatalogName, ip.population_type,ip.population_type_description, ip.is_clustered_index_scan, ip.range_count, ip.completed_range_count, ip.outstanding_batch_count, ip.status, ip.status_description, pr.session_id as Range_SessionID, pr.processed_row_count, ob.batch_id from sys.dm_fts_index_population ip left join sys.fulltext_catalogs c on ip.catalog_id=c.fulltext_catalog_id left join sys.dm_fts_population_ranges pr on ip.memory_address=pr.parent_memory_address left join sys.dm_fts_outstanding_batches ob on pr.memory_address=ob.crawl_memory_address order by ob.batch_id
4,Async Population
当使用Alter fulltext index 命令对 fulltext index 进行population时,只是启动Crawl,Alter fulltext index 命令返回的结果表明启动Crawl成功,不会等待Population 完成。
参考doc:
Full-Text Search and Semantic Search Dynamic Management Views and Functions (Transact-SQL)
sys.dm_fts_fdhosts (Transact-SQL)
sys.dm_fts_memory_pools (Transact-SQL)
sys.dm_fts_memory_buffers (Transact-SQL)
sys.dm_fts_index_population (Transact-SQL)
sys.dm_fts_population_ranges (Transact-SQL)
sys.dm_fts_outstanding_batches (Transact-SQL)
ALTER FULLTEXT INDEX (Transact-SQL)