Fulltext Index Study6:Population monitor

一, filter daemon host

sys.dm_fts_fdhosts

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

sys.dm_fts_memory_pools

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_limitmax_buffer_limit :Minimum/Maximum number of buffers allowed in the memory pool. 可以通过 sp_configure来修改配置。

sys.dm_fts_memory_buffers

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)

时间: 2024-12-11 13:45:51

Fulltext Index Study6:Population monitor的相关文章

Fulltext Index Study8:Resouce Consumption

一,查看Disk Consumption 1,通过SSMS查看Full-Text Index 的 Disk Consumption 在Storage->Full Text Catalogs,选择某一个Catalog,点击属性,查看Catalog Size,就是位于Catalog中的属于fulltext的internal tables的总大小. 2,Population Schedule 通过Population Schedule tab,创建schedule和Job,按照schedule对ful

Fulltext Index Study2:Pupulate

Creating and maintaining a full-text index involves populating the index by using a process called a population (also known as a crawl). 由于创建Fulltext Index 会消耗大量的系统资源,因此Fulltext Index 必须在系统空间的时间进行maintain和crawl.在创建Fulltext Index时,通过指定 CHANGE_TRACKING

Fulltext Index Study1:Usage

一,在创建Fulltext Index的table上,必须使用Key Index(unique, single-key, non-nullable column) CREATE UNIQUE INDEX ui_dbLogID ON [dbo].[DatabaseLog]([DatabaseLogID]); The KEY INDEX must be a unique, single-key, non-nullable column. Select the smallest unique key

Fulltext Index Study4:management and performance

Only one full-text index is allowed per table. For a full-text index to be created on a table, the table must have a single, unique nonnull column. You can build a full-text index on columns of type char, varchar, nchar, nvarchar, text, ntext, image,

Fulltext Index Study3:Query

在query 语句中,可以使用 contains predicate来调用Fulltext Index,实现比like速度更快的查询.使用contains能够进行term的extract匹配查询或term的前缀匹配查询,还能够进行基于词根的steming查询,基于自定义同义词文件的synonym查询,基于距离和顺序的相邻term查询.和like 相比,contains不能进行后缀匹配查询.如果Fulltext Index 能够满足业务需求,那么Fulltext Index是一个非常不错的选择,跟

Fulltext Index Study7: maintain fragment

A fulltext index uses internal tables called full-text index fragments to store the inverted index data. 一,查看fragment 1, sys.fulltext_index_fragments Status of the fragment, one of: 0 = Newly created and not yet used 1 = Being used for insert during

FULLTEXT INDEX全文索引

给现有的wxinfo表的sourceUrl 字段创建全文索引 ALTER TABLE wxinfoADD FULLTEXT INDEX sourceUrl (sourceUrl) 创建全文索引前: SELECT * FROM wxinfo WHERE sourceUrl LIKE '%查询字符串%' 创建全文索引后: SELECT * FROM wxinfo WHERE MATCH(sourceUrl) AGAINST('查询字符串') 备注1:目前,使用MySQL自带的全文索引时,如果查询字符

在MYSQL中运用全文索引(FULLTEXT index)

在MYSQL中使用全文索引(FULLTEXT index) MYSQL的一个很有用的特性是使用全文索引(FULLTEXT index)查找文本的能力.目前只有使用MyISAM类型表的时候有效(MyISAM是默认的表类型,如果你不知道使用的是什么类型的表,那很可能就是 MyISAM).全文索引可以建立在TEXT,CHAR或者VARCHAR类型的字段,或者字段组合上.我们将建立一个简单的表用来解释各种特性.简单用法(MATCH()函数)对3.23.23以后的版本有效,复杂的用法(IN BOOLEAN

C#多线程开发7:使用Monitor类同步多个线程

在<使用lock语句同步多个线程>的文章中,使用lock语句同步多线程访问临界资源. 使用lock语句的代码如下所示. private static object o = new object(); lock (o) { if (account >= 1000) { Thread.Sleep(10);//自动取款机打了个小盹 account -= 1000; pocket += 1000; } } 使用ILDASM工具查看上面代码对应的IL代码: 可以发现:lock语句被解析为调用Mon