Top Banner
Simon Liao Survive in Database --For New Developers
12

Simon Liao Survive in Database --For New Developers.

Mar 26, 2015

Download

Documents

Michael MacLean
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Simon Liao Survive in Database --For New Developers.

Simon Liao

Survive in Database--For New Developers

Page 2: Simon Liao Survive in Database --For New Developers.

AgendaWelcome to ETOWN familyDBA team recommendRelease team suggestSQL Server likesQ & A

Page 3: Simon Liao Survive in Database --For New Developers.

DBA team

Release team

Page 4: Simon Liao Survive in Database --For New Developers.

SQL Server

SQL 2005 SP2(9.0.3042)

SQL 2008 R2(10.50.1600)

Page 5: Simon Liao Survive in Database --For New Developers.

DBA Recommend (1)SP Create

[TableName]_[Action]_puse <dbName>dbo prefixset nocount ongopermission grant to db base role

SP AlterNo drop/createV2 when parameter number changes

CodeSpewWizard tool $/Builds/_Builds/Tools/CodeSpewingWizard

Page 6: Simon Liao Survive in Database --For New Developers.

DBA Recommend (2)Table Create

Singular formCapitalCasing_lkp, _lnk, w*PK, FK, UQCollate SQL_Latin1_General_CP1_CI_AIInsertDate/UpdateDate

Table Drop_RemoveMeAfter20101201_ByXXXNo _new, _1, _2, _bak

Page 7: Simon Liao Survive in Database --For New Developers.

DBA Recommend (3)Data Update

Select before update with the same where clause

Use usb-etowndevts to access U.S.-based db servers

Add yourself in EnglishtownDevelopersShanghai group

Add your Chinese name in your Skype

Page 8: Simon Liao Survive in Database --For New Developers.

Release Team SuggestAutoBuild tool

Run it before you request DB reviewRelease Request (RR) submit

Don’t forget click ‘Request Review’Email/DropBy me for emergency releaseTake care the New/Update actionTake care the US/CN/Both environment flags

Read-only data releaseJust get it ready in QA db serverNo need db script

Page 9: Simon Liao Survive in Database --For New Developers.

SQL Server Likes (1)WITH (NOLOCK)

Specially for large table and live serversNo transaction

We never use it except few scenariosNo ‘Select *’

No covering index except table scanAdditional disk IO and network bandwidth

SELECT TOP 10 Order By PK column

Page 10: Simon Liao Survive in Database --For New Developers.

SQL Server Likes (2)Sequential inserting to avoid page split

Identity columnLastID

Execute queries in VS3 instead of VS1Avoid additional workload for VS1VS3 has more indexes and much lighter workload

Cancel any query running longer than 2 minutes

Try stricter Where clause at first, then lessFilter the data based on famous index

columnsET_Main..Members: MemberId, UserName, Email,

PartnerSiteET_Payment..PaymentRequest: MemberId, EmailVisitTracking: VisitDatePageVisit: VisitDate

Page 11: Simon Liao Survive in Database --For New Developers.

Q & A

Page 12: Simon Liao Survive in Database --For New Developers.

谢谢您Thank You