TAILIEUCHUNG - Joe Celko s SQL for Smarties - Advanced SQL Programming P78

Joe Celko s SQL for Smarties - Advanced SQL Programming P78. In the SQL database community, Joe Celko is a well-known columnist and purveyor of valuable insights. In Joe Celko's SQL for Smarties: Advanced SQL Programming, he picks up where basic SQL training and experience leaves many database professionals and offers tips, techniques, and explanations that help readers extend their capabilities to top-tier SQL programming. Although Celko denies that the book is about database theory, he nevertheless alludes to theory often to buttress his practical points. This title is not for novices, as the author points out. Instead, its intended. | 742 CHAPTER 33 OPTIMIZING SQL that 80 of the queries will use the primary key and 20 will use another near-random column. This is pretty much what you would know in a real-world situation since most of the accessing will be done by production programs with embedded SQL in them only a small percentage will be ad hoc queries. Without giving you a computer science lecture a computer problem is called NP-complete if it gets so big so fast that it is not practical to solve it for a reasonable-sized set of input values. Usually this means that you have to try all possible combinations to find the answer. Finding the optimal indexing arrangement is known to be NP-complete Comer 1978 Paitetsky-Shapiro 1983 . This does not mean that you cannot optimize indexing for a particular database schema and set of input queries but it does mean that you cannot write a program that will do it for all possible relational databases and query sets. Watch the IN Predicate The in predicate is really shorthand for a series of ORed equality tests. There are two forms either an explicit list of values is given or a subquery is used to make such a list of values. The database engine has no statistics about the relative frequency of the values in a list of constants so it will assume that the list is in the order in which the values are to be used. People like to order lists alphabetically or by magnitude but it would be better to order the list from most frequently occurring values to least frequently occurring. It is also pointless to have duplicate values in the constant list since the predicate will return true if it matches the first duplicate it finds and will never get to the second occurrence. Likewise if the predicate is false for that value the program wastes computer time traversing a needlessly long list. Many SQL engines perform an IN predicate with a subquery by building the result set of the subquery first as a temporary working table then scanning that result table from .

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.