Support ticket system – when/how to move old tickets

archivedatabase-designoracleoracle-11g

I don't have access to the partitioning feature, but consider a support ticket system with tens of thousands of tickets being opened everyday and taking about a week to a couple of months in getting resolved. Obviously, if I tried to keep them all in one table ever since the beginning, the table would become HUGE.

My questions are:

  1. Once a ticket gets resolved, should I move it out of the original table; or
  2. Should I just move resolved tickets out of the original table after they are 90 months old; or
  3. Should I move everything whether resolved or unresolved into another table after 90 months and do some kind of UNION every time unresolved queries are sought?

Best Answer

What is the problem with the table becoming large? Generally, any sort of OLTP query will access the table using an appropriate index in which case the size of the table is more or less irrelevant. The cost of using an index will grow at an O(log(n)) rate-- practically, a b*-tree index will only add one or two levels for any realistically sized table. And you can potentially limit that further by using function-based indexes to limit the size of the index by doing things like only indexing the active rows.

The only queries that should care about the size of the table are queries where you want to do a full scan on the table in order to do things like produce metrics about how many tickets have been opened since the beginning of time (or, at least, over a significant fraction of history). If you are concerned about those sorts of reporting queries, you can do things like use materialized views to pre-aggregate the data.

Normally, I would suggest keeping a single table and ensuring that appropriate indexes and/or materialized views exist to support the queries about whose performance you are concerned.