Ternary Search uses the principle of Divide And Conquer.

It is similar to Binary Search Algorithm. But here, we divide the sub-array into three parts rather than two parts. For this, we use two middle values mid1 and mid2.

mid1 = low + ( ( high - low ) / 3 )
mid2 = high – ( ( high - low ) / 3 )

where, low is the index of starting element of the sub-array to be searched, high is the index of last element of that sub-array.

After finding the values of mid1 and mid2, we compare key with the values of input_array[mid1] and input_array[mid2].

  • If key == input_array[mid1], key is found at position mid1 of input_array.
  • If key == input_array[mid2], key is found at position mid2 of input_array.
  • If key < input_array[mid1], we need to search the key in the first part of the sub-array. So, high = mid1 - 1. Now the sub-array ends at mid1-1.
  • If key > input_array[mid2], we need to search the key in the third part of the sub-array. So, low = mid2 + 1. Now the sub-array starts from mid2+1.
  • If input_array[mid1] < key < input_array[mid2], we need to search the key in the second part of the sub-array. So, low = mid1 + 1 and high = mid2 - 1. Now the sub-array starts at mid1+1 and ends at mid2-1.

Note : At each stage, the sub-array is reduced to one third of its length.

In this way, during each stage we check the possible range in which the key can lie in the sub-array and minimize the sub-array.

Let us look at ternary search with an example:

Let input_array = {12,18,23,25,29,32,35,40,58,66} and key = 23

      Screenshot 83

Advantage of Ternary Search:

During each comparison, 66% of the elements are eliminated from the sub-array.

Disadvantage of binary search:

This algorithm does not work if the input_array is not in sorted order.

Time Complexity : O(log3N)
Space Complexity : O(1)

Ternary Search is efficient than Binary Search and Linear Search in terms of its Time Complexity.

C++ CODE FOR TERNARY SEARCH:

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int N,i,low,mid1,mid2,high,key,position=-1;
    cout << "Enter the length of array" << endl;
    cin >> N; // Taking length of array as input
    int input_array[N];
    cout << "Enter array elements in increasing order" << endl;
    for(i=0;i<N;i++) // loop to take array elements as input
    {
        cin >> input_array[i];
    }
    cout << "Enter the element to be searched" << endl;
    cin >> key; // taking key as input
    low=0; // initialising low to 0 because initially sub-array is the input_array
    high=N-1; // initialising high to N-1 because initially sub-array is the input_array
    while(low<=high) // the index of first element of sub-array is always less than or equal to the index of last element of sub-array
    {
        mid1 = low + (high - low)/3; // finding the value of mid1
        mid2 = high - (high - low)/3; // finding the value of mid2
        if(key==input_array[mid1]) // checking if key is equal to the array element at mid1
        {
            position = mid1; // if yes, storing the value of mid1 and stopping the search
            break;
        }
        else if(key==input_array[mid2]) // checking if key is equal to the array element at mid2
        {
            position = mid2; // if yes, storing the value of mid2 and stopping the search
            break;
        }
        else if(key < input_array[mid1]) // checking if key is less than array element at mid1
        {
            high = mid1 - 1; // if yes, sub-array ends at mid1-1
        }
        else if(key > input_array[mid2]) // checking if key is greater than array element at mid2
        {
            low = mid2 + 1; // if yes, sub-array starts from mid2+1
        }
        else
        {
            /* if the value of key is greater than array element at mid1 and less than array element at mid2, 
            sub-array starts at mid1+1 and ends at mid2-1 */
            low = mid1 + 1;
            high = mid2 - 1;
        }
    }
    if(position >= 0) // checking if position is greater or equal to zero
    {
        cout << "key found at index " << position << endl; // if yes, key is found at index position of input_array
    }
    else // if not, key is not found in input_array
    {
        cout << "key is not found in the array" << endl;
    }
    return 0;
}

 TESTCASE :

