Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase «««123

Keeping at table lean and highly available Expand / Collapse
Author
Message
Posted Thursday, June 21, 2012 2:01 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Wednesday, August 13, 2014 11:30 AM
Points: 20, Visits: 110
That's a very good point...I appreciate all the input. I'll carefully consider both options and test them out.
Thanks
Post #1319626
Posted Thursday, June 21, 2012 3:18 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 11:44 AM
Points: 6,236, Visits: 7,380
GilaMonster (6/21/2012)
Err....
You don't recreate the partition scheme or function...

The two things you'd do to add a new partition are to mark the next filegroup then add a new partition value to the function.


Sorry, you're right Gail. I'd forgotten to clarify that, thinking that noone would actually rebuild the entire partition. You do need to programatically (usually) decide on the next contruction instead of simply rotating, but yeah, you don't actually completely rebuild the entire table's partitioning.

Kind of embarassed I forgot to include that. Sorry OP.



- Craig Farrell

Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

For better assistance in answering your questions | Forum Netiquette
For index/tuning help, follow these directions. |Tally Tables

Twitter: @AnyWayDBA
Post #1319678
Posted Friday, January 10, 2014 6:27 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, February 7, 2014 4:19 PM
Points: 5, Visits: 5
Lynn Pettis (6/21/2012)
Assuming that you are doing this update in a stored procedure, I would do something more along the lines of this psudo code:

... prep work

set transaction isolation level serializable;
begin transaction
begin try
truncate destination_table;
insert into destination_table;

commit transaction
end try
begin catch
rollback transaction
... other error code as needed
end catch

end -- end of update procedure.

nice tips


customer service skills list hr source consulting human resources internships project proposal template superior staffing
Post #1530010
Posted Saturday, January 11, 2014 2:12 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Yesterday @ 3:51 PM
Points: 36,959, Visits: 31,469
Michael Valentine Jones (6/21/2012)
In conjunction with this, they could have the web application query the table using the snapshot isolation level (or set the database to read committed snapshot) so that the web app will still be able to see the data that was committed before the update transaction started.

That would eliminate even momentary blocking, and be much simple to implement than a partitioned table.



I haven't read the rest of the posts on this thread yet but I agree with the above. Partitioning isn't as easy as some would have you believe. For example, if you have any unique indexes on the table, the partitioning key will automatically be added which makes them {drum roll please} non-unique based on the original unique column(s). It also makes FKs to the table damned near impossible for the same reason unless the only UNIQUE index is also the partitioning column itself.

If the table has no foreign keys and the only UNIQUE index is based on an IDENTITY column, then partitioning gets a whole lot easier but I still like the idea of Michaels suggestion for this particular problem much better.


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1530062
« Prev Topic | Next Topic »

Add to briefcase «««123

Permissions Expand / Collapse