وبلاگ بلیان

Expert T-SQL Window Functions in SQL Server 2019 : The Hidden Secret to Fast Analytic and Reporting Queries

معرفی کتاب «Expert T-SQL Window Functions in SQL Server 2019 : The Hidden Secret to Fast Analytic and Reporting Queries» نوشتهٔ Kathi Kellenberger; Clayton Groom; Ed Pollack، منتشرشده توسط نشر Apress : Imprint: Apress در سال 2019. این کتاب در فرمت pdf، زبان انگلیسی ارائه شده است.

«کاربرد حرفه‌ای توابع پنجره‌ای در اس‌کیو‌ال سرور ۲۰۱۹» (Expert T-SQL Window Functions in SQL Server 2019) نوشتهٔ کتی کلنبرگر، کلیتون گروم و اد پولاک، راهنمایی جامع و تخصصی برای استفاده از یکی از قدرتمندترین قابلیت‌های زبان تی-اس‌کیو‌ال است که اغلب نادیده گرفته می‌شود. این کتاب که توسط انتشارات معتبر آپرس در سال ۲۰۱۹ به چاپ دوم رسیده، به طور مشخص به توابع پنجره‌ای می‌پردازد و نشان می‌دهد که چگونه می‌توان از آن‌ها برای نوشتن کوئری‌های تحلیلی و گزارشی با کارایی بالا استفاده کرد. در دنیایی که داده‌ها به سرعت در حال رشد هستند، تسلط بر این توابع نه یک انتخاب، که یک ضرورت برای هر متخصص پایگاه داده محسوب می‌شود.

دربارهٔ کتاب «کاربرد حرفه‌ای توابع پنجره‌ای در اس‌کیو‌ال سرور ۲۰۱۹» —

محور اصلی این کتاب، توابع پنجره‌ای (Window Functions) هستند که مایکروسافت آن‌ها را از نسخهٔ ۲۰۰۵ به بعد به تی-اس‌کیو‌ال اضافه کرد و در نسخهٔ ۲۰۱۲ به بلوغ کامل رساند. با این حال، بسیاری از توسعه‌دهندگان و مدیران پایگاه داده هنوز با قدرت و کاربرد گستردهٔ آن‌ها به طور کامل آشنا نیستند و برای حل مسائل پیچیده، همچنان به روش‌های سنتی و پرهزینه مانند کرسورها (Cursors) یا جوین‌های خودارجاع (Self-Joins) متوسل می‌شوند. این کتاب با زبانی شیوا و ساختاری گام‌به‌گام، این توابع قدرتمند را از پایه تا سطوح پیشرفته معرفی کرده و با مثال‌های ملموس، کاربرد آن‌ها را در سناریوهای واقعی به تصویر می‌کشد. این کتاب که نسخهٔ دوم آن با نمونه‌های گسترده‌تر، از جمله فصلی از دنیای ورزش، و بهبودهای عملکردی تا نسخهٔ ۲۰۱۹ به‌روزرسانی شده، در یازده فصل به موضوعات مختلفی می‌پردازد. خواننده از آشنایی با مفاهیم پایه و دستور OVER شروع کرده و سپس با توابع رتبه‌دهی، توابع تجمعی و محاسبات کشویی، نحوهٔ دسترسی به سطرهای دیگر (با توابع LAG و LEAD ) و حتی توابع آماری آشنا می‌شود. نکتهٔ حائز اهمیت، تأکید ویژهٔ کتاب بر بهینه‌سازی عملکرد است؛ جایی که نویسندگان نه تنها نحوهٔ استفاده، بلکه شیوهٔ تنظیم کوئری‌ها برای دستیابی به بهترین کارایی را آموزش می‌دهند و موارد نادری را که روش‌های قدیمی‌تر همچنان برتری دارند، بررسی می‌کنند.

دربارهٔ نویسنده

این کتاب حاصل همکاری سه متخصص برجستهٔ حوزهٔ اس‌کیو‌ال سرور است. کتی کلنبرگر که بیش از بیست سال تجربه کار با اس‌کیو‌ال سرور را دارد، یک MVP (کارشناس باارزش) در حوزهٔ دیتا پلتفرم و سردبیر مجلهٔ تخصصی «سیمپل-تاک» در شرکت ردگیت است. کلیتون گروم نیز با ۲۵ سال سابقه، به عنوان مشاور دیتا و انالیتیکس، تخصص خود را در طراحی راه‌حل‌های انبار داده و تحلیل بر روی پلتفرم مایکروسافت به کار گرفته است. اد پولاک، سومین نویسنده، با بیش از دو دهه تجربه در مدیریت و معماری پایگاه داده، عشق و تخصص خود را در بهینه‌سازی عملکرد و افزایش سرعت سیستم‌های پایگاه داده به این اثر آورده است و تجربهٔ ارائه در همایش‌های متعددی از جمله سامیت‌های PASS را در کارنامه دارد.

