SlideShare a Scribd company logo
Tips for success    Common mistakes in application development with Firebird and how to avoid them Pavel Císař IBPhoenix Firebird Conference 2011
Agenda Recipes for disaster Mistakes in database design Wrong approaches to handle data
Recipes for disaster “ Agile Knowledge Management” Wrong assumptions Unjustified trust to SW, HW, tools etc. “ Thinking only up to the API” Preferring the way of least resistance No prototyping / No testing
Solution Think, don't just copy! If it walks as duck, squeaks as duck, it could be a beaver in disguise! Don't trust strangers!  ...especially those who offer you candy! You don't know until you verify it, so what you're waiting for?
Database Design Artificial vs. Natural primary keys VARCHAR vs. BLOB Character sets Security
Artificial vs. Natural keys Artificial keys are always better (at the end) ...but there's hidden bloody price... ...the JOIN HELL Users want to see anything else but keys Users use anything but keys for search You have to join tables to get in important columns even it wouldn't be necessary You have to add more indices
Solution Use natural keys for most used “leaf” tables Cache the lookup tables in application Full set for small ones MRU for big ones
VARCHAR & BLOB – The Wrong People decide by feel, not reason Focus on values, not how they're used Oversize just to be safe
VARCHAR vs. BLOB - Solution There is a great guide from Ivan Přenosil http://www.volny.cz/iprenosil/interbase/ip_ib_strings.htm Quick  tips: Anything longer than 150 characters is good candidate for BLOB BLOBs are bad news for search and server-side processing Long VARCHARs are bad news for sorts You can combine several long VARCHARs into single BLOB or refactor them out to 1:1 table More than one BLOB per table is bad idea (Refactor BLOBs out to 1:1 table)
Golden Rule of Database design Get as much rows on single page as you can BIGINT x INTEGER x SMALLINT DATE x TIMESTAMP Non-empty BLOBs are rows too! Pages smaller than 8K are pointless
Character sets Not that big problem today, But still some developers are careless or blindly default to UTF-8
Character sets - Solution Always use one! Consider conversions! What is native data type/encoding for strings your application uses? Minimize number and complexity of conversions:  Database <-> Application <-> Input/Output
Security – The problem Either NO security at all or Extreme security measures
Security - Solution Use as little from  SQL security features  as you can Use remote server with restricted access Your application is exclusive gateway to the database Use OWNER account (block SYSDBA if you want) Implement fine-grained security in your application
Handling data – The wrong “ When I did this in ISQL, Flamerobin, my other app etc., it worked just fine, so what's wrong now?” “ It worked just fine on my development machine, so why it fails in production?” “ Damn, it doesn't scale as I expected...”
Handling data 101 Get intimate with your connectivity library! Always manage your transactions manually! Always mind the MGA! Never fetch more data than you actually need! One size doesn't fit all: Interactive vs. Machine processing Native vs. Web applications Embedded vs. Department vs. Corporate
Know your connectivity Identify higher and lower level access paths Learn the steps the access paths use Path complexity Data conversions Storage requirements Algorithm efficiency Points of failure
Transactions Interactive All data read in single transaction READ_ONLY READ_COMMITTED Writes in separate R/W transaction Machine processing R/W in single SNAPSHOT or READ_COMMITTED No UNDO log Long running “monitoring” transactions READ_ONLY READ_COMMITTED
MGA Implications Long running transactions block GC Inserts never block other users, update and delete may block Changes create garbage Correlating inserts with update/delete is VERY bad idea Mass update/delete burdens you with GC
Minimizing data transfers Interactive Less rows Less columns, fetch the rest on demand Cache lookups on client Machine processing Do as much on the server as you can
Beware the “One code to rule them all” Except the simplest cases, there is direct proportionality between universality and direct cost Universal code that doesn't have an option to cop-out on special case to user code is recipe for disaster
Questions? Pavel Císař [email_address] IBPhoenix www.ibphoenix.com

More Related Content

PDF
Pavel Nikolov: Inspire
PDF
HREFLANG for International SEO: Lessons from 3,000 Implementations
PDF
Dark side of JS development framework
PPT
ОПРЕДЕЛЕНИЕ КОЭФФИЦИЕНТОВ МЕСТНЫХ СОПРОТИВЛЕНИЙ ВНУТРЕННИХ ВОДОПРОВОД...
PPT
полипртруб
PPSX
Hλεκτρική Ενέργεια Γ Γυμνασίου
PDF
Why be part of the Clariba Experience?
PPTX
Dům,který mě neokrádá 7
Pavel Nikolov: Inspire
HREFLANG for International SEO: Lessons from 3,000 Implementations
Dark side of JS development framework
ОПРЕДЕЛЕНИЕ КОЭФФИЦИЕНТОВ МЕСТНЫХ СОПРОТИВЛЕНИЙ ВНУТРЕННИХ ВОДОПРОВОД...
полипртруб
Hλεκτρική Ενέργεια Γ Γυμνασίου
Why be part of the Clariba Experience?
Dům,který mě neokrádá 7

Similar to Tips for success: Common mistakes in application development with Firebird and how to avoid them (20)

PDF
Five steps perform_2013
PPTX
Performance By Design
PDF
Speed up sql
PPT
15 Ways to Kill Your Mysql Application Performance
PPT
What Are We Still Doing Wrong
PPT
PSU Guest Lecture: Database Programming
PDF
CMF: a pain in the F @ PHPDay 05-14-2011
PPTX
Sql server infernals
PDF
5 Steps to PostgreSQL Performance
PDF
Five steps perform_2009 (1)
PDF
10 sql tips to speed up your database cats whocode.com
PDF
PostgreSQL worst practices, version FOSDEM PGDay 2017 by Ilya Kosmodemiansky
DOCX
Mohan Testing
PDF
Kill mysql-performance
PPTX
Developing Better Software
PPTX
SQL Server 2012 Best Practices
PPT
Database layer in php
PDF
Growing up new PostgreSQL developers (pgcon.org 2018)
PPT
Unit08 dbms
PPT
Apache Con 2008 Top 10 Mistakes
Five steps perform_2013
Performance By Design
Speed up sql
15 Ways to Kill Your Mysql Application Performance
What Are We Still Doing Wrong
PSU Guest Lecture: Database Programming
CMF: a pain in the F @ PHPDay 05-14-2011
Sql server infernals
5 Steps to PostgreSQL Performance
Five steps perform_2009 (1)
10 sql tips to speed up your database cats whocode.com
PostgreSQL worst practices, version FOSDEM PGDay 2017 by Ilya Kosmodemiansky
Mohan Testing
Kill mysql-performance
Developing Better Software
SQL Server 2012 Best Practices
Database layer in php
Growing up new PostgreSQL developers (pgcon.org 2018)
Unit08 dbms
Apache Con 2008 Top 10 Mistakes
Ad

More from Mind The Firebird (20)

ODP
Tips for using Firebird system tables
PDF
Using Azure cloud and Firebird to develop applications easily
PDF
A year in the life of Firebird .Net provider
ODP
How Firebird transactions work
PDF
SuperServer in Firebird 3
ODP
Copycat presentation
ODP
Using ТРСС to study Firebird performance
ODP
Overview of RedDatabase 2.5
PDF
Creating logs for data auditing in FirebirdSQL
ODP
Firebird Performance counters in details
PDF
Understanding Numbers in Firebird SQL
PPTX
Threading through InterBase, Firebird, and beyond
PDF
New SQL Features in Firebird 3, by Vlad Khorsun
PPTX
Orphans, Corruption, Careful Write, and Logging
ODP
Firebird release strategy and roadmap for 2015/2016
PPTX
Nbackup and Backup: Internals, Usage strategy and Pitfalls, by Dmitry Kuzmenk...
PDF
Working with Large Firebird databases
PDF
Stored procedures in Firebird
PDF
Firebird on Linux
PPTX
Superchaging big production systems on Firebird: transactions, garbage, maint...
Tips for using Firebird system tables
Using Azure cloud and Firebird to develop applications easily
A year in the life of Firebird .Net provider
How Firebird transactions work
SuperServer in Firebird 3
Copycat presentation
Using ТРСС to study Firebird performance
Overview of RedDatabase 2.5
Creating logs for data auditing in FirebirdSQL
Firebird Performance counters in details
Understanding Numbers in Firebird SQL
Threading through InterBase, Firebird, and beyond
New SQL Features in Firebird 3, by Vlad Khorsun
Orphans, Corruption, Careful Write, and Logging
Firebird release strategy and roadmap for 2015/2016
Nbackup and Backup: Internals, Usage strategy and Pitfalls, by Dmitry Kuzmenk...
Working with Large Firebird databases
Stored procedures in Firebird
Firebird on Linux
Superchaging big production systems on Firebird: transactions, garbage, maint...
Ad

Recently uploaded (20)

PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
Machine Learning_overview_presentation.pptx
PPTX
A Presentation on Artificial Intelligence
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Big Data Technologies - Introduction.pptx
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Approach and Philosophy of On baking technology
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Machine learning based COVID-19 study performance prediction
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PPTX
Cloud computing and distributed systems.
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
A comparative analysis of optical character recognition models for extracting...
Spectral efficient network and resource selection model in 5G networks
Machine Learning_overview_presentation.pptx
A Presentation on Artificial Intelligence
Review of recent advances in non-invasive hemoglobin estimation
“AI and Expert System Decision Support & Business Intelligence Systems”
The Rise and Fall of 3GPP – Time for a Sabbatical?
Big Data Technologies - Introduction.pptx
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Approach and Philosophy of On baking technology
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Machine learning based COVID-19 study performance prediction
20250228 LYD VKU AI Blended-Learning.pptx
Unlocking AI with Model Context Protocol (MCP)
Assigned Numbers - 2025 - Bluetooth® Document
Cloud computing and distributed systems.
Mobile App Security Testing_ A Comprehensive Guide.pdf
sap open course for s4hana steps from ECC to s4
Building Integrated photovoltaic BIPV_UPV.pdf
gpt5_lecture_notes_comprehensive_20250812015547.pdf
A comparative analysis of optical character recognition models for extracting...

Tips for success: Common mistakes in application development with Firebird and how to avoid them

  • 1. Tips for success Common mistakes in application development with Firebird and how to avoid them Pavel Císař IBPhoenix Firebird Conference 2011
  • 2. Agenda Recipes for disaster Mistakes in database design Wrong approaches to handle data
  • 3. Recipes for disaster “ Agile Knowledge Management” Wrong assumptions Unjustified trust to SW, HW, tools etc. “ Thinking only up to the API” Preferring the way of least resistance No prototyping / No testing
  • 4. Solution Think, don't just copy! If it walks as duck, squeaks as duck, it could be a beaver in disguise! Don't trust strangers! ...especially those who offer you candy! You don't know until you verify it, so what you're waiting for?
  • 5. Database Design Artificial vs. Natural primary keys VARCHAR vs. BLOB Character sets Security
  • 6. Artificial vs. Natural keys Artificial keys are always better (at the end) ...but there's hidden bloody price... ...the JOIN HELL Users want to see anything else but keys Users use anything but keys for search You have to join tables to get in important columns even it wouldn't be necessary You have to add more indices
  • 7. Solution Use natural keys for most used “leaf” tables Cache the lookup tables in application Full set for small ones MRU for big ones
  • 8. VARCHAR & BLOB – The Wrong People decide by feel, not reason Focus on values, not how they're used Oversize just to be safe
  • 9. VARCHAR vs. BLOB - Solution There is a great guide from Ivan Přenosil http://www.volny.cz/iprenosil/interbase/ip_ib_strings.htm Quick tips: Anything longer than 150 characters is good candidate for BLOB BLOBs are bad news for search and server-side processing Long VARCHARs are bad news for sorts You can combine several long VARCHARs into single BLOB or refactor them out to 1:1 table More than one BLOB per table is bad idea (Refactor BLOBs out to 1:1 table)
  • 10. Golden Rule of Database design Get as much rows on single page as you can BIGINT x INTEGER x SMALLINT DATE x TIMESTAMP Non-empty BLOBs are rows too! Pages smaller than 8K are pointless
  • 11. Character sets Not that big problem today, But still some developers are careless or blindly default to UTF-8
  • 12. Character sets - Solution Always use one! Consider conversions! What is native data type/encoding for strings your application uses? Minimize number and complexity of conversions: Database <-> Application <-> Input/Output
  • 13. Security – The problem Either NO security at all or Extreme security measures
  • 14. Security - Solution Use as little from SQL security features as you can Use remote server with restricted access Your application is exclusive gateway to the database Use OWNER account (block SYSDBA if you want) Implement fine-grained security in your application
  • 15. Handling data – The wrong “ When I did this in ISQL, Flamerobin, my other app etc., it worked just fine, so what's wrong now?” “ It worked just fine on my development machine, so why it fails in production?” “ Damn, it doesn't scale as I expected...”
  • 16. Handling data 101 Get intimate with your connectivity library! Always manage your transactions manually! Always mind the MGA! Never fetch more data than you actually need! One size doesn't fit all: Interactive vs. Machine processing Native vs. Web applications Embedded vs. Department vs. Corporate
  • 17. Know your connectivity Identify higher and lower level access paths Learn the steps the access paths use Path complexity Data conversions Storage requirements Algorithm efficiency Points of failure
  • 18. Transactions Interactive All data read in single transaction READ_ONLY READ_COMMITTED Writes in separate R/W transaction Machine processing R/W in single SNAPSHOT or READ_COMMITTED No UNDO log Long running “monitoring” transactions READ_ONLY READ_COMMITTED
  • 19. MGA Implications Long running transactions block GC Inserts never block other users, update and delete may block Changes create garbage Correlating inserts with update/delete is VERY bad idea Mass update/delete burdens you with GC
  • 20. Minimizing data transfers Interactive Less rows Less columns, fetch the rest on demand Cache lookups on client Machine processing Do as much on the server as you can
  • 21. Beware the “One code to rule them all” Except the simplest cases, there is direct proportionality between universality and direct cost Universal code that doesn't have an option to cop-out on special case to user code is recipe for disaster
  • 22. Questions? Pavel Císař [email_address] IBPhoenix www.ibphoenix.com