simon liao survive in database --for new developers

Post on 26-Mar-2015

216 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Simon Liao

Survive in Database--For New Developers

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

DBA team

Release team

SQL Server

SQL 2005 SP2(9.0.3042)

SQL 2008 R2(10.50.1600)

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

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

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

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

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

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

Q & A

谢谢您Thank You

top related