چرا باید «کاربرد حرفه‌ای توابع پنجره‌ای در اس‌کیو‌ال سرور ۲۰۱۹» را بخوانید؟

  • جایگزینی روش‌های کند و پیچیده: می‌آموزید که چگونه کوئری‌های مشکل‌ساز و کند را که با کرسورها یا جوین‌های پیچیده نوشته می‌شوند، با توابع پنجره‌ای که سریع‌تر و خواناتر هستند، جایگزین کنید.
  • محاسبات پیشرفته و تحلیلی: با ایجاد «پنجره‌های کشویی» در مجموعه نتایج، قادر به محاسبه شاخص‌هایی مانند مجموع‌های در حال اجرا و میانگین‌های متحرک خواهید بود که در گزارش‌گیری و تحلیل داده ضروری هستند.
  • دسترسی به داده‌های سطرهای دیگر: با توابع قدرتمندی مانند `LAG` و `LEAD` آشنا می‌شوید که به شما امکان دسترسی به داده‌های سطرهای قبلی یا بعدی را در یک مجموعه نتیجه می‌دهند و برای محاسبه تغییرات و تفاوت‌ها بسیار کاربرد دارند.
  • درک صحیح از نحوهٔ کار با OVER Clause: فریم‌بندی پنجره‌ها را به درستی یاد می‌گیرید تا از خطاهای رایج و نتایج غیرمنتظره در کوئری‌های خود جلوگیری کنید.
  • بهینه‌سازی عملکرد کوئری‌ها: فراتر از نحوهٔ استفاده، با تکنیک‌های تنظیم کوئری و بهینه‌سازی آشنا می‌شوید تا از توابع پنجره‌ای بهترین بازدهی را بگیرید و در موارد خاص تشخیص دهید که روش‌های قدیمی‌تر کدامند.

این کتاب برای چه کسانی مناسب است؟

این کتاب برای هر کسی که با زبان تی-اس‌کیو‌ال کوئری می‌نویسد، طراحی شده است. طیف مخاطبان آن از مدیران پایگاه داده (DBAs) و توسعه‌دهندگان نرم‌افزار گرفته تا تحلیل‌گران کسب‌وکار و دانشمندان داده را شامل می‌شود. اگر با اصول پایه‌ای اس‌کیو‌ال مانند نحوهٔ جوین زدن جداول و نوشتن شرط WHERE آشنا هستید، این کتاب شما را گام‌به‌گام تا سطح یک متخصص خبره در زمینهٔ توابع پنجره‌ای پیش خواهد برد و نگرش شما را به نوشتن کوئری‌های تحلیلی متحول خواهد ساخت.

سوالات متداول

آیا این کتاب صرفاً به آموزش توابع پنجره‌ای می‌پردازد یا به بهینه‌سازی عملکرد نیز توجه دارد؟

این کتاب فراتر از آموزش صرف، به طور جدی به مبحث بهینه‌سازی عملکرد (Tuning) نیز می‌پردازد. نویسندگان با تأکید بر اینکه صرفاً دانستن و استفاده از این توابع کافی نیست، روش‌های دستیابی به بهترین کارایی را شرح داده و حتی مواردی را بررسی می‌کنند که روش‌های قدیمی‌تر ممکن است گزینهٔ بهتری باشند.

آیا برای درک مطالب این کتاب، به پیش‌نیاز خاصی نیاز است؟

بله، کتاب فرض را بر این گذاشته که خواننده با اصول اولیهٔ نوشتن کوئری در تی-اس‌کیو‌ال، از جمله نحوهٔ جوین زدن جداول، نوشتن عبارت WHERE و ایجاد کوئری‌های تجمعی (Aggregate) آشنا است. داشتن این دانش پایه برای بهره‌مندی کامل از محتوای کتاب ضروری است.

آیا در این کتاب به موضوعاتی مانند کوئری‌های زمانمند و تحلیل توالی نیز پرداخته شده است؟

بله. کتاب شامل فصل‌های جداگانه‌ای در مورد تحلیل روندهای زمانی (Time Trend Calculations) و محاسبات محدودهٔ زمانی (Time Range Calculations) است که از کاربردهای مهم و پیشرفتهٔ توابع پنجره‌ای محسوب می‌شوند.

