Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ index posts_gdocs.updatedAt #2657

Merged
merged 3 commits into from
Sep 26, 2023
Merged

✨ index posts_gdocs.updatedAt #2657

merged 3 commits into from
Sep 26, 2023

Conversation

ikesau
Copy link
Member

@ikesau ikesau commented Sep 25, 2023

I was encountering issues where the GdocsIndexPage wasn't loading for me due to an MySQL sort_buffer overflow:

{
  "code": "ER_OUT_OF_SORTMEMORY",
  "errno": 1038,
  "sqlMessage": "Out of sort memory, consider increasing server sort buffer size",
  "sqlState": "HY001",
  "index": 0
}
 SELECT `Gdoc`.`id`                     AS `Gdoc_id`,
       `Gdoc`.`slug`                    AS `Gdoc_slug`,
       `Gdoc`.`content`                 AS `Gdoc_content`,
       `Gdoc`.`published`               AS `Gdoc_published`,
       `Gdoc`.`publicationcontext`      AS `Gdoc_publicationContext`,
       `Gdoc`.`createdat`               AS `Gdoc_createdAt`,
       `Gdoc`.`publishedat`             AS `Gdoc_publishedAt`,
       `Gdoc`.`updatedat`               AS `Gdoc_updatedAt`,
       `Gdoc`.`revisionid`              AS `Gdoc_revisionId`,
       `Gdoc`.`breadcrumbs`             AS `Gdoc_breadcrumbs`,
       `Gdoc__Gdoc_tags`.`id`           AS `Gdoc__Gdoc_tags_id`,
       `Gdoc__Gdoc_tags`.`name`         AS `Gdoc__Gdoc_tags_name`,
       `Gdoc__Gdoc_tags`.`createdat`    AS `Gdoc__Gdoc_tags_createdAt`,
       `Gdoc__Gdoc_tags`.`updatedat`    AS `Gdoc__Gdoc_tags_updatedAt`,
       `Gdoc__Gdoc_tags`.`parentid`     AS `Gdoc__Gdoc_tags_parentId`,
       `Gdoc__Gdoc_tags`.`isbulkimport` AS `Gdoc__Gdoc_tags_isBulkImport`,
       `Gdoc__Gdoc_tags`.`specialtype`  AS `Gdoc__Gdoc_tags_specialType`
FROM   `posts_gdocs` `Gdoc`
       LEFT JOIN `posts_gdocs_x_tags` `Gdoc_Gdoc__Gdoc_tags`
              ON `Gdoc_Gdoc__Gdoc_tags`.`gdocid` = `Gdoc`.`id`
       LEFT JOIN `tags` `Gdoc__Gdoc_tags`
              ON `Gdoc__Gdoc_tags`.`id` = `Gdoc_Gdoc__Gdoc_tags`.`tagid`
ORDER  BY `Gdoc`.`updatedat` DESC  

Adding this index may help fix the problem, though I still intermittently get the issue.

In either case, it's a good idea to index this column seeing as we do an ORDER BY on it, but I'll wait to see if there are further optimizations we should make before committing anything.

@ikesau ikesau self-assigned this Sep 25, 2023
@ikesau ikesau marked this pull request as ready for review September 26, 2023 21:10
@ikesau ikesau merged commit 48cb429 into master Sep 26, 2023
13 checks passed
@ikesau ikesau deleted the index-updated-at branch September 26, 2023 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants