1 / 34

Integrated Full-Text Search ( i FTS ) in Microsoft SQL Server ® 2008

Integrated Full-Text Search ( i FTS ) in Microsoft SQL Server ® 2008. Fernando Azpeitia Lopez SQL Server Engine - Program Manager Microsoft ® Corporation. Session Objectives And Takeaways.

aleron
Download Presentation

Integrated Full-Text Search ( i FTS ) in Microsoft SQL Server ® 2008

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Integrated Full-Text Search (iFTS) in Microsoft SQL Server ® 2008 Fernando Azpeitia Lopez SQL Server Engine - Program Manager Microsoft ® Corporation

  2. Session Objectives And Takeaways “What is exactly full-text search in a DB? Which are its main scenarios and how can it provide value to my solution?” • Cover the main concepts and capabilities of our full-text search solution inside SQL Server. • Realize how iFTS (SQL Server 2008 integrated FTS) can extract significant value out of unstructured and semi-structured data stored inside the DB. • Demonstrate the usage of iFTSand how it solves your daily DB Search needs. • Cover iFTS’best practices and workarounds. • Evangelize SQL Server FTS and prove it ready for high level production environments • Understanding the future of Search in DBs.Where are we going and why?

  3. Session Details • Searchingat Microsoft: Main Players • SQL Server Full-Text Search (FTS): Overview of Basic Scenarios, • Concepts, Features & Architecture (Demo) • The need • The Scenario • The Solution • How do I deploy it? • How do I use it? • SQL Server 2008iFTS (Integrated FTS) • Why did we need a new Search infrastructure? • SQL FTS Roadmap • - The new Architecture • - Main Improvements (Demo) • - Upgrading to iFTS • - Best Practices and Workarounds • - What is not in iFTS? • - Upcoming Future • Q&A • aria

  4. Searching at Microsoft: Main Players • Bing • Search WWW • Highly scalable • Does not use FTS as provided by SQL Server • MS Search • Search information on disk • Integrated with OS (e.g: Vista Desktop Search) • Used by former SharePoint, SQL Server 2000 and 2005 and Desktop Search … • FAST • Search information on your organization (Enterprise Search) • SharePoint Server search solution • iFTSin SQL Server 2008 • Provides Full Text Search over data in RDBMS • Completely redesigned search solution to leverage DB robustness • and scalability.

  5. Full-Text Search (FTS) in SQL Server:Overview “The Need” “How can I extract value out of vast amounts of non-relational data stored in the DB, by leveraging fast filtering mechanisms to get to the information I need?”

  6. Full-Text Search (FTS) in SQL Server: Overview “The Scenario” • Heterogeneous data (different types and languages) stored and managed in the DB. Mainly unstructured and semi-structured data (e.g: binary documents, emails, XML, HTML, etc..) • Besides leverage DB capabilities, the ability to Search efficiently over this data arises. • The creation of special (non-relational) indexes is needed in order to enable Search over these corpuses. • Users need to manage the data and its indexes together and consistently. • Main Markets: Compliance/E-Discovery, Government/Law Enforcement, eCommerce, Customer Support, Vertical Search (Medical, Media,..Etc….)

  7. Full-Text Search (FTS) in SQL Server:Overview “The Solution” • SQL Server Full-Text Search (FTS) • FTS is a feature integrated into SQL Server that allows fast and flexible queryingof significant words and phrases in: • Character-based database columns • Documents stored in an binary typed column; varbinary() and binary(), as well as XML data types • FTS searches forlanguageaware tokens, keywords or phrases inside the database providing scoring and relevance of the result set.

  8. Full-Text Search (FTS) in SQL Server:Overview “How does it work?” • Tokenization • The data is parsed by language aware processes (iFilters, stemmer, wordbreaker, etc..) • Indexing • FTS uses special indexing mechanism: custom FTIndexes stored in FTCatalogs. • Each token (word) is indexed keeping metadata related to it. • Querying • Predicates: CONTAINS, FREETEXT • Table-valued functions returning relevance base score: CONTAINSTABLE, FREETEXTTABLE • Matching semantics: exact or fuzzy • Various query options available: i.e : weight, NEAR, Thesaurus, Inflectional, Top_N_by_Rank, prefix, etc..… • Wide language support at indexing and querying time.

  9. Full-Text Search (FTS) in SQL Server: Overview Demo: “How do I deploy it?” • Locate table with textual data (character based or binary raw data). • Full-text catalog created in that database. CREATE FULLTEXT CATALOG ftCatalog AS DEFAULT; • Full-text index (associated with the full-text catalog) on the column/s of the table. CREATE FULLTEXT INDEX ON HumanResources.JobCandidate(Resume) KEY INDEX PK_JobCandidate_JobCandidateID; • Population of the index that results in scanning and processing of the textual data. • T-SQL Queries that use full-text predicates or table valued constructs. • A full set of T-SQL DDL available to perform FTS manageability operations.

  10. Full-Text Search (FTS) in SQL Server:Overview Demo: “How do I use it?” • Populating the FT Index. Keeping up with changes. • Querying my data: Understanding CONTAINS and FREETEXT • Extending the query to leverage useful features: • Thesaurus • Prefix search • Inflectional Forms • Weighted terms • TOP_N Etc…

  11. SQL Server 2008 integrated FTS

  12. Why a new Search Infrastructure? • Possible challenges you might have encountered when • using SQL Server 2005 Full-Text Search (FTS) • Indexes stored outside SQL Server might lead to manageability • challenges • E.g: Backup/Restoring your DB with FTCatalogs might require specific actions • TheMixed query performance suffersfrom having to pull over the complete full-text result set • E.g: Poor performance when relational side very selective • PossibleScaling issueson big boxes • Manysustained engineering challengesdue lack of technology • ownership. • E.g: Inability to efficiently support our customers • Inability to deliver top features highly requested. • Inability to shape our own roadmap targeting our direct customer needs.

  13. Why a new Search Infrastructure? • Provide foundation to address futureneeds • Extend the FTS feature set • customizable proximity operator • property level search • snippets with hit-highlighting • field weighted relevance • customizable tokenizing • etc….. • Compelling search platformfor others to build on • Eventually, offer Search within all datainside the database.

  14. Search: • SQL Server Full-Text Search Roadmap • FTIndexesinto the database • Seamless administration, manageability and high availability experience • for search indexes • Integration with Query Processor • Efficient and scalable query processing over search to query continuum • Enabling search in semi-structured and unstructured DB storage solutions (e.g:Filestream, Sparse Columns, XML, etc..) • Feature set comparable to what they see in web and desktop search space • Snippets, field scoped search, weighted relevance, customizable NEAR, etc… • Massive Scale-upand performance enhancements. Becomes the fast DB search engine in the market. • Facilitate Scale-out and manageability enhancements. e.g: Remote indexing, etc.. • Enabling finding of ad-hoc information inside the DB without prior knowledge of its schema.

  15. FTS 2008 New Architecture MSFTESQL(FT Search Engine) SQL Server process SQL Query Procesor SQL Query Execution SQL Query compilation FTS Engine STOPLIST FTS Query Execution FTS Query compilation Full-Text Index Crawl Gatherer Indexer Data to be Indexed Shared Memory Keyword and occurrence information Shared Memory Filter Daemon Host (FDHost) Protocol Hander iFilters Wordbreakers Filtered Text DB Data

  16. FTS 2008 New Architecture Query MSFTESQL(FT Search Engine) SQL Server process SQL Query Procesor SQL Query Execution SQL Query compilation Thesaurus FTS Engine STOPLIST FTS Query compilation FTS Query Execution Full-Text Index Wordbreaking of query terms Filter Daemon Host (FDHost) Wordbreakers

  17. Main Improvements • Full-Text Indexesare stored and maintained inside SQL Server. • Full integration with other unstructured and semi-structured solutions. • Manageabilityfeatures likeBackup/Restore, Attach/Detach, • Mirroring and Log shipping work for FT indexes just as any other DB objects or • regular indexes. • Indexing and specific cases of query performance have been improved dramatically. • (Demo) Accessto Full-Text Indexes raw Data. Provides access to search corpus • and statistical information. Useful for troubleshooting scenarios. • sys.dm_fts_index_keywords() • sys.dm_fts_index_keywords_by_document()

  18. Main Improvements • (Demo) Query Input Parser :sys.dm_fts_parser • Better supportability: understanding a given WB behavior. • SELECT * FROM sys.dm_fts_parser('"This is test“ AND “This also"',1033,0,0)

  19. Main Improvements • Full-Text Queryis integrated with SQL Query Processor • Mixed query performance has been improved for significantly different cardinality scenarios • Overall Query performance scales better in most scenarios • Resource utilization is managed (mostly) as part of SQL Server

  20. Main Improvements • Thesaurus improvements • Stored in internal tables (in tempdb) in XML form instead of • being parsed from external files • Instancelevel thesaurus sys.sp_fulltext_load_thesaurus_file (lcid) Loads all the data specified in the Thesaurus XML corresponding to the language with specified lcid.

  21. Main Improvements • (Demo) NewSTOPLISTsupport: Simplified noise words utilization and manageability. DB object associated with the FT index. • CREATE FULLTEXT STOPLIST stoplist_name • [ FROM {[database_name.] source_stoplist_name} | SYSTEM STOPLIST] • [AUTHORIZATION owner_name] • ALTER FULLTEXT STOPLIST stoplist_name • { • | ADD <keyword> LANGUAGE language_term • | DROP • { • | <keyword> LANGUAGE language_term • | ALL LANGUAGE language_term • | ALL • }

  22. Main Improvements • New family ofWord-Breakers (WB): • WBs are components responsible of parse the textual • data in a given language and pass the tokenized result • to the Full-Text Index. • 51languages/WBs out of the box • Improved quality and supportability in most • word- breakers

  23. Main Improvements • WBs available in SQL Server 2008: German Gujarati Hebrew Hindi Icelandic Indonesian Italian Japanese Korean Latvian Lithuanian Malay Malayalam Marathi Neutral Norwegian Polish • Arabic • Bengali • Brazilian • Bulgarian • Canadian • Catalan • Chinese (Simplified) • Chinese (Traditional) • Chinese (Hong Kong) • Chinese (Macau) • Chinese (Singapore) • Croatian • Cyrillic • Danish • Dutch • English • English UK • French Portuguese Punjabi Romanian Russian Serbian Latin Slovak Slovenian Spanish Swedish Tamil Telugu Thai Turkish Ukrainian Urdu Vietnamese Languages present but disabled by default New languages supported in SQL Server 2008 Existing in SQL Server 2005, and being replaced by new WBs in SQL Server 2008 Unchanged language/WB from SQL Server 2005

  24. Main Improvements • The indexing performance has improved in most scenarios Measured on 4 processor AMD64 2793 MHz, 8G RAM. Numbers are in HH:MM format. Total time is combining time to crawl and time of merge into index For some HW configuration and data types, specific best practices are recommended to improve indexing performance (i.e: capping SQL Server’s memory, etc…)

  25. Upgrading to iFTS • Due a new Full-Text Index architecture, former Full-Text Indexes are not compatible in SQL Server 2008 anymore. • Solution…: The Full-Text Catalog Upgrade Option • Import: (default) Faster method although performance and semantic implications are possible. • Rebuild: Slower method although ideal final state of new FTCatalogs guaranteed. • Reset : Faster Upgrade method although your Search app will not • have the FTCatalogs available afterwards. You need to rebuild them • when possible. • Possible Upgrade methods: • In place Upgrade: User will be prompted for what Upgrade Option to choose for existing FTCatalogs. • Restore/Attach : Instance level setting will be applied to former • Full-Text Catalogs brought up with the former DB.

  26. Best Practices and Workarounds • Full-Text key type: Use Integer.. • When so, no internal mappingtable required  we avoid an extra internal JOIN at query time. • To limit results and increase performance, use the top_n_by_rank option with FREETEXTTABLE and CONTAINSTABLE. • Use CONTAINSTABLE or FREETEXTTABLE when you only require • Full-Text Key or rank information. • Keep your FTIndexes de-fragmentated when possible  Reorganize the Full-Text catalog by using ALTER FULLTEXT CATALOG REORGANIZE.

  27. Best Practices and Workarounds • Prefixqueries Issues? • The issue • Possible Query perf degradation with non-deterministic enough prefix queries (i.e: ‘a*’). • Recommended best practice/s • Try to narrow down your search when possible. • If the query plan has a nested loop with the fulltext STVF, you should try hinting a merge join.

  28. Best Practices and Workarounds • Issues with Complex queries? • Several ANDs + ORs within a single CONTAINS() • The issue • QO plan and compilation complexity might cause blocking • Multiple FT logical operators adds extra cost when relational predicate is pushed into the FTIndex • When kept as relational, the QO chosen plan might be not ideal, causing costly executions. • Recommended best practice • Implement app. level max # of terms. • Leverage Thesaurus capabilities when possible. • Several CONTAINS linked by ORs conditions • The issue • QO plan and compilation complexity might cause blocking • Recommended best practice • Combine multiple CONTAINS predicates into one CONTAINS predicate

  29. Best Practices and Workarounds • Blocking issues due high DML + FT query workloads • The issue • …High DML workload (+100 DMLs/sec) • + • …Plus AUTO being specified as the change tracking mechanism for the Full-text index • …. might cause the query load to suffer blocking. • Recommended best practice/s • A Trace Flag exist to solve this issue (7646) • There are documented best practices in the SQL Server 2008 White Paper to mitigate this issue. (e.g: manual change tracking, REORGANIZE, etc..) • Install latest PCU for latest fixes in this area.

  30. Best Practices and Workarounds • Best resources for additional information: • SQL Server 2008 BOL • SQL Server 2008 iFTS Internals and Enhcancements(White Paper): http://msdn.microsoft.com/en-us/library/cc721269.aspx • Fernando Azpeitia Lopez : fernlope@microsoft.com • Program Manager .SQL Server Full-Text Search.

  31. What is not yet in IFTS? • No document property level search (i.e: search ‘foo’ on doc.’title’) • Some of the customer wish list items: Snippets, column weights, language detection, customizable wordbreakers and proximity operators, etc.. • Non support for remote FTIndexing. Currently, iFTS can only index data stored directly in the DB or in the file system using Filestream integration. • No partitioned full-text indexes. No support for SWITCH partition • on tables that are FT indexed. • Non support for remote FTIndexing. Currently, iFTS can only index data stored directly in the DB or in the file system using Filestream integration.

  32. Upcoming Future • What are we working on for our next major release/s? • Improve dramatically our overall query performance by reengineering key components in our architecture. • i.e: Early estimations point we will become the fastest DB Engine in the market. • Address as many developer features as time permits (e.g: customizable NEAR, property search, etc..) • Improve our overall scale story to support large corpuses under an impressive query performance.

  33. Summary • iFTSadds significant value • Implementation -> straightforward • Management -> straightforward • Improved overall Performance, Integration and Robustness • iFTS 2008 is the beginning of an ambitious upcoming plan to become the fastest and easier to use DB Search solution in the world.

  34. Thank you

More Related