Database Design: Solving Problems Before they Start! Ed Pollack Database Administrator CommerceHub.

Slides:



Advertisements
Similar presentations
Irwin/McGraw-Hill Copyright © 2000 The McGraw-Hill Companies. All Rights reserved Whitten Bentley DittmanSYSTEMS ANALYSIS AND DESIGN METHODS5th Edition.
Advertisements

C6 Databases.
Big Data Working with Terabytes in SQL Server Andrew Novick
Help! My table is getting too big! How to divide and conquer SQL Relay 2014.
Visibility Information Exchange Web System. Source Data Import Source Data Validation Database Rules Program Logic Storage RetrievalPresentation AnalysisInterpretation.
Chapter Physical Database Design Methodology Software & Hardware Mapping Logical Design to DBMS Physical Implementation Security Implementation Monitoring.
Database Management: Getting Data Together Chapter 14.
Fundamentals, Design, and Implementation, 9/e Chapter 11 Managing Databases with SQL Server 2000.
Chapter 1: The Database Environment
Irwin/McGraw-Hill Copyright © 2000 The McGraw-Hill Companies. All Rights reserved Whitten Bentley DittmanSYSTEMS ANALYSIS AND DESIGN METHODS5th Edition.
Database Design for DNN Developers Sebastian Leupold.
DBMS By Narinder Singh Computer Sc. Deptt. Topics What is DBMS What is DBMS File System Approach: its limitations File System Approach: its limitations.
Systems analysis and design, 6th edition Dennis, wixom, and roth
Data Warehousing Seminar Chapter 5. Data Warehouse Design Methodology Data Warehousing Lab. HyeYoung Cho.
Chapter 6: Foundations of Business Intelligence - Databases and Information Management Dr. Andrew P. Ciganek, Ph.D.
Physical Database Design Chapter 6. Physical Design and implementation 1.Translate global logical data model for target DBMS  1.1Design base relations.
SQL Server 7.0 Maintaining Referential Integrity.
Storing Organizational Information - Databases
Intro – Part 2 Introduction to Database Management: Ch 1 & 2.
C6 Databases. 2 Traditional file environment Data Redundancy and Inconsistency: –Data redundancy: The presence of duplicate data in multiple data files.
Databases Shortfalls of file management systems Structure of a database Database administration Database Management system Hierarchical Databases Network.
WHAT IS A DATABASE? A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSE OR TO PUT IT SIMPLY A GENERAL PURPOSE CONTAINER FOR STORING.
6.1 © 2010 by Prentice Hall 6 Chapter Foundations of Business Intelligence: Databases and Information Management.
Prepared By Prepared By : VINAY ALEXANDER ( विनय अलेक्सजेंड़र ) PGT(CS),KV JHAGRAKHAND.
Foundations of Business Intelligence: Databases and Information Management.
GLOBEX INFOTEK Copyright © 2013 Dr. Emelda Ntinglet-DavisSYSTEMS ANALYSIS AND DESIGN METHODSINTRODUCTORY SESSION EFFECTIVE DATABASE DESIGN for BEGINNERS.
Physical Database Design Purpose- translate the logical description of data into the technical specifications for storing and retrieving data Goal - create.
7 Strategies for Extracting, Transforming, and Loading.
Chapter 8 Physical Database Design. Outline Overview of Physical Database Design Inputs of Physical Database Design File Structures Query Optimization.
SQL Basics Review Reviewing what we’ve learned so far…….

Diving into Query Execution Plans ED POLLACK AUTOTASK CORPORATION DATABASE OPTIMIZATION ENGINEER.
1 Agenda TMA02 M876 Block 4. 2 Model of database development data requirements conceptual data model logical schema schema and database establishing requirements.
What is a database? (a supplement, not a substitute for Chapter 1…) some slides copied/modified from text Collection of Data? Data vs. information Example:
Management Information Systems by Prof. Park Kyung-Hye Chapter 7 (8th Week) Databases and Data Warehouses 07.
Logical Database Design and the Rational Model
Query Optimization Techniques
ITEC 3220A Using and Designing Database Systems
Lecture 6 Data Model Design (continued)
UFC #1433 In-Memory tables 2014 vs 2016
Dynamic SQL: Writing Efficient Queries on the Fly
Efficiently Searching Schema in SQL Server
Building Effective Backups
Mapping Shema and Recursively Managing Data
Database Performance Tuning and Query Optimization
Translation of ER-diagram into Relational Schema
COS 346 Day 8.
CHAPTER 5: PHYSICAL DATABASE DESIGN AND PERFORMANCE
DATABASE MANAGEMENT SYSTEM
Agenda Database Development – Best Practices Why Performance Matters ?
1 Demand of your DB is changing Presented By: Ashwani Kumar
Query Optimization Techniques
Physical Database Design
Practical Database Design and Tuning
Tracking Index Usage Like a Pro
Dynamic SQL: Writing Efficient Queries on the Fly
Table Partitioning Intro and make that a sliding window too!
Please thank our sponsors!
Finding Islands, Gaps, and Clusters in Complex Data
Contents Preface I Introduction Lesson Objectives I-2
Chapter 17 Designing Databases
Diving into Query Execution Plans
Chapter 11 Managing Databases with SQL Server 2000
Tracking Index Usage Like a Pro
Database System Concepts and Architecture
Finding Islands, Gaps, and Clusters in Complex Data
Change Tracking Live Data Warehouse
Query Optimization Techniques
The Database Environment
MIS 385/MBA 664 Systems Implementation with DBMS/ Database Management
Presentation transcript:

Database Design: Solving Problems Before they Start! Ed Pollack Database Administrator CommerceHub

Agenda Preventing future headaches, right now! Why does database design matter to us? Discussion of tables. Examples of good design practices. Important decisions when designing a database. Notes on important database design topics. Normalization Conclusion 2

Why Design Matters Match business needs with implementation. Ensure acceptable performance. Scalability. Needs of tomorrow != Needs of today. Good design = easy to understand. Decrease maintenance costs. Avoid scorn of future DBAs & developers. 3

Understand the Application Good design = knowing the business need. Talk to consumers of data. Ask lots of questions! May be technical or non-technical. What is the database used for? 4

Scalability Design for today AND tomorrow. Understand cardinality. Determine contention and concurrency. Build overhead to support the near future. Always re-evaluate and ensure scalability for the future. 5

Hardware Considerations CPU (speed, cores, MDOP, etc…) Memory Storage (attached, SAN, SSD, cloud, etc…) Network bandwidth On-premises vs. cloud File & backup locations 6

Designing Good Tables One table = a distinct entity. A column represents a unique element. Table can be one of three basic types: Entity Lookup Relationship (linking) Schemas can classify name spaces/security/classification. Avoid “double-duty” tables!!! 7

Data Types Choose the correct data type. Choose the correct data length/precision/size. Consider standards when unsure of representation Ie: ISO5218 for gender, ISO4217 for currency, ISO3166 for country Bit = 1 or 0. Do not use INT, string, etc… Consider mathematical operations for numeric types. 8

Dates & Times Be consistent across all tables! Do (or will) time zones matter? If so, use DATETIMEOFFSET or UTC time. Store in correct sized data type. Smalldatetime vs. Datetime2 vs. Date vs. Time Do not use strings for dates, times, timestamps, etc... Differentiate between a date/time and duration. 9

NULL vs. NOT NULL NULL = non-existence. Do not make up “De-nullifiers”. -1, 1/1/1900, ‘N/A’, ‘ ‘, ‘00:00’ NOT NULL = required by the application NULL has meaning. Define this during design phase. Beware NULL behavior. ORDER BY, GROUP BY, =, <>…\ Always explicitly name ALL objects! 10

Naming Objects What is it? Don’t name for location, time, usage, etc… A data element name should be unique! Column names should be positive, not negative Ie: Is_Not_Active vs. Is_Active Avoid abbreviations/shorthand. Don’t fear long names. Avoid spaces and special characters. DOCUMENTATION!!! 11

Uniqueness All rows in a table should be unique. PRIMARY KEY determines row identity/uniqueness. Natural key vs. surrogate key. Clustered key doesn’t have to be the primary key, but often will be. Unique constraints can enforce additional important business rules. 12

Other Schema Elements Stored Procedures: Use for efficient/controlled data access. Indexes: Speed up important read operations. Functions*: Encapsulate often-used logic. Triggers*: Enforce auditing, ETL, or business rules. Constraints*: Enforce important relationships/rules. Views: Provide a convenient/common path to data. ***Always ensure elements are needed before creation! 13

Iteration vs. Set-Based Operations SQL Server is built/optimized set-based transactions. Use of loops, such as CURSOR, WHILE, GOTO are often indicative of poor/suboptimal design. Consider alternatives to avoid row-by-row work: OUTPUT Window functions CTE 14

OLAP vs. OLTP The needs of transactional processing are different than the needs of analytics processing. Separate reporting from transactional processing, or build infrastructure to support a shared environment. Denormalize data for OLAP, not for OLTP. Consider different tools for each, if needed. 15

Old Data Do we delete, inactivate, partition, archive, etc…? Is archiving allowed/desired/required? How to handle data associated with archived data? Data retention policy Compliance needs. Contractual obligations. Prevent data from getting too large 16

Normalization Normalization reduces data redundancy by separation into tables. Avoids inconsistency via duplicated/missing/bad data. Consider 1:1 vs. 1:many vs. many:many vs. optional. DEMO: Normal forms. 17

Formatting Databases store and return data Formatting/presentation is best left to the application. Formatting can complicate scripts. Making output pretty can lead to poor performing queries. Be consistent across all objects! 18

Conclusion Good database design saves immense time & effort. Generates database schema that is easy to understand. Allows for easier upgrades, releases, migrations. Poor design = technical debt! Future DBAs and developers will see your initials and love you! 19

Questions???

Contact Info & Links Ed SQL Shack SQL Server Central SQL Saturday Albany (2016) Thank you!!!