Coder Social home page Coder Social logo

dmnk28 / sql_tablepartitioner Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 20 KB

WORK IN PROGRESS: These Procedures are made to move tables with already existing data to different filegroups/files in a convenient way.

License: MIT License

TSQL 100.00%
partitioning tsql sql-cursor tsql-stored-procedures

sql_tablepartitioner's Introduction

TSQL Partitioning and Restructuring Procedures

⚠️ Work in Progress !

These Procedures are made to move tables with already existing data to different filegroups/files in a convenient way. The core idea is to move the table logicaly and (depenending on your filegroup physicaly as well) by creating an clustered index for the table. For this Idea I thank my SQL-Teacher Mr. Frank Mewes from the iad GmbH. To make this trick even more usefull for already existing datatables which may already have (clustered) primary keys or foreign keys referncing them, I implemented the cursor logic you'll find in the procedures. Feel free to adjust and optimize the procedures before creating them.

⚠️ !Please mind that correlating to the size of your table you want to move the procedure could hold xlocks for a pretty long time!

moveToDatagroupByClustering Procedure

This procedure allows to move your table and data to a filegroup of your choice. Therefore it first disables foreign and existing (clustered) primary keys and uses create clustered index ... on @filegroup to move the table and its content.

Please pass it the following parameters:

  • @table = The table you want to move
  • @filegroup = The Filegroup you have prepared already (mind to add at least one file to the filegroup before executing the procedure)
  • @columnstore = This is optional. If you would like to use an columstore index in the long run

ToDos

  • Columnstore Option mit if (@columnstore) else einbinden
  • Partitionierungsprocedur schreiben
  • README Schreiben

sql_tablepartitioner's People

Contributors

dmnk28 avatar

Watchers

 avatar  avatar

sql_tablepartitioner's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.