Become an expert who can use window functions to solve T-SQL query problems. Replace slow cursors and self-joins with queries that are easy to write and perform better. This new edition provides expanded examples, including a chapter from the world of sports, and covers the latest performance enhancements through SQL Server 2019. Window functions are useful in analytics and business intelligence reporting. They came into full blossom with SQL Server 2012, yet they are not as well known and used as often as they ought to be. This group of functions is one of the most notable developments in SQL, and this book shows how every developer and DBA can benefit from their expressive power in solving day-to-day business problems. Once you begin using window functions, such as ROW_NUMBER and LAG, you will discover many ways to use them. You will approach SQL Server queries in a different way, thinking about sets of data instead of individual rows. Your queries will run faster, be easier to write, and easier to deconstruct, maintain, and enhance in the future. Just knowing and using these functions is not enough. You also need to understand how to tune the queries. Expert T-SQL Window Functions in SQL Server clearly explains how to get the best performance. The book also covers the rare cases when older techniques are the best bet. You will: Solve complex query problems without cumbersome self-joins that run slowly and are difficult to read, create sliding windows in a result set for computing such as running totals and moving averages, return aggregate and detail data simultaneously from the same SELECT statement, compute lag and lead and other values that access data from multiple rows in a result set, understand the OVER clause syntax and how to control the window, and avoid framing errors that can lead to unexpected results Become an expert who can use window functions to solve T-SQL query problems. Replace slow cursors and self-joins with queries that are easy to write and perform better. This new edition provides expanded examples, including a chapter from the world of sports, and covers the latest performance enhancements through SQL Server 2019. Window functions are useful in analytics and business intelligence reporting. They came into full blossom with SQL Server 2012, yet they are not as well known and used as often as they ought to be. This group of functions is one of the most notable developments in SQL, and this book shows how every developer and DBA can benefit from their expressive power in solving day-to-day business problems. Once you begin using window functions, such as ROW\_NUMBER and LAG, you will discover many ways to use them. You will approach SQL Server queries in a different way, thinking about sets of data instead of individual rows. Your queries will run faster, be easier to write, and easier to deconstruct, maintain, and enhance in the future.Just knowing and using these functions is not enough. You also need to understand how to tune the queries. __**Expert T-SQL Window Functions in SQL Server**__ clearly explains how to get the best performance. The book also covers the rare cases when older techniques are the best bet.**What You Will Learn** * Solve complex query problems without cumbersome self-joins that run slowly and are difficult to read * Create sliding windows in a result set for computing such as running totals and moving averages * Return aggregate and detail data simultaneously from the same SELECT statement * Compute lag and lead and other values that access data from multiple rows in a result set * Understand the OVER clause syntax and how to control the window * Avoid framing errors that can lead to unexpected results **Who This Book Is For** Anyone who writes T-SQL queries, including database administrators, developers, business analysts, and data scientists. Before reading this book, you should understand how to join tables, write WHERE clauses, and build aggregate queries. Become an expert who can use window functions to solve T-SQL query problems. Replace slow cursors and self-joins with queries that are easy to write and perform better. This new edition provides expanded examples, including a chapter from the world of sports, and covers the latest performance enhancements through SQL Server 2019. Window functions are useful in analytics and business intelligence reporting. They came into full blossom with SQL Server 2012, yet they are not as well known and used as often as they ought to be. This group of functions is one of the most notable developments in SQL, and this book shows how every developer and DBA can benefit from their expressive power in solving day-to-day business problems. Once you begin using window functions, such as ROW_NUMBER and LAG, you will discover many ways to use them. You will approach SQL Server queries in a different way, thinking about sets of data instead of individual rows. Your queries will run faster, be easier to write, and easier to deconstruct, maintain, and enhance in the future. Just knowing and using these functions is not enough. You also need to understand how to tune the queries. Expert T-SQL Window Functions in SQL Server clearly explains how to get the best performance. The book also covers the rare cases when older techniques are the best bet. What You Will Learn Solve complex query problems without cumbersome self-joins that run slowly and are difficult to read Create sliding windows in a result set for computing such as running totals and moving averages Return aggregate and detail data simultaneously from the same SELECT statement Compute lag and lead and other values that access data from multiple rows in a result set Understand the OVER clause syntax and how to control the window Avoid framing errors that can lead to unexpected results Who This Book Is For Anyone who writes T-SQL queries, including database administrators, developers, business analysts, and data scientists. Before reading this book, you should understand how to join tables, write WHERE clauses, and build aggregate queries.
دانلود کتاب Expert T-SQL Window Functions in SQL Server 2019 : The Hidden Secret to Fast Analytic and Reporting Queries