The Ticket Table#
The ticket table is the starting point for almost every report. This page explains every column with a focus on what it means for queries and aggregations.
Column Reference#
Identity#
Column |
Type |
Description |
|---|---|---|
|
BIGINT |
Internal numeric primary key. Use this for joins (e.g. to |
|
VARCHAR(50) |
The human-readable ticket number shown in the UI (e.g. |
|
VARCHAR(255) |
The ticket subject/title. |
Classification#
Column |
Type |
Description |
|---|---|---|
|
INTEGER |
The queue currently owning this ticket. Joins to |
|
SMALLINT |
Whether the ticket is locked. |
|
SMALLINT |
Ticket type (e.g. Incident, Request). NULL if types are not enabled. Joins to |
|
INTEGER |
Associated service. NULL if not set. Joins to |
|
INTEGER |
Associated SLA. NULL if not set. Joins to |
|
SMALLINT |
Priority. Joins to |
|
SMALLINT |
Current state (open, closed, pending…). Joins to |
People#
Column |
Type |
Description |
|---|---|---|
|
INTEGER |
The agent currently assigned as owner. Joins to |
|
INTEGER |
The agent responsible for the ticket (may differ from owner). Joins to |
|
VARCHAR(150) |
The customer organization. Joins to |
|
VARCHAR(250) |
The customer contact’s login name. Joins to |
Timing#
Column |
Type |
Description |
|---|---|---|
|
INTEGER |
Unix epoch of when the lock will automatically release. |
|
INTEGER |
Unix epoch of the pending-until time for pending states. |
|
INTEGER |
Unix epoch of the nearest upcoming escalation (whichever of the three escalation clocks fires first). |
|
INTEGER |
Unix epoch of the first-response escalation deadline. |
|
INTEGER |
Unix epoch of the update escalation deadline. |
|
INTEGER |
Unix epoch of the solution escalation deadline. |
Tip
All four escalation columns store Unix epoch seconds. Use FROM_UNIXTIME() to convert to a readable datetime, or compare directly to UNIX_TIMESTAMP(NOW()) to find currently-escalated tickets:
SELECT tn, title, FROM_UNIXTIME(escalation_time) AS escalates_at
FROM ticket
WHERE escalation_time > 0
AND escalation_time < UNIX_TIMESTAMP(NOW())
AND archive_flag = 0;
Archive and Audit#
Column |
Type |
Description |
|---|---|---|
|
SMALLINT |
|
|
DATETIME |
When the ticket was created. |
|
INTEGER |
Agent who created the ticket. Joins to |
|
DATETIME |
When the ticket was last modified. |
|
INTEGER |
Agent who last modified the ticket. Joins to |
Common Filters#
-- Active tickets only (exclude archive)
WHERE archive_flag = 0
-- Tickets created in the last 30 days
WHERE create_time >= DATE_SUB(NOW(), INTERVAL 30 DAY)
-- Currently escalated tickets
WHERE escalation_time > 0
AND escalation_time < UNIX_TIMESTAMP(NOW())
-- Pending tickets with a future reminder
WHERE until_time > 0
AND until_time > UNIX_TIMESTAMP(NOW())