SQL Joomla! 6 Joomla! 5 Joomla! 4 Database Basic

Prune Expired Sessions and Unlock Checked-Out Articles via SQL

Deletes stale sessions from #__session and clears abandoned article checkouts (checked_out) safely with NULL timestamps.

Updated on 24 November 2026 32 copies 119 views
sql/maintenance_sessions_checkin.sql
-- Remove sessões de visitantes com mais de 24 horas
DELETE FROM `#__session`
WHERE guest = 1
  AND time < UNIX_TIMESTAMP(NOW() - INTERVAL 1 DAY);

-- Desbloqueia artigos travados em edição há mais de 2 horas
UPDATE `#__content`
SET checked_out = NULL,
    checked_out_time = NULL
WHERE checked_out IS NOT NULL
  AND checked_out_time < (NOW() - INTERVAL 2 HOUR);
Joomla 4, 5 and 6 use NULL for cleared checked_out columns (never zero dates).

Technical explanation and best practices

Handy during emergency maintenance when a high-traffic site accumulates orphan sessions or locked articles left open by editors.

Direct Engineering

Have a Joomla project or technical challenge in mind?

From architectural diagnosis to production deployment, directly with the engineer.