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

[Resource] Fix DoctrineORMPaginator instantiation to set OutputWalker to false #3495

Merged
merged 1 commit into from
Oct 27, 2015

Conversation

peteward
Copy link

I know that the ResourceBundle refactor is going to add this, but it's killing us at the moment with a 60 second page load and with no ETA on that refactor this is a quick fix.

@peteward peteward changed the title Fix DoctrineORMPaginator instantiation to set OutputWalker to false [Resource] Fix DoctrineORMPaginator instantiation to set OutputWalker to false Oct 27, 2015
@pjedrzejewski
Copy link
Member

It does not affect filters, right? Softdeleteable for example, IIRC it uses a walker. Also, where are you experiencing 60s page load? Which action/usecase?

@pjedrzejewski pjedrzejewski added the Enhancement Minor issues and PRs improving the current solutions (optimizations, typo fixes, etc.). label Oct 27, 2015
@pjedrzejewski pjedrzejewski added this to the v0.16.0 milestone Oct 27, 2015
@peteward
Copy link
Author

You have already made this change in your mega-PR: https://github.com/pjedrzejewski/Sylius/blob/resource-bundle-refactoring/src/Sylius/Bundle/ResourceBundle/Doctrine/ORM/ResourceRepository.php

No, it doesn't affect soft-deletable, I can confirm it still adds this clause as part of the query.

It goes from the horrible:

SELECT 
  DISTINCT id7, 
  updated_at5 
FROM 
  (
    SELECT 
      r0_.email_canonical AS email_canonical0, 
      r0_.first_name AS first_name1, 
      r0_.last_name AS last_name2, 
      r0_.birthday AS birthday3, 
      r0_.created_at AS created_at4, 
      r0_.updated_at AS updated_at5, 
      r0_.deleted_at AS deleted_at6, 
      r0_.id AS id7, 
      r0_.currency AS currency8, 
      r0_.phone_number AS phone_number9, 
      r0_.number AS number10, 
      r0_.gender AS gender11, 
      r0_.email AS email12 
    FROM 
      reiss_customer r0_ 
      LEFT JOIN reiss_user r1_ ON r0_.id = r1_.customer_id 
      AND (r1_.deleted_at IS NULL) 
    WHERE 
      (r0_.deleted_at IS NULL) 
    ORDER BY 
      r0_.updated_at DESC
  ) dctrn_result 
ORDER BY 
  updated_at5 DESC 
LIMIT 
  20 OFFSET 0

to:

SELECT 
  DISTINCT r0_.id AS id0, 
  r0_.updated_at AS updated_at1 
FROM 
  reiss_customer r0_ 
  LEFT JOIN reiss_user r1_ ON r0_.id = r1_.customer_id 
  AND (r1_.deleted_at IS NULL) 
WHERE 
  (r0_.deleted_at IS NULL) 
ORDER BY 

60 seconds page load on backend Customer list page with 1 million users because of the above.

See my comment on your PR about other issues.

pjedrzejewski pushed a commit that referenced this pull request Oct 27, 2015
[Resource] Fix DoctrineORMPaginator instantiation to set OutputWalker to false
@pjedrzejewski pjedrzejewski merged commit fa4be1b into Sylius:master Oct 27, 2015
@pjedrzejewski
Copy link
Member

Perfect, thank you! The mega-PR will haunt me for years, I guess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Minor issues and PRs improving the current solutions (optimizations, typo fixes, etc.).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants