The Developer vs. The Relational Database: How to do it right

15
The Developer The Relational Database v s HOW TO DO IT RIGHT!

description

Presented at Dev Day 2013, Sri Lanka, this presentation focuses on tips and standards an application developer can utilize when interacting with a relational database. (Slide notes included)

Transcript of The Developer vs. The Relational Database: How to do it right

Page 1: The Developer vs. The Relational Database: How to do it right

The Developer

The Relational Database

vs

HOW TO DO IT

RIGHT!

Page 2: The Developer vs. The Relational Database: How to do it right

#DevDaySL @gogula

About me

MVP:SQL Server

MCSE:Business Intelligence

Author:Chapter 57

Technical Architect

Gogula Aryalingam

6

2011

Page 3: The Developer vs. The Relational Database: How to do it right

#DevDaySL @gogula

Agenda

Defensive Programming

Do it right:

Best Practices

Database Design

Documenting

Indexing considerations

Utility objects

Page 4: The Developer vs. The Relational Database: How to do it right

#DevDaySL @gogula

What’s wrong with this picture

Page 5: The Developer vs. The Relational Database: How to do it right

#DevDaySL @gogula

Here’s what…

Keys/Uniqueness

Data TypesNormalizatio

nNaming Convention

Constraints

Page 6: The Developer vs. The Relational Database: How to do it right

#DevDaySL @gogula

A better design

Page 7: The Developer vs. The Relational Database: How to do it right

#DevDaySL @gogula

Database design

Code is

Agile Database

is brittl

e

Page 8: The Developer vs. The Relational Database: How to do it right

#DevDaySL @gogula

Programming defensively

2. Modularize into fully testable and fully tested code

1. Define & understand assumptions

4. Reuse code when feasible*

3. Test as many use cases as possible

Page 9: The Developer vs. The Relational Database: How to do it right

#DevDaySL @gogula

Indexing for performance

Unique, narrow, static field

A clustered index on a heap (table) is a good idea

Leave small tables as is

Non-clustered indexes on fields used inJOINs and WHERE predicates

Do not index every field Index based on usage

Consider filtered indexesConsider included indexes

Page 10: The Developer vs. The Relational Database: How to do it right

#DevDaySL @gogula

Use utility objects

The Numbers table, for set based:

String sorting Extraction of distinct characters

Generate time ranges or time slices

Find IDENTITY gaps

Even something trivial like generating an IP range

Page 11: The Developer vs. The Relational Database: How to do it right

#DevDaySL @gogula

Document your code

Document through code

Document the Why apart

from the What

Page 12: The Developer vs. The Relational Database: How to do it right

#DevDaySL @gogula

Do we have time for a demo?

Defensive database

programming

Page 13: The Developer vs. The Relational Database: How to do it right

#DevDaySL @gogula

Questions?

During the

break

Page 14: The Developer vs. The Relational Database: How to do it right

#DevDaySL @gogula

THANK YOU

Page 15: The Developer vs. The Relational Database: How to do it right

#DevDaySL @gogula

MVP:SQL Server

dbantics.wordpress.comwww.sqlserveruniverse.com

[email protected]

Gogula AryalingamTechnical Architect

@gogula

lk.linkedin.com/in/gogula

Contact