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

perf: add indexes on payment entry reference #33288

Merged
merged 1 commit into from
Dec 12, 2022
Merged

Conversation

ankush
Copy link
Member

@ankush ankush commented Dec 12, 2022

This table has no index right now. So most complex queries are doing full table scans! Example:

image


This PR Adds index on:

  1. reference doctype
  2. reference name

Why not composite index?

There are three type of queries on this doctype

  • filtering ref_doctype - doctype index helps here
  • filtering ref_name - name index helps here
  • filtering both - name index helps here too. Since it has sufficiently
    high cardinality. Composite index wont help in case where ref_doctype
    isn't specfied.

Adds index on:
1. reference doctype
2. reference name

*Why not composite index?*

There are three type of queries on this doctype

- filtering ref_doctype - doctype index helps here
- filtering ref_name - name index helps here
- filtering both - name index helps here too. Since it has sufficiently
  high cardinality. Composite index wont help in case where ref_doctype
  isn't specfied.
@ankush ankush merged commit 593626f into develop Dec 12, 2022
mergify bot pushed a commit that referenced this pull request Dec 12, 2022
Adds index on:
1. reference doctype
2. reference name

*Why not composite index?*

There are three type of queries on this doctype

- filtering ref_doctype - doctype index helps here
- filtering ref_name - name index helps here
- filtering both - name index helps here too. Since it has sufficiently
  high cardinality. Composite index wont help in case where ref_doctype
  isn't specfied.

[skip ci]

(cherry picked from commit 593626f)
mergify bot pushed a commit that referenced this pull request Dec 12, 2022
Adds index on:
1. reference doctype
2. reference name

*Why not composite index?*

There are three type of queries on this doctype

- filtering ref_doctype - doctype index helps here
- filtering ref_name - name index helps here
- filtering both - name index helps here too. Since it has sufficiently
  high cardinality. Composite index wont help in case where ref_doctype
  isn't specfied.

[skip ci]

(cherry picked from commit 593626f)
ankush added a commit that referenced this pull request Dec 12, 2022
perf: add indexes on payment entry reference (#33288)

Adds index on:
1. reference doctype
2. reference name

*Why not composite index?*

There are three type of queries on this doctype

- filtering ref_doctype - doctype index helps here
- filtering ref_name - name index helps here
- filtering both - name index helps here too. Since it has sufficiently
  high cardinality. Composite index wont help in case where ref_doctype
  isn't specfied.

[skip ci]

(cherry picked from commit 593626f)

Co-authored-by: Ankush Menat <ankush@frappe.io>
ankush added a commit that referenced this pull request Dec 12, 2022
perf: add indexes on payment entry reference (#33288)

Adds index on:
1. reference doctype
2. reference name

*Why not composite index?*

There are three type of queries on this doctype

- filtering ref_doctype - doctype index helps here
- filtering ref_name - name index helps here
- filtering both - name index helps here too. Since it has sufficiently
  high cardinality. Composite index wont help in case where ref_doctype
  isn't specfied.

[skip ci]

(cherry picked from commit 593626f)

Co-authored-by: Ankush Menat <ankush@frappe.io>
frappe-pr-bot pushed a commit that referenced this pull request Dec 13, 2022
## [14.10.1](v14.10.0...v14.10.1) (2022-12-13)

### Bug Fixes

* `Enough Parts to Build` in `BOM Stock Report` ([3b9e9d2](3b9e9d2))
* `Material Request` reference in internal `Sales Order` ([416d178](416d178))
* add translation variable order ([ef933a8](ef933a8))
* Buying and selling check in pricing rule ([f5205a5](f5205a5))
* **ecommerce:** remove query parameters from referer ([40621b9](40621b9))
* handle_post_depr_entries_fail, show error alert and send email ([b661f57](b661f57))
* incorrect balance on parent company due to key mismatch ([436e93c](436e93c))
* index error on customer master ([02cc618](02cc618))
* Maintain Same Rate Throughout Sales Cycle doesn't work ([5398cf8](5398cf8)), closes [#32923](#32923)
* order status in `Production Planning Report` ([a657db6](a657db6))
* Permission issue in Tax Detail report ([7a5b80d](7a5b80d))
* **pos:** variable typo: `s_pos` -> `is_pos` ([afbd48f](afbd48f))
* Reapply pricing rule on qty change ([c726c16](c726c16))
* Remove free items ([5e5937d](5e5937d))
* total value in Warehouse Wise Stock Balance ([c5a54d7](c5a54d7))

### Performance Improvements

* add indexes on payment entry reference (backport [#33288](#33288)) ([#33289](#33289)) ([ce63086](ce63086))
frappe-pr-bot pushed a commit that referenced this pull request Dec 13, 2022
## [13.42.4](v13.42.3...v13.42.4) (2022-12-13)

### Bug Fixes

* `Enough Parts to Build` in `BOM Stock Report` ([50b2898](50b2898))
* `Material Request` reference in internal `Sales Order` ([988a327](988a327))
* incorrect balance on parent company due to key mismatch ([b17ac52](b17ac52))
* order status in `Production Planning Report` ([2880469](2880469))

### Performance Improvements

* add indexes on payment entry reference (backport [#33288](#33288)) ([#33290](#33290)) ([45f79ef](45f79ef))
developmentforpeople pushed a commit to Ayuda-Efectiva/erpnext that referenced this pull request Jan 26, 2023
…rappe#33290)

perf: add indexes on payment entry reference (frappe#33288)

Adds index on:
1. reference doctype
2. reference name

*Why not composite index?*

There are three type of queries on this doctype

- filtering ref_doctype - doctype index helps here
- filtering ref_name - name index helps here
- filtering both - name index helps here too. Since it has sufficiently
  high cardinality. Composite index wont help in case where ref_doctype
  isn't specfied.

[skip ci]

(cherry picked from commit 593626f)

Co-authored-by: Ankush Menat <ankush@frappe.io>
developmentforpeople pushed a commit to Ayuda-Efectiva/erpnext that referenced this pull request Jan 26, 2023
## [13.42.4](frappe/erpnext@v13.42.3...v13.42.4) (2022-12-13)

### Bug Fixes

* `Enough Parts to Build` in `BOM Stock Report` ([50b2898](frappe@50b2898))
* `Material Request` reference in internal `Sales Order` ([988a327](frappe@988a327))
* incorrect balance on parent company due to key mismatch ([b17ac52](frappe@b17ac52))
* order status in `Production Planning Report` ([2880469](frappe@2880469))

### Performance Improvements

* add indexes on payment entry reference (backport [frappe#33288](frappe#33288)) ([frappe#33290](frappe#33290)) ([45f79ef](frappe@45f79ef))
@barredterra barredterra mentioned this pull request Mar 7, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant