Click here to Skip to main content
15,868,141 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: Ultimate Database Fail Pin
wizardzz1-Mar-11 7:59
wizardzz1-Mar-11 7:59 
GeneralRe: Ultimate Database Fail Pin
AspDotNetDev1-Mar-11 8:35
protectorAspDotNetDev1-Mar-11 8:35 
GeneralRe: Ultimate Database Fail Pin
wizardzz1-Mar-11 8:37
wizardzz1-Mar-11 8:37 
GeneralRe: Ultimate Database Fail Pin
AspDotNetDev3-Mar-11 11:23
protectorAspDotNetDev3-Mar-11 11:23 
GeneralRe: Ultimate Database Fail Pin
Andy Brummer3-Mar-11 10:37
sitebuilderAndy Brummer3-Mar-11 10:37 
GeneralRe: Ultimate Database Fail Pin
AspDotNetDev3-Mar-11 11:22
protectorAspDotNetDev3-Mar-11 11:22 
GeneralRe: Ultimate Database Fail Pin
Andy Brummer3-Mar-11 11:40
sitebuilderAndy Brummer3-Mar-11 11:40 
GeneralRe: Ultimate Database Fail Pin
AspDotNetDev3-Mar-11 12:02
protectorAspDotNetDev3-Mar-11 12:02 
A page is 8KB. That's not going to take long to move around. The time to split a page also averages in the long run to be O(1). Say a page holds 50 records. It may split on a single record insertion, but those other 49 record insertions would not cause a split. The average time per insertion would be O(1).

Now, if SQL sorts data within the page for each insert, that may slow things down a bit, as the entire page would essentially be rewritten each time randomly ordered data got inserted. Not sure exactly how it works at that low of a level. Even in this case, though, SQL should be able to optimize things. For example, if records are inserted in batches, adjacent records need not cause multiple sorts within a page... SQL can figure out the position within the page, and sort all the data at once before writing it to disk. And in the case that many small insertions are peformed, those individual inserts shouldn't take long enough to slow other stuff down. Of course, transaction locks and such could bork things up, but that's a different issue.

GeneralRe: Ultimate Database Fail Pin
Andy Brummer3-Mar-11 12:22
sitebuilderAndy Brummer3-Mar-11 12:22 
GeneralRe: Ultimate Database Fail Pin
AspDotNetDev3-Mar-11 12:51
protectorAspDotNetDev3-Mar-11 12:51 
GeneralRe: Ultimate Database Fail Pin
wizardzz3-Mar-11 11:55
wizardzz3-Mar-11 11:55 
GeneralRe: Ultimate Database Fail Pin
AspDotNetDev3-Mar-11 12:09
protectorAspDotNetDev3-Mar-11 12:09 
GeneralRe: Ultimate Database Fail Pin
Andy Brummer3-Mar-11 12:32
sitebuilderAndy Brummer3-Mar-11 12:32 
GeneralRe: Ultimate Database Fail Pin
wizardzz22-Mar-11 4:35
wizardzz22-Mar-11 4:35 
GeneralStrings: the perfect way to compare numbers. Pin
OriginalGriff27-Feb-11 23:30
mveOriginalGriff27-Feb-11 23:30 
GeneralRe: Strings: the perfect way to compare numbers. Pin
fjdiewornncalwe28-Feb-11 3:25
professionalfjdiewornncalwe28-Feb-11 3:25 
GeneralRe: Strings: the perfect way to compare numbers. Pin
OriginalGriff28-Feb-11 3:30
mveOriginalGriff28-Feb-11 3:30 
GeneralRe: Strings: the perfect way to compare numbers. Pin
fjdiewornncalwe28-Feb-11 8:08
professionalfjdiewornncalwe28-Feb-11 8:08 
GeneralRe: Strings: the perfect way to compare numbers. Pin
OriginalGriff28-Feb-11 8:32
mveOriginalGriff28-Feb-11 8:32 
GeneralRe: Strings: the perfect way to compare numbers. [modified] Pin
musefan1-Mar-11 0:49
musefan1-Mar-11 0:49 
GeneralRe: Strings: the perfect way to compare numbers. Pin
GibbleCH1-Mar-11 4:13
GibbleCH1-Mar-11 4:13 
GeneralRe: Strings: the perfect way to compare numbers. [modified] Pin
musefan1-Mar-11 4:46
musefan1-Mar-11 4:46 
GeneralRe: Strings: the perfect way to compare numbers. Pin
GibbleCH1-Mar-11 5:56
GibbleCH1-Mar-11 5:56 
GeneralRe: Strings: the perfect way to compare numbers. Pin
musefan1-Mar-11 6:17
musefan1-Mar-11 6:17 
GeneralRe: Strings: the perfect way to compare numbers. Pin
_Erik_2-Mar-11 0:27
_Erik_2-Mar-11 0:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.