Showing posts with label various. Show all posts
Showing posts with label various. Show all posts

Monday, March 19, 2012

Differential Backups: Pages or Extents?

Hi All,

Does a diff backup (on either 2000 or 2005) backup only the changed pages or extents?

There are various solid sources that provide conflicting info.

Thanks

Rob

Differential backup creates copy of all the pages in a database after the last backup operation.

as for my understanding , the data is stored in pages and each page size is 8 KB and an extent is a collection of contiguous 8 pages. so some pages in the extents might be left blank or unused.so my understanding is it takes pages in differential backup.

please let me knw if you find the correct solution

Thanks

Madhu

|||

Rob, I agree with Madhu that differential backup backup the changed pages.
Vincent

|||

Actually we always backup at the granularity of an extent (8 pages).

But you are partially correct: it is the change to an individual page that marks an extent for backup.

Cheers

|||Thank you for correcting us, Steve.
Vincent

Wednesday, March 7, 2012

Different Results With View Versus UDF

I have two views, for various reasons I decided to wrap a Select * From View with two UDFs. When run on their own, the UDFs return the exact same resultset as their respective view (did a compare and stuff to make sure). However, when I join them together, what was once 130,000 records (when joining the views) skyrockets into millions of records, and the resulting resultset is filled with duplicates. What is going on?Firstly I would use a stored procedure to return result sets, not UDF's. Secondly, it looks like you are getting a cartesian join, where every row in one table joins to many or every row in the other table. This is caused by incorrectly joining the two table (or views). This is illustrated by the duplicate rows you are getting. Check your joins, and make sure you join primary key to foreign key. To test the query, change the select list to a select count(*), and then run the query with just the first join condition. Then add each condition one by one. At some point the rowcount will explode. However, if the first join produces a massive row count, experiment with adding additional joins until you get the correct amount of records returned.

HTH

For more SQL tips, check out my blog:|||The exact same join with the exact same conditions using the views (which return an identical result set) returns the proper result.|||that's weird, you could have been executing a cross join|||You will have to post a repro script to demonstrate the problem. Otherwise it will be hard to guess what might be wrong. Your SELECT statement could be incorrect, the UDF could be wrong and so on.