Minor: the legacy `text` layout column is loaded on every page view alongside `content` - Forum | JoomShaper
Staff replied SP Page Builder Joomla 5 v6.9.1

Minor: the legacy `text` layout column is loaded on every page view alongside `content`

Asked by HalTurner 1 day ago Last activity 14 hours ago

Environment

  • SP Page Builder Pro 6.9.1
  • Joomla 5.4.9, PHP 8.3, MySQL 8.4
  • Site upgraded over several SP Page Builder major versions

The problem

Each row in #__sppagebuilder carries two copies of a page's layout:

  • content: the current layout JSON
  • text: an older layout format kept from earlier versions

On our homepage the two are different layouts: content is ~135 KB with 13 sections and is what actually renders; text is ~62 KB with an older 9-section version of the page.

Where the legacy column is still read for nothing:

  • Page view: components/com_sppagebuilder/models/page.php, getItem(), selects the whole row (a.*, so both content and text) and then immediately overwrites $data->text with $data->content when content is not empty. The legacy text value is read from the database and discarded on every page view.
  • Hit counter: models/page.php, hit(), calls $table->load($pk), which loads the entire row a second time (both layouts and the CSS) just to increment hits (see our separate hit-counter report).
  • Articles addon: the per-article layout lookup in helpers/articles.php selects content, text and css for each listed article.

That means every view of our homepage reads ~62 KB of layout data that is never used, and the full ~193 KB row twice. Every page and article on sites upgraded from older versions likely carries a stale text copy too.

Suggested fix

  1. Load only what's needed: select content (and css) explicitly instead of a.*, and read text only as a fallback when content is empty (i.e. for layouts that were never migrated). Don't reload the full row in hit().
  2. Finish the migration: once a row has a valid content layout, clear or archive its legacy text value (for example in an update script, or the next time the page is saved in the editor), so stale copies don't linger and can't be confused with the live layout.
  3. Optionally, show in the editor or page list when a page still relies on the legacy text format.

Impact

Small per request, but it's paid on every page view, and per listed article in Articles blocks, so it adds up on busy sites. It also removes the confusion of having two different versions of the same page stored side by side.

1 reply

Mehtaz Afsana Borsha Staff

Hi,

Thank you for the detailed investigation and for sharing your findings.

You’ve raised some valid points regarding the redundant loading of legacy layout data, particularly on websites upgraded from older SP Page Builder versions.

We agree that optimizing database queries to retrieve only the necessary fields could help reduce unnecessary data processing. The additional full-row loading during hit counting is also worth reviewing.

Regarding the legacy text column, we need to be cautious about removing or clearing its contents, as it may still be required for backward compatibility with older layouts or certain workflows. Any cleanup would need proper compatibility checks to avoid affecting existing websites.

We appreciate your suggested improvements and will share these findings with our development team for further review and consideration in future updates.

Thank you again for taking the time to investigate and document this so thoroughly.

-Regards.

Log in to reply.