Avoid using rand() in where clauses

I was working today, building a procedure to populate some tables and do some data updates and deletes, for speed testing for one of my FDD sessions.

I decided to use the built-in rand() function of Firebird 2.x in the where clause of updates and deletes, but found out that the execution time was tooking too long to complete. Looking at statistics, it showed weird numbers for Indexed Reads, like, the updates of 5 records generating 80.000 indexed reads in the Primary Key index.

After some debugging, I just found out that rand() was the guilt! I moved it outside the update/delete statement, storing the result in a variable, and using the variable in the where clause. It worked million times faster!

So, moral of history: Don’t use rand() in the where clause of updates and deletes statements. And yep, I know this is quite unusual use 😉

IDEMA – Are you ready?

SAN JOSE, Calif., June 29, 2010 /PRNewswire via COMTEX/ — IDEMA (The International Disk Drive Equipment and Materials Association) today announced the launch of the “Are You Ready?” campaign, an effort to raise awareness in the computer industry about the advances and advantages of long data sectors. IDEMA is the data-storage industry’s trade association dedicated to driving technology standards that support the advancement of data storage. The campaign focuses on helping the computer industry prepare for the transition of hard disk drive (HDD) processing from the historical sector lengths of 512 to 520 byte increments, to increments of 4,096 bytes per sector using a technology referred to as Advanced Format. IDEMA is joined by major hard disk drive manufacturers in the launch and support of the “Are You Ready?” effort.

Read full history here.

Which opensource database to choose?

Please post your thoughts about firebird on this interesting Linkedin thread on the Firebird community’s page

Which opensource database to choose?
Hi,
I have realized that the “opensource” alternatives to commercial databases / operating system are growing really fast now.
My question to you: experts here are:

  • What benefits will it be to select a firebird SQL database?
  • What market will suit best for firebird SQL Databases?
  • Regards Tomas

    Get to know FB in 2 minutes – now available in 18 languages

    The introductory paper “Get to know Firebird in 2 minutes” is now available in 18 different languages! Thanks for all the translators who contributed.

    Languages: English, Czech, Português Brasil, Polish, German, Turkish, Bosnian, Português Portugal, Spanish, Swedish, French, Italian, Hungarian, Bulgarian, Russian, Japanese, Romanian, Hebrew

    PS: Some of the translations still need to be updated to the newest document revision (1.3).

    1 33 34 35 36 37 84