permify icon indicating copy to clipboard operation
permify copied to clipboard

Postgres Index Optimization and Benchmarking

Open tolgaozen opened this issue 3 years ago • 40 comments

Introduction

This document outlines the process of optimizing indexes in a Postgres database and conducting before-and-after benchmarks to evaluate the performance impact of these optimizations on specific check queries.

Repository File References

Optimization Process

Initial Analysis

  • Description: Assess the current indexing strategy and identify potential areas for improvement.
  • Tools Used: [List any analysis tools or scripts used]
  • Findings: Summarize the key findings from the initial analysis.

Index Optimization

  • Optimization Strategies: Detail the specific index optimizations implemented.
    • Strategy 1: [Description]
    • Strategy 2: [Description]
    • ...
  • Implementation Details: Provide SQL commands or scripts used for the optimization.

Benchmarking Setup

Environment Details

  • Postgres Version: [Version]
  • Operating System: [OS]
  • Hardware Specifications: [Hardware details]

Benchmarking Methodology

  • Queries Tested: List the check queries used for benchmarking, as found in the internal/engines folder.
    • Query 1: SQL statement
    • Query 2: SQL statement
    • ...
  • Procedure: Describe the benchmarking process, including how many times each query is run and how metrics are collected.

Benchmark Results

Before Optimization

  • Query 1:
    • Average Execution Time: [Time]
    • Additional Metrics: [Any other relevant metrics]
  • Query 2:
    • Average Execution Time: [Time]
    • Additional Metrics: [Any other relevant metrics]
  • ...

After Optimization

  • Query 1:
    • Average Execution Time: [Time]
    • Additional Metrics: [Any other relevant metrics]
  • Query 2:
    • Average Execution Time: [Time]
    • Additional Metrics: [Any other relevant metrics]
  • ...

Analysis and Conclusions

  • Performance Improvements: Highlight the key improvements in query performance post-optimization.
  • Recommendations: Offer any further recommendations based on the benchmarking results.

Appendix

  • Additional Notes: [Any other notes or observations]
  • Scripts/Commands Used: Provide any scripts or commands used during the optimization and benchmarking process.

tolgaozen avatar Nov 22 '23 09:11 tolgaozen

/bounty $400

tolgaozen avatar Nov 22 '23 09:11 tolgaozen

💎 $400 bounty created by Permify 🙋 If you'd like to work on this issue, comment below to get assigned 👉 To claim this bounty, submit a pull request that includes the text /claim #863 somewhere in its body 📝 Before proceeding, please make sure you can receive payouts in your country 💵 Payment arrives in your account 2-5 days after the bounty is rewarded 💯 You keep 100% of the bounty award 🙏 Thank you for contributing to Permify/permify!

algora-pbc[bot] avatar Nov 22 '23 09:11 algora-pbc[bot]

/attempt #863

Options

sayfshaikh avatar Nov 22 '23 10:11 sayfshaikh

if anyone want to do, I found this tool https://github.com/ankane/dexter might be helpful.

b4s36t4 avatar Nov 22 '23 10:11 b4s36t4

@saifxd7, I have assigned this task to you. Happy hacking 🚀

tolgaozen avatar Nov 22 '23 10:11 tolgaozen

/attempt #863

Options

bolleyboll avatar Nov 22 '23 15:11 bolleyboll

Note: The user @saifxd7 is already attempting to complete issue #863 and claim the bounty. If you attempt to complete the same issue, there is a chance that @saifxd7 will complete the issue first, and be awarded the bounty. We recommend discussing with @saifxd7 and potentially collaborating on the same solution versus creating an alternate solution.

algora-pbc[bot] avatar Nov 22 '23 15:11 algora-pbc[bot]

Hi @tolgaOzen i have initially seen the issues and have made the initial analysis of the database . Should i share how i would approach for optimizing the database?

Gmin2 avatar Nov 24 '23 08:11 Gmin2

Hello @Min2who, @saifxd7 is currently dealing with the issue. You can share it with him or you can collaborate with him on the development

tolgaozen avatar Nov 24 '23 11:11 tolgaozen

@saifxd7 are you still working on this ?

Gmin2 avatar Nov 24 '23 18:11 Gmin2

Yes @Min2who, I'm working on it!

sayfshaikh avatar Nov 25 '23 07:11 sayfshaikh

Hello @saifxd7, firstly, we have reviewed your PR and changing old migration files is dangerous for those who previously used Permify and should not be done. Additionally, since we want this issue to be analyzed more thoroughly, we would like to assign one more person to elaborate on it.

tolgaozen avatar Nov 26 '23 13:11 tolgaozen

Hello @Min2who, if you still want to work on this issue. I can assign it to you.

tolgaozen avatar Nov 26 '23 14:11 tolgaozen

i would like to work in it.If you can assign me

Gmin2 avatar Nov 26 '23 14:11 Gmin2

@Min2who, I'm assigning you. Happy hacking 🚀

tolgaozen avatar Nov 26 '23 14:11 tolgaozen

Hello @Min2who, are there any updates?

tolgaozen avatar Nov 30 '23 12:11 tolgaozen

Hello @Min2who, are there any updates?

Hey @tolgaOzen was travelling for a bit. I will submit my progress in a week. Is it fine ?

Gmin2 avatar Nov 30 '23 13:11 Gmin2

Hey @tolgaOzen i have unassigned from this issue. If anyone interested can give it a try !

Gmin2 avatar Dec 03 '23 13:12 Gmin2

/attempt #863

Options

rutikthakre avatar Dec 03 '23 13:12 rutikthakre

Hi @tolgaOzen could you please assign to me

rutikthakre avatar Dec 03 '23 13:12 rutikthakre