<div dir="ltr">Hi all,<div><br></div><div>I'm playing around with a Firebird database and wanted to know from you DB experts out there how you handle booleans in a table.</div><div><br></div><div>These could be as simple as</div>
<div> ActiveRecord (Y/N)</div><div> AccountTransactionType (I/E) - (Income or Expense)</div><div><br></div><div>That last I would normally think would be "Income (Y/N)" so that would be a boolean too.</div><div>
<br></div><div>My understanding is that this will never be indexed, even if you specifically add an index to it. So how do you handle it. There may be several boolean fields in a table definition.</div><div><br></div><div>
As these tables c an contain several hundred thousand records, this could potentially slow down any query to say total all records last 3 years where Active and Income - as the only index would then be on the date field, there is a possibility that this could potentially be a very slow query.</div>
<div><br></div><div>I've heard of others creating another table to create, say, non-Avtive record ID's, but this one table could have several booleans, therefore creating several new tables (combining then into a single table with the field name would cause the same problem).</div>
<div><br></div><div>Any thoughts?<br clear="all"><div><br>Steve Peacocke<br>Mobile: +64 220 612-611<div><div><a href="http://nz.linkedin.com/pub/steve-peacocke/1/a06/489" target="_blank">Linkedin Professional Profile</a></div>
</div></div>
</div></div>