• /BG. (unregistered)
    • about dynamically created table names [...]
  • Andy in Derby (unregistered)

    I remember the day when after finnishing my java project and having a few weeks before the next java project kicked off my boss said 'In the mean time can you convert or old Delphi 1.0 code over to Delphi 6 please' It sounded oh so simple at the time. After getting my hands on the code it was a mess, year upon year of fix meant that some files contain classes of a different name which were duplicated across other files with unrelated names. Methods were in classes of completely unrelated relavance and funtionality, some methods were replicated dozens of times all with slightly different implemenations. Which method ran depended on the order that they were imorted and removing what looked like redundat versions resulted in system faults. What a nightmare :(

  • RPG (unregistered)

    A few years ago i worked for a payroll company. They had one big 10.000 lines more then 300 pages compiler listing doing all the calculations program. (there was only one free lance programmer who was able to do maintance to this program. His contract was ended) Of course there was no documention fo this program.

    When you had the evil mind to change some code the program strikes back with  the most horrible errors.

    Some time i wake-up in the middle of the screaming for mercy.  

     

     

  • Adriaan Renting (unregistered) in reply to xix
    Anonymous:
    I thought maybe the Tantalus reference was one about a book I had many many years ago, called, if I recall, the Tasks of Tantalus, which was a kids puzzle book, sort of like The Egyptian Jukebox, sorta.  Anyway, I can't really find a reference online anymore about it, so I might have imagined it.
    I have the same book so you didn't imagine it. But there's also a guy from Greek mythology who is being tortured for eternity, by the same name.
  • (cs) in reply to JamesCurran
    JamesCurran:

    A MS SQL Server "Custered Index" does in fact order the phyisical table data to the order of the index.

    However, I do not believe the Enterprise Manager automatically creates a clustered index for a primary key (Unfortunately, I don't have MSSQL install on the PC to test it out).

    And, a clustered index on the primary key will only give you a performance gain over having no index at all.  A standard index would almost always be faster, particular on tables with a large row size and a small key size (It would require one additional disk read to get the actual data, but it would have had to look through far less data to find the record).   Clustered indexes are most useful, not on PK fields (where you'd usually be looking for a single record), but on fields where you'd be seeking a range of values (like date/time fields).  In fact, the best place to use them (assuming that you'd need to lookup on this field) is on the RowCreatedDate field (since all new records would automatically go to the end, there would never be a need to reorder the data, which is the chief problem with clustered indexes)

    By default, primary keys in MS SQL are clustered.  To create them without a clustered index on them, you have to specify "nonclustered", as in:

    create table Accounts (
    Account int identity primary key nonclustered,
    Name varchar(100)...

    If you don't, the data will be stored on the disk in the sequence of the primary key.  In the case of an identity primary key, that will give you fast insert performance (which is advantageous in tables where inserts are more common than group selects).  It will also give you fast selects if you are selecting either a single row by primary key, or a range of rows selected by a range of primary key values, but you can achieve the same with a normal index on your primary key (which it automatically has, even if it's nonclustered).

    If, on the other hand, you want to select from that Accounts table by alphabetical order on the Name column, the select will be slower (unless you have a separate index on that column, which will slow down inserts, of course).

    The rules I use: on primary tables, set the clustered index on the field you will most often sort by (that speeds up Order By statements significantly) or select by (if sorting is low importance); on subtables, set the clustered index on the most important foreign key (that will speed up joins significantly); on log tables, set the clustered index on the primary key and make the primary key an identity field, since that will speed up inserts significantly.  I get good performance that way.

  • Garrett Smith (unregistered)

    I don't think this qualifies as a WTF.

    I'd common practice to include a small table and use select * from dummy as a 'functional ping' -- to test whether you can connect to and use the DB.

     For example, it is used to see if a pooled DB connection is alive or not.

  • ChiefCrazyTalk (unregistered) in reply to rmr

    rmr:
    So what was it actually using "_dummy" for?  We need more details here.

    sounds like it was an ex-Oracle programmer who set that up, who was used to SELECTing from DUAL when you needed a value (like sysdate)  but didnt care about an underlying table.

  • (cs) in reply to themagni
    themagni:

    oh for farks sake

    It's a delay? Calls to that table are delays?

    What does this code do, summon Cthulhu? 

    <font size="-1">Sounds more like bringing in the Lords of Chaos</font>.

  • (cs)
    Anonymous:

    Could _dummy table be use as something like this? http://www.sqlteam.com/item.asp?ItemID=2652

    Holy crap, that link should be tomorrow's WTF.

     

    stupid web site:

    (A loop within another loop...I'm getting queasy)

    WTF? I guess this guy never wrote any O(n^2) code before. So instead of writing a nested loop, he creates a "tally table" and an obscene, 6-line "INSERT INTO table SELECT STATEMENT FROM HELL GROUP BY LEVEL OF HELL..." statement?

     He fails to even solve the original purpose, which is to insert CSV. He is only handling a subset of CSV -- What if I want to insert "Company, Inc." into a company_name column? Algorithm fails, please come again.

  • (cs)
    Anonymous:

    Could _dummy table be use as something like this? http://www.sqlteam.com/item.asp?ItemID=2652

    Holy crap, that link should be tomorrow's WTF.

     

    stupid web site:

    (A loop within another loop...I'm getting queasy)

    WTF? I guess this guy never wrote any O(n^2) code before. So instead of writing a nested loop, he creates a "tally table" and an obscene, 6-line "INSERT INTO table SELECT STATEMENT FROM HELL GROUP BY LEVEL OF HELL..." statement?

     He fails to even solve the original purpose, which is to insert CSV. He is only handling a subset of CSV -- What if I want to insert "Company, Inc." into a company_name column? Algorithm fails, please come again.

  • Don miguel (unregistered) in reply to Gary

    size = size * 1.0;

    Well, I'm still writting code like this when I want to cast an integer data type to a decimal one (of course, in languages which support this kind of data conversion, from a stricter type to a larger one to accomodate a result...)  !!

    :-))

Leave a comment on “Crash Test _dummy”

Log In or post as a guest

Replying to comment #:

« Return to Article