Skip to content

Instantly share code, notes, and snippets.

View dvgamerr's full-sized avatar
🦥
ไม่ชอบออกไปไหน

Kananek Thongkam dvgamerr

🦥
ไม่ชอบออกไปไหน
View GitHub Profile
SELECT TOP 50
SUBSTRING(qt.TEXT, (qs.statement_start_offset/2)+1,
((
CASE qs.statement_end_offset
WHEN -1 THEN DATALENGTH(qt.TEXT)
ELSE qs.statement_end_offset
END - qs.statement_start_offset)/2)+1),
qs.execution_count,
(qs.total_logical_reads + qs.total_logical_writes) / qs.execution_count as [Avg IO],
qp.query_plan,
@dvgamerr
dvgamerr / advence-step.md
Last active March 28, 2018 08:05
Add autoincrement to existing PK

Using UPDATE, DELETE or INSERT to move data can take quite a lot of time and use resources (IO) on both data and log files/disks. It is possible to avoid filling the transaction log with potentially lots of records while working on a big table: Using partition switching, only the metadata is changed.

There is no data movement involved and this is therefore performed really quickly (almost instantaneous).

###Sample table

The question does not show the original table DDL. The following DDL will be used as an example in this answer:

CREATE TABLE dbo.idT(

id int not null

@dvgamerr
dvgamerr / regedit.md
Created February 15, 2018 13:52
regedit editor
Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System
@dvgamerr
dvgamerr / webpack.common.md
Last active February 15, 2018 12:17
How to include Bootstrap 3 using webpack

1. Install dependencies

npm install jquery bootstrap-sass bootstrap-loader css-loader node-sass resolve-url-loader sass-loader style-loader url-loader --save-dev

Note: I'm not sure if all dependencies are indeed necessary. I used dependencies from #215 and added others to get it working for Bootstrap 3.

2. Configure Webpack

@dvgamerr
dvgamerr / networking.md
Last active June 9, 2017 04:09
linux-command

Setup networking

vi /etc/network/interfaces
auto ens160
iface ens160 inet static
address 192.168.0.22
gateway 192.168.0.2
netmask 255.255.255.0