Enter the length of array
5
Enter array elements in increasing order
14 35 67 89 90
Enter the element to be searched
67
key found at index 2
6MBMemory Usage288msRequest Duration
Joomla! Version4.2.5
PHP Version7.4.33
Identityguest
Response200
Templateg5_helium
Database
Server
mysql
Version
5.7.23-23
Collation
utf8_unicode_ci
Conn Collation
utf8mb4_general_ci
$_GET
[]
$_POST
[]
$_SESSION
[]
$_COOKIE
[]
$_SERVER
array:87 [ "LSPHP_ENABLE_USER_INI" => "on" "PATH" => "/usr/local/bin:/usr/bin:/bin" "TEMP" => ...
session
array:3 [ "counter" => 1 "timer" => array:3 [ "start" => 1744043201 "last" => 1744043201...
registry
array:3 [ "data" => [] "initialized" => false "separator" => "." ]
user
array:18 [ "id" => 0 "name" => null "username" => null "email" => null "password" => "***r...
PHPDEBUGBAR_STACK_DATA
[]
  • afterLoad (552.78KB) (5.06ms)
  • afterInitialise (1.5MB) (46.17ms)
  • afterRoute (825.97KB) (22.05ms)
  • beforeRenderComponent com_content (139.59KB) (3.68ms)
  • Before Access::preloadComponents (all components) (55.55KB) (1.16ms)
  • After Access::preloadComponents (all components) (121KB) (1.62ms)
  • Before Access::preloadPermissions (com_content) (3.88KB) (18μs)
  • After Access::preloadPermissions (com_content) (256.8KB) (1.63ms)
  • Before Access::getAssetRules (id:1171 name:com_content.article.407) (18.8KB) (28μs)
  • After Access::getAssetRules (id:1171 name:com_content.article.407) (8.66KB) (180μs)
  • afterRenderComponent com_content (586.06KB) (79.31ms)
  • afterDispatch (2.25KB) (132μs)
  • beforeRenderRawModule mod_search (Search) (1.09MB) (21.77ms)
  • afterRenderRawModule mod_search (Search) (292.37KB) (8.56ms)
  • beforeRenderModule mod_search (Search) (704B) (12μs)
  • afterRenderModule mod_search (Search) (3.43KB) (194μs)
  • beforeRenderRawModule mod_articles_latest (Competitive Programming) (47.65KB) (2ms)
  • Before Access::getAssetRules (id:8 name:com_content) (119.03KB) (1.03ms)
  • After Access::getAssetRules (id:8 name:com_content) (1.59KB) (14μs)
  • afterRenderRawModule mod_articles_latest (Competitive Programming) (41.59KB) (4ms)
  • beforeRenderModule mod_articles_latest (Competitive Programming) (344B) (8μs)
  • afterRenderModule mod_articles_latest (Competitive Programming) (5.95KB) (143μs)
  • beforeRenderRawModule mod_jbounce (JBounce) (2.63KB) (50μs)
  • afterRenderRawModule mod_jbounce (JBounce) (2.5KB) (102μs)
  • beforeRenderModule mod_jbounce (JBounce) (720B) (4μs)
  • afterRenderModule mod_jbounce (JBounce) (1.28KB) (93μs)
  • afterRender (292.37KB) (33.73ms)
  • 1 x afterRenderComponent com_content (586.06KB) (27.52%)
    79.31ms
    1 x afterInitialise (1.5MB) (16.02%)
    46.17ms
    1 x afterRender (292.37KB) (11.7%)
    33.73ms
    1 x afterRoute (825.97KB) (7.65%)
    22.05ms
    1 x beforeRenderRawModule mod_search (Search) (1.09MB) (7.55%)
    21.77ms
    1 x afterRenderRawModule mod_search (Search) (292.37KB) (2.97%)
    8.56ms
    1 x afterLoad (552.78KB) (1.76%)
    5.06ms
    1 x afterRenderRawModule mod_articles_latest (Competitive Programming) (41.59KB) (1.39%)
    4.00ms
    1 x beforeRenderComponent com_content (139.59KB) (1.28%)
    3.68ms
    1 x beforeRenderRawModule mod_articles_latest (Competitive Programming) (47.65KB) (0.7%)
    2.00ms
    1 x After Access::preloadPermissions (com_content) (256.8KB) (0.57%)
    1.63ms
    1 x After Access::preloadComponents (all components) (121KB) (0.56%)
    1.62ms
    1 x Before Access::preloadComponents (all components) (55.55KB) (0.4%)
    1.16ms
    1 x Before Access::getAssetRules (id:8 name:com_content) (119.03KB) (0.36%)
    1.03ms
    1 x afterRenderModule mod_search (Search) (3.43KB) (0.07%)
    194μs
    1 x After Access::getAssetRules (id:1171 name:com_content.article.407) (8.66KB) (0.06%)
    180μs
    1 x afterRenderModule mod_articles_latest (Competitive Programming) (5.95KB) (0.05%)
    143μs
    1 x afterDispatch (2.25KB) (0.05%)
    132μs
    1 x afterRenderRawModule mod_jbounce (JBounce) (2.5KB) (0.04%)
    102μs
    1 x afterRenderModule mod_jbounce (JBounce) (1.28KB) (0.03%)
    93μs
    1 x beforeRenderRawModule mod_jbounce (JBounce) (2.63KB) (0.02%)
    50μs
    1 x Before Access::getAssetRules (id:1171 name:com_content.article.407) (18.8KB) (0.01%)
    28μs
    1 x Before Access::preloadPermissions (com_content) (3.88KB) (0.01%)
    18μs
    1 x After Access::getAssetRules (id:8 name:com_content) (1.59KB) (0%)
    14μs
    1 x beforeRenderModule mod_search (Search) (704B) (0%)
    12μs
    1 x beforeRenderModule mod_articles_latest (Competitive Programming) (344B) (0%)
    8μs
    1 x beforeRenderModule mod_jbounce (JBounce) (720B) (0%)
    4μs
34 statements were executed, 5 of which were duplicates, 29 unique59ms370.29KB
  • SELECT @@SESSION.sql_mode;179μs1.59KB/libraries/vendor/joomla/database/src/Mysqli/MysqliDriver.php:293Copy
  • SELECT `data` FROM `joom_session` WHERE `session_id` = ?594μs1.61KBParams/libraries/vendor/joomla/session/src/Handler/DatabaseHandler.php:261Copy
  • SELECT `session_id` FROM `joom_session` WHERE `session_id` = :session_id LIMIT 1785μs1.61KBParams/libraries/src/Session/MetadataManager.php:187Copy
  • INSERT INTO `joom_session` (`session_id`,`guest`,`time`,`userid`,`username`,`client_id`) VALUES (:session_id, :guest, :time, :user_id, :username, :client_id)230μs944BParams/libraries/src/Session/MetadataManager.php:260Copy
  • SELECT `extension_id` AS `id`,`element` AS `option`,`params`,`enabled` FROM `joom_extensions` WHERE `type` = 'component' AND `state` = 0 AND `enabled` = 1509μs4.73KB/libraries/src/Component/ComponentHelper.php:393Copy
  • SELECT `id`,`rules` FROM `joom_viewlevels`230μs1.06KB/libraries/src/Access/Access.php:955Copy
  • SELECT `b`.`id` FROM `joom_usergroups` AS `a` LEFT JOIN `joom_usergroups` AS `b` ON `b`.`lft` <= `a`.`lft` AND `b`.`rgt` >= `a`.`rgt` WHERE `a`.`id` = :guest1.19ms1.67KBParams/libraries/src/Access/Access.php:868Copy
  • SELECT `folder` AS `type`,`element` AS `name`,`params` AS `params`,`extension_id` AS `id` FROM `joom_extensions` WHERE `enabled` = 1 AND `type` = 'plugin' AND `state` IN (0,1) AND `access` IN (:preparedArray1,:preparedArray2) ORDER BY `ordering`1.37ms11.8KBParams/libraries/src/Plugin/PluginHelper.php:283Copy
  • SELECT `m`.`id`,`m`.`menutype`,`m`.`title`,`m`.`alias`,`m`.`note`,`m`.`link`,`m`.`type`,`m`.`level`,`m`.`language`,`m`.`browserNav`,`m`.`access`,`m`.`params`,`m`.`home`,`m`.`img`,`m`.`template_style_id`,`m`.`component_id`,`m`.`parent_id`,`m`.`path` AS `route`,`e`.`element` AS `component` FROM `joom_menu` AS `m` LEFT JOIN `joom_extensions` AS `e` ON `m`.`component_id` = `e`.`extension_id` WHERE ( (`m`.`published` = 1 AND `m`.`parent_id` > 0 AND `m`.`client_id` = 0) AND (`m`.`publish_up` IS NULL OR `m`.`publish_up` <= :currentDate1)) AND (`m`.`publish_down` IS NULL OR `m`.`publish_down` >= :currentDate2) ORDER BY `m`.`lft`816μs46.23KBParams/libraries/src/Menu/SiteMenu.php:166Copy
  • SELECT `c`.`id`,`c`.`asset_id`,`c`.`access`,`c`.`alias`,`c`.`checked_out`,`c`.`checked_out_time`,`c`.`created_time`,`c`.`created_user_id`,`c`.`description`,`c`.`extension`,`c`.`hits`,`c`.`language`,`c`.`level`,`c`.`lft`,`c`.`metadata`,`c`.`metadesc`,`c`.`metakey`,`c`.`modified_time`,`c`.`note`,`c`.`params`,`c`.`parent_id`,`c`.`path`,`c`.`published`,`c`.`rgt`,`c`.`title`,`c`.`modified_user_id`,`c`.`version`, CASE WHEN CHAR_LENGTH(`c`.`alias`) != 0 THEN CONCAT_WS(':', `c`.`id`, `c`.`alias`) ELSE `c`.`id` END as `slug` FROM `joom_categories` AS `s` INNER JOIN `joom_categories` AS `c` ON (`s`.`lft` <= `c`.`lft` AND `c`.`lft` < `s`.`rgt`) OR (`c`.`lft` < `s`.`lft` AND `s`.`rgt` < `c`.`rgt`) WHERE (`c`.`extension` = :extension OR `c`.`extension` = 'system') AND `c`.`published` = 1 AND `s`.`id` = :id ORDER BY `c`.`lft`1.93ms6.62KBParams/libraries/src/Categories/Categories.php:360Copy
  • SELECT `id`,`home`,`template`,`s`.`params`,`inheritable`,`parent` FROM `joom_template_styles` AS `s` LEFT JOIN `joom_extensions` AS `e` ON `e`.`element` = `s`.`template` AND `e`.`type` = 'template' AND `e`.`client_id` = `s`.`client_id` WHERE `s`.`client_id` = 0 AND `e`.`enabled` = 1478μs1.47KB/administrator/components/com_templates/src/Model/StyleModel.php:771Copy
  • SELECT s.id, s.template, s.home, s.title AS long_title, s.params FROM joom_template_styles AS s WHERE s.client_id = 0 AND s.template = 'g5_helium' ORDER BY s.id266μs1.23KB/libraries/gantry5/src/classes/Gantry/Joomla/StyleHelper.php:69Copy
  • SELECT * FROM `joom_languages` WHERE `published` = 1 ORDER BY `ordering` ASC1.85ms2.44KB/libraries/src/Language/LanguageHelper.php:142Copy
  • SELECT `id`,`name`,`rules`,`parent_id` FROM `joom_assets` WHERE `name` IN (:preparedArray1,:preparedArray2,:preparedArray3,:preparedArray4,:preparedArray5,:preparedArray6,:preparedArray7,:preparedArray8,:preparedArray9,:preparedArray10,:preparedArray11,:preparedArray12,:preparedArray13,:preparedArray14,:preparedArray15,:preparedArray16,:preparedArray17,:preparedArray18,:preparedArray19,:preparedArray20,:preparedArray21,:preparedArray22,:preparedArray23,:preparedArray24,:preparedArray25,:preparedArray26,:preparedArray27,:preparedArray28,:preparedArray29,:preparedArray30,:preparedArray31,:preparedArray32,:preparedArray33,:preparedArray34,:preparedArray35,:preparedArray36,:preparedArray37,:preparedArray38,:preparedArray39,:preparedArray40,:preparedArray41)972μs10.25KBParams/libraries/src/Access/Access.php:357Copy
  • SELECT `id`,`name`,`rules`,`parent_id` FROM `joom_assets` WHERE `name` LIKE :asset OR `name` = :extension OR `parent_id` = 0895μs69.8KBParams/libraries/src/Access/Access.php:301Copy
  • SHOW FULL COLUMNS FROM `joom_content`583μs10.39KB/libraries/vendor/joomla/database/src/Mysqli/MysqliDriver.php:584Copy
  • UPDATE joom_content SET `hits` = (`hits` + 1) WHERE `id` = '407'803μs2.55KB/libraries/src/Table/Table.php:1319Copy
  • SELECT `a`.`id`,`a`.`asset_id`,`a`.`title`,`a`.`alias`,`a`.`introtext`,`a`.`fulltext`,`a`.`state`,`a`.`catid`,`a`.`created`,`a`.`created_by`,`a`.`created_by_alias`,`a`.`modified`,`a`.`modified_by`,`a`.`checked_out`,`a`.`checked_out_time`,`a`.`publish_up`,`a`.`publish_down`,`a`.`images`,`a`.`urls`,`a`.`attribs`,`a`.`version`,`a`.`ordering`,`a`.`metakey`,`a`.`metadesc`,`a`.`access`,`a`.`hits`,`a`.`metadata`,`a`.`featured`,`a`.`language`,`fp`.`featured_up`,`fp`.`featured_down`,`c`.`title` AS `category_title`,`c`.`alias` AS `category_alias`,`c`.`access` AS `category_access`,`c`.`language` AS `category_language`,`fp`.`ordering`,`u`.`name` AS `author`,`parent`.`title` AS `parent_title`,`parent`.`id` AS `parent_id`,`parent`.`path` AS `parent_route`,`parent`.`alias` AS `parent_alias`,`parent`.`language` AS `parent_language`,ROUND(`v`.`rating_sum` / `v`.`rating_count`, 1) AS `rating`,`v`.`rating_count` AS `rating_count` FROM `joom_content` AS `a` INNER JOIN `joom_categories` AS `c` ON `c`.`id` = `a`.`catid` LEFT JOIN `joom_content_frontpage` AS `fp` ON `fp`.`content_id` = `a`.`id` LEFT JOIN `joom_users` AS `u` ON `u`.`id` = `a`.`created_by` LEFT JOIN `joom_categories` AS `parent` ON `parent`.`id` = `c`.`parent_id` LEFT JOIN `joom_content_rating` AS `v` ON `a`.`id` = `v`.`content_id` WHERE ( (`a`.`id` = :pk AND `c`.`published` > 0) AND (`a`.`publish_up` IS NULL OR `a`.`publish_up` <= :publishUp)) AND (`a`.`publish_down` IS NULL OR `a`.`publish_down` >= :publishDown) AND `a`.`state` IN (:preparedArray1,:preparedArray2)481μs25.38KBParams/components/com_content/src/Model/ArticleModel.php:215Copy
  • SELECT `c`.`id`,`c`.`asset_id`,`c`.`access`,`c`.`alias`,`c`.`checked_out`,`c`.`checked_out_time`,`c`.`created_time`,`c`.`created_user_id`,`c`.`description`,`c`.`extension`,`c`.`hits`,`c`.`language`,`c`.`level`,`c`.`lft`,`c`.`metadata`,`c`.`metadesc`,`c`.`metakey`,`c`.`modified_time`,`c`.`note`,`c`.`params`,`c`.`parent_id`,`c`.`path`,`c`.`published`,`c`.`rgt`,`c`.`title`,`c`.`modified_user_id`,`c`.`version`, CASE WHEN CHAR_LENGTH(`c`.`alias`) != 0 THEN CONCAT_WS(':', `c`.`id`, `c`.`alias`) ELSE `c`.`id` END as `slug` FROM `joom_categories` AS `s` INNER JOIN `joom_categories` AS `c` ON (`s`.`lft` <= `c`.`lft` AND `c`.`lft` < `s`.`rgt`) OR (`c`.`lft` < `s`.`lft` AND `s`.`rgt` < `c`.`rgt`) WHERE (`c`.`extension` = :extension OR `c`.`extension` = 'system') AND `c`.`access` IN (:preparedArray1,:preparedArray2) AND `c`.`published` = 1 AND `s`.`id` = :id ORDER BY `c`.`lft`8.22ms6.67KBParams/libraries/src/Categories/Categories.php:360Copy
  • SELECT `m`.`tag_id`,`t`.* FROM `joom_contentitem_tag_map` AS `m` INNER JOIN `joom_tags` AS `t` ON `m`.`tag_id` = `t`.`id` WHERE `m`.`type_alias` = :contentType AND `m`.`content_item_id` = :id AND `t`.`published` = 1 AND `t`.`access` IN (:preparedArray1,:preparedArray2)814μs7.28KBParams/libraries/src/Helper/TagsHelper.php:364Copy
  • SELECT `c`.`id`,`c`.`asset_id`,`c`.`access`,`c`.`alias`,`c`.`checked_out`,`c`.`checked_out_time`,`c`.`created_time`,`c`.`created_user_id`,`c`.`description`,`c`.`extension`,`c`.`hits`,`c`.`language`,`c`.`level`,`c`.`lft`,`c`.`metadata`,`c`.`metadesc`,`c`.`metakey`,`c`.`modified_time`,`c`.`note`,`c`.`params`,`c`.`parent_id`,`c`.`path`,`c`.`published`,`c`.`rgt`,`c`.`title`,`c`.`modified_user_id`,`c`.`version`, CASE WHEN CHAR_LENGTH(`c`.`alias`) != 0 THEN CONCAT_WS(':', `c`.`id`, `c`.`alias`) ELSE `c`.`id` END as `slug` FROM `joom_categories` AS `s` INNER JOIN `joom_categories` AS `c` ON (`s`.`lft` <= `c`.`lft` AND `c`.`lft` < `s`.`rgt`) OR (`c`.`lft` < `s`.`lft` AND `s`.`rgt` < `c`.`rgt`) WHERE (`c`.`extension` = :extension OR `c`.`extension` = 'system') AND `c`.`access` IN (:preparedArray1,:preparedArray2) AND `c`.`published` = 1 AND `s`.`id` = :id ORDER BY `c`.`lft`5.38ms6.67KBParams/libraries/src/Categories/Categories.php:360Copy
  • SELECT DISTINCT a.id, a.title, a.name, a.checked_out, a.checked_out_time, a.note, a.state, a.access, a.created_time, a.created_user_id, a.ordering, a.language, a.fieldparams, a.params, a.type, a.default_value, a.context, a.group_id, a.label, a.description, a.required, a.only_use_in_subform,l.title AS language_title, l.image AS language_image,uc.name AS editor,ag.title AS access_level,ua.name AS author_name,g.title AS group_title, g.access as group_access, g.state AS group_state, g.note as group_note FROM joom_fields AS a LEFT JOIN `joom_languages` AS l ON l.lang_code = a.language LEFT JOIN joom_users AS uc ON uc.id=a.checked_out LEFT JOIN joom_viewlevels AS ag ON ag.id = a.access LEFT JOIN joom_users AS ua ON ua.id = a.created_user_id LEFT JOIN joom_fields_groups AS g ON g.id = a.group_id LEFT JOIN `joom_fields_categories` AS fc ON fc.field_id = a.id WHERE ( (`a`.`context` = :context AND (`fc`.`category_id` IS NULL OR `fc`.`category_id` IN (:preparedArray1,:preparedArray2,:preparedArray3)) AND `a`.`access` IN (:preparedArray4,:preparedArray5)) AND (`a`.`group_id` = 0 OR `g`.`access` IN (:preparedArray6,:preparedArray7)) AND `a`.`state` = :state) AND (`a`.`group_id` = 0 OR `g`.`state` = :gstate) AND `a`.`only_use_in_subform` = :only_use_in_subform ORDER BY a.ordering ASC5.6ms6.06KBParams/libraries/src/MVC/Model/BaseDatabaseModel.php:165Copy
  • SELECT `contact`.`id` AS `contactid`,`contact`.`alias`,`contact`.`catid`,`contact`.`webpage`,`contact`.`email_to` FROM `joom_contact_details` AS `contact` WHERE `contact`.`published` = 1 AND `contact`.`user_id` = :createdby ORDER BY `contact`.`id` DESC LIMIT 16.95ms1.84KBParams/plugins/content/contact/contact.php:147Copy
  • SELECT `m`.`id`,`m`.`title`,`m`.`module`,`m`.`position`,`m`.`content`,`m`.`showtitle`,`m`.`params`,`mm`.`menuid` FROM `joom_modules` AS `m` LEFT JOIN `joom_modules_menu` AS `mm` ON `mm`.`moduleid` = `m`.`id` LEFT JOIN `joom_extensions` AS `e` ON `e`.`element` = `m`.`module` AND `e`.`client_id` = `m`.`client_id` WHERE ( ( (`m`.`published` = 1 AND `e`.`enabled` = 1 AND `m`.`client_id` = :clientId AND `m`.`access` IN (:preparedArray1,:preparedArray2)) AND (`m`.`publish_up` IS NULL OR `m`.`publish_up` <= :publishUp)) AND (`m`.`publish_down` IS NULL OR `m`.`publish_down` >= :publishDown)) AND (`mm`.`menuid` = :itemId OR `mm`.`menuid` <= 0) ORDER BY `m`.`position`,`m`.`ordering`4.12ms3.53KBParams/libraries/src/Cache/Controller/CallbackController.php:52Copy
  • SELECT `a`.`id`,`a`.`title`,`a`.`catid`,`a`.`language`, CASE WHEN CHAR_LENGTH(`a`.`alias`) != 0 THEN CONCAT_WS(':', `a`.`id`, `a`.`alias`) ELSE a.id END AS `slug`, CASE WHEN CHAR_LENGTH(`cc`.`alias`) != 0 THEN CONCAT_WS(':', `cc`.`id`, `cc`.`alias`) ELSE cc.id END AS `catslug` FROM `joom_content` AS `a` LEFT JOIN `joom_categories` AS `cc` ON `cc`.`id` = `a`.`catid` WHERE `a`.`catid` = :catid AND `a`.`state` = :state AND `a`.`access` IN (:preparedArray1,:preparedArray2) AND (`publish_up` IS NULL OR `publish_up` <= :nowDate1) AND (`publish_down` IS NULL OR `publish_down` >= :nowDate2) ORDER BY CASE WHEN `a`.`publish_up` IS NULL THEN `a`.`created` ELSE `a`.`publish_up` END DESC678μs4.41KBParams/plugins/content/pagenavigation/pagenavigation.php:186Copy
  • SELECT `c`.`id`,`c`.`asset_id`,`c`.`access`,`c`.`alias`,`c`.`checked_out`,`c`.`checked_out_time`,`c`.`created_time`,`c`.`created_user_id`,`c`.`description`,`c`.`extension`,`c`.`hits`,`c`.`language`,`c`.`level`,`c`.`lft`,`c`.`metadata`,`c`.`metadesc`,`c`.`metakey`,`c`.`modified_time`,`c`.`note`,`c`.`params`,`c`.`parent_id`,`c`.`path`,`c`.`published`,`c`.`rgt`,`c`.`title`,`c`.`modified_user_id`,`c`.`version`, CASE WHEN CHAR_LENGTH(`c`.`alias`) != 0 THEN CONCAT_WS(':', `c`.`id`, `c`.`alias`) ELSE `c`.`id` END as `slug` FROM `joom_categories` AS `s` INNER JOIN `joom_categories` AS `c` ON (`s`.`lft` <= `c`.`lft` AND `c`.`lft` < `s`.`rgt`) OR (`c`.`lft` < `s`.`lft` AND `s`.`rgt` < `c`.`rgt`) WHERE (`c`.`extension` = :extension OR `c`.`extension` = 'system') AND `c`.`access` IN (:preparedArray1,:preparedArray2) AND `c`.`published` = 1 AND `s`.`id` = :id ORDER BY `c`.`lft`1.34ms6.67KBParams/libraries/src/Categories/Categories.php:360Copy
  • SELECT `a`.`menutype`,`a`.`title` FROM `joom_menu_types` AS `a` WHERE `a`.`client_id` = 0322μs1.06KB/libraries/gantry5/src/classes/Gantry/Framework/Menu.php:138Copy
  • SELECT m.id, m.alias, m.path AS route, m.level, m.parent_id FROM joom_menu AS m WHERE m.menutype = 'main-menu' AND m.parent_id > 0 AND m.client_id = 0 AND m.published >= 0 ORDER BY m.lft939μs3.17KB/libraries/gantry5/src/classes/Gantry/Framework/Menu.php:791Copy
  • SELECT `alias` FROM `joom_content` WHERE `id` = :id2.03ms1.64KBParams/components/com_content/src/Service/Router.php:168Copy
  • SELECT `alias` FROM `joom_content` WHERE `id` = :id1.55ms1.64KBParams/components/com_content/src/Service/Router.php:168Copy
  • SELECT m.id, m.alias, m.path AS route, m.level, m.parent_id FROM joom_menu AS m WHERE m.menutype = 'my-menu' AND m.parent_id > 0 AND m.client_id = 0 AND m.published >= 0 ORDER BY m.lft819μs1.56KB/libraries/gantry5/src/classes/Gantry/Framework/Menu.php:791Copy
  • SELECT `a`.`id`,`a`.`title`,`a`.`alias`,`a`.`introtext`,`a`.`fulltext`,`a`.`checked_out`,`a`.`checked_out_time`,`a`.`catid`,`a`.`created`,`a`.`created_by`,`a`.`created_by_alias`,`a`.`modified`,`a`.`modified_by`,CASE WHEN `a`.`publish_up` IS NULL THEN `a`.`created` ELSE `a`.`publish_up` END AS `publish_up`,`a`.`publish_down`,`a`.`images`,`a`.`urls`,`a`.`attribs`,`a`.`metadata`,`a`.`metakey`,`a`.`metadesc`,`a`.`access`,`a`.`hits`,`a`.`featured`,`a`.`language`,LENGTH(`a`.`fulltext`) AS `readmore`,`a`.`ordering`,`fp`.`featured_up`,`fp`.`featured_down`,CASE WHEN `c`.`published` = 2 AND `a`.`state` > 0 THEN 2 WHEN `c`.`published` != 1 THEN 0 ELSE `a`.`state` END AS `state`,`c`.`title` AS `category_title`,`c`.`path` AS `category_route`,`c`.`access` AS `category_access`,`c`.`alias` AS `category_alias`,`c`.`language` AS `category_language`,`c`.`published`,`c`.`published` AS `parents_published`,`c`.`lft`,CASE WHEN `a`.`created_by_alias` > ' ' THEN `a`.`created_by_alias` ELSE `ua`.`name` END AS `author`,`ua`.`email` AS `author_email`,`uam`.`name` AS `modified_by_name`,`parent`.`title` AS `parent_title`,`parent`.`id` AS `parent_id`,`parent`.`path` AS `parent_route`,`parent`.`alias` AS `parent_alias`,`parent`.`language` AS `parent_language` FROM `joom_content` AS `a` LEFT JOIN `joom_categories` AS `c` ON `c`.`id` = `a`.`catid` LEFT JOIN `joom_users` AS `ua` ON `ua`.`id` = `a`.`created_by` LEFT JOIN `joom_users` AS `uam` ON `uam`.`id` = `a`.`modified_by` LEFT JOIN `joom_categories` AS `parent` ON `parent`.`id` = `c`.`parent_id` LEFT JOIN `joom_content_frontpage` AS `fp` ON `fp`.`content_id` = `a`.`id` WHERE `c`.`published` = 1 AND `a`.`state` = :condition AND `a`.`catid` IN (:preparedArray1) AND (`a`.`publish_up` IS NULL OR `a`.`publish_up` <= :publishUp) AND (`a`.`publish_down` IS NULL OR `a`.`publish_down` >= :publishDown) ORDER BY RAND() DESC LIMIT 102.49ms96.84KBParams/libraries/src/MVC/Model/BaseDatabaseModel.php:165Copy
  • SELECT `a`.`id`,`a`.`asset_id`,`a`.`title`,`a`.`type`,`a`.`execution_rules`,`a`.`state`,`a`.`last_exit_code`,`a`.`locked`,`a`.`last_execution`,`a`.`next_execution`,`a`.`times_executed`,`a`.`times_failed`,`a`.`priority`,`a`.`ordering`,`a`.`note`,`a`.`checked_out`,`a`.`checked_out_time`,`uc`.`name` AS `editor` FROM `joom_scheduler_tasks` AS `a` LEFT JOIN `joom_users` AS `uc` ON `uc`.`id` = `a`.`checked_out` WHERE `a`.`state` = :state AND `a`.`next_execution` <= :now ORDER BY `a`.`title` asc787μs15.45KBParams/administrator/components/com_scheduler/src/Model/TasksModel.php:391Copy
  • SELECT `a`.`id`,`a`.`asset_id`,`a`.`title`,`a`.`type`,`a`.`execution_rules`,`a`.`state`,`a`.`last_exit_code`,`a`.`locked`,`a`.`last_execution`,`a`.`next_execution`,`a`.`times_executed`,`a`.`times_failed`,`a`.`priority`,`a`.`ordering`,`a`.`note`,`a`.`checked_out`,`a`.`checked_out_time`,`uc`.`name` AS `editor` FROM `joom_scheduler_tasks` AS `a` LEFT JOIN `joom_users` AS `uc` ON `uc`.`id` = `a`.`checked_out` WHERE `a`.`state` = :state AND `a`.`locked` IS NOT NULL ORDER BY `a`.`title` asc2.8ms4.43KBParams/administrator/components/com_scheduler/src/Model/TasksModel.php:391Copy