39
Karen Lopez @datachick #TEAMDATA GREAT SCOTT! Working with all those weird datatypes

Great Scott! Dealing with New Datatypes

Embed Size (px)

Citation preview

Page 1: Great Scott! Dealing with New Datatypes

Karen Lopez @datachick #TEAMDATA

GREAT SCOTT!Working with all those weird datatypes

Page 2: Great Scott! Dealing with New Datatypes

Yes, Please do Tweet/Share today’s event

@datachick@ERStudio

Page 3: Great Scott! Dealing with New Datatypes

Karen López

Karen has 20+ years of data and information architecture experience on large, multi-project programs.

She is a frequent speaker on data modeling, data-driven methodologies and pattern data models.

She blogs at community.embarcadero.com, datamodel.comand Dataversity.net

She wants you to love your data.

Page 4: Great Scott! Dealing with New Datatypes

Logistics…

Use Q&A for formal questions – ask at any

time

Slides will be distributed after event

Continue the conversation on Twitter

There’s more to come…

Page 5: Great Scott! Dealing with New Datatypes

Plan for Today

Types of Data Types

The Outlier Data Types

Working with Data Types

10 Tips for Working with Data Types

Page 6: Great Scott! Dealing with New Datatypes

Poll: Who are you?

Page 7: Great Scott! Dealing with New Datatypes

Poll: Which RDBMSs Do You Support?

Page 8: Great Scott! Dealing with New Datatypes

Datatypes

Why do we need them?What types of datatypes are there?

Page 9: Great Scott! Dealing with New Datatypes

Datatypes aren’t

just formats

Page 10: Great Scott! Dealing with New Datatypes

Datatypes are

also about

data quality

Page 11: Great Scott! Dealing with New Datatypes

Datatypes are

also about

PERFORMANCE

Page 12: Great Scott! Dealing with New Datatypes

Note…

Today’s focus is mostly on physical data types…

….but I do have some thoughts on logical data types as well

Page 13: Great Scott! Dealing with New Datatypes

Types of Datatypes*

predefined data types

constructed types

user-defined types

ISO: 9075

Page 14: Great Scott! Dealing with New Datatypes

Data types

Understand your data type taxonomies, by RDBMS and version.

IBM DB2

Page 15: Great Scott! Dealing with New Datatypes

Understand the lingo

Data type names

Data type syntax

Data type gotchas

Page 16: Great Scott! Dealing with New Datatypes

The Basic Datatypes

Strings

Numeric

Boolean

Dates and Times

Interval

ISO: 9075

Page 17: Great Scott! Dealing with New Datatypes

Fancy Datatypes

• HIERARCHYID

• Spatial data types (GEOMETRY, GEOGRAPHY, more)

• XML

• JSON < NEW!!!!! FANCY!!!

• PERIODs

• MONEY

• Spatial temporal data types (a special one)

Page 18: Great Scott! Dealing with New Datatypes

Hierarchies

Page 19: Great Scott! Dealing with New Datatypes

Meet JSON

Javascript Object Notation

JSON support arrays and variable data items

Much like XML in theory (shredding, overuse, popular )

https://docs.mongodb.org/getting-started/shell/import-data/

Page 20: Great Scott! Dealing with New Datatypes

Periods

Data type for storing an opening and closing date (or time) period

Has special operators and functions to help work with the data

Importantly, an “until closed” end period

https://developer.teradata.com/database/articles/exploring-teradata-13s-period-data-type

Page 21: Great Scott! Dealing with New Datatypes

Spatial data types

Special functions

Meet needs for shapes and lines

Geospatial Data in SQL Server. (2015, May 14). Wikibooks, The

Free Textbook Project. Retrieved 18:21, November 10, 2015

from https://en.wikibooks.org/w/index.php?title=Geospatial_Data_i

n_SQL_Server&oldid=2958376.

Page 22: Great Scott! Dealing with New Datatypes

Money (and other specialized data types)

Special use cases

Special limiations

Limited cross-platform support

Often limitations are not well known

http://www.postgresql.org/docs/9.4/static/datatype-money.html

http://www.postgresql.org/docs/9.4/static/datatype-net-types.html

Page 23: Great Scott! Dealing with New Datatypes

Dates and Times

Various “precisions”

Some, not all, RDBMSs support WITH TIMEZONE

Conversion compatibilities

ISO 9075

Page 24: Great Scott! Dealing with New Datatypes

Host Implementation Gotchas

TIMESTAMP

Dates and Times WITH TIMEZONE

TINYINT

BIT

And more….

Page 25: Great Scott! Dealing with New Datatypes

Other Gotchas

Conversion Compatibilities

Performance of conversions

Foreign key consistency

NULLability

https://msdn.microsoft.com/en-us/library/ms191530.aspx

Page 26: Great Scott! Dealing with New Datatypes

User Defined Data Types

Page 27: Great Scott! Dealing with New Datatypes

http://www.datamodel.com/index.php/20

14/04/01/sql-server-2014-new-datatype/

Page 28: Great Scott! Dealing with New Datatypes

Iterative Data Modeling

Page 29: Great Scott! Dealing with New Datatypes

How do we set data types?

Data architects must work with DBAs, Devs, end users to finalize datatypes

Page 30: Great Scott! Dealing with New Datatypes

Deciding on Datatypes

Data profiling

Awareness of options

Confirmation of cost, benefit, risk

Urban myths

Testing and benchmarking

Page 31: Great Scott! Dealing with New Datatypes

What about logical data types?

They are just as important

Many of our thoughts today apply

We should stive to keep them simple

Logical data types for meaning

Yet….

Page 32: Great Scott! Dealing with New Datatypes

Logical/Physical data type mapping

Page 33: Great Scott! Dealing with New Datatypes

Other Modeling Gotchas

Page 34: Great Scott! Dealing with New Datatypes
Page 35: Great Scott! Dealing with New Datatypes

10 Tips for using the right datatypes

1.Learn all the datatypes available to you, by RDMS and version

2.Read the pros and cons of each

3.Create user defined datatypes that provide benefits to more than just the data modeler

4.Understand datatype compatibilities

5.Know the business case for longer datatypes

Page 36: Great Scott! Dealing with New Datatypes

10 Tips for Data Modelers

6. Be prepared to defend the use of the correct datatype

7. Size matters: know why

8. Stop using deprecated data types. Really. Just. Stop.

9. Monitor RDBMs upcoming features

10.Request enhancements if your tools don’t support an RDBMS datatype.

Page 38: Great Scott! Dealing with New Datatypes

Community

community.embarcadero.com

Page 39: Great Scott! Dealing with New Datatypes

Thank you, you were great.

Let’s do this again some time!

Karen Lopez @datachick