TAILIEUCHUNG - SQL Antipatterns- P5

Tham khảo tài liệu 'sql antipatterns- p5', công nghệ thông tin, cơ sở dữ liệu phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Solution Use the Right Tool for the Job 201 inverted index is a list of all words one might search for. In a many-to-many relationship the index associates these words with the text entries that contain the respective word. That is a word like crash can appear in many bugs and each bug may match many other keywords. This section shows how to design an inverted index. First define a table Keywords to list keywords for which users search and define an intersection table BugsKeywords to establish a many-to-many relationship Download Search soln inverted-index CREATE TABLE Keywords keyword_id SERIAL PRIMARY KEY keyword VARCHAR 40 NOT NULL UNIQUE KEY keyword CREATE TABLE BugsKeywords keyword_id BIGINT UNSIGNED NOT NULL bug_id BIGINT UNSIGNED NOT NULL PRIMARY KEY keyword_id bug_id FOREIGN KEY keyword_id REFERENCES Keywords keyword_id FOREIGN KEY bug_id REFERENCES Bugs bug_id Next add a row to BugsKeywords for every keyword that matches the description text for a given bug. We can use substring-match query to determine these matches using LIKE or regular expressions. This is nothing more costly than the naive searching method described in the Antipattern section but we gain efficiency because we only need to perform the search once. If we save the result in the intersection table all subsequent searches for the same keyword are much faster. Next we write a stored procedure to make it easier to search for a given If the word has already been searched the query is faster because the rows in BugsKeywords are a list of the documents that contain the keyword. If no one has searched for the given keyword before we need to search the collection of text entries the hard way. Download Search soln inverted-index CREATE PROCEDURE BugsSearch keyword VARCHAR 40 BEGIN SET keyword keyword 3. This example stored procedure uses MySQL syntax. Repor erratum this copy is printing May 2010 Solution Use the Right Tool for the Job 202 O PREPARE si

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.