Performance implications of adding a "disabled" column to a table

From: Seref Arikan <serefarikan(at)kurumsalteknoloji(dot)com>
To: PG-General Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: Performance implications of adding a "disabled" column to a table
Date: 2012-08-30 16:48:12
Message-ID: CA+4ThdrBu7HrBq6aK2t-5yMu9gQYJRBj2LosHya_MYfk+HBEtg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Greetings,
I have a large number of rows (up to 3-4 millions) that I'll either be
fetching into ram (if it is a few thousand rows), or scrolling through a
cursor.
Deletions or updates on content of these rows lead to expensive operations
in my business logic, so I simply need to mark them as disabled.
I have two options here: to exclude the disabled rows from my query results
via ..where not disabled or to not to process disabled rows in business
logic.
There will be very few disabled rows compared to total rows I'll have to
return. This table will have very few queries, so including disabled =
false or enabled = true in every query would not be an issue

I have a feeling that including this criteria in the queries may add
unnecessary processing to my queries, since the table is expected to get up
to 100 million or more rows. So should I deal with this in DB, or at the
application layer?

Kind regards
Seref

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Johnston 2012-08-30 19:09:31 Re: Performance implications of adding a "disabled" column to a table
Previous Message Chris Travers 2012-08-30 15:51:29 Baffling behavior regarding tables as types