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

[bounty] speed up queries with min / max length #1240

Closed
louis030195 opened this issue Jan 29, 2025 · 4 comments
Closed

[bounty] speed up queries with min / max length #1240

louis030195 opened this issue Jan 29, 2025 · 4 comments
Labels

Comments

@louis030195
Copy link
Collaborator

louis030195 commented Jan 29, 2025

/bounty 100

Image

Here's a summary for the GitHub bounty:

Summary

Found performance optimization opportunity in screenpipe's SQLite database queries, specifically around text length filtering operations which currently lack proper indexing.

Current Issue

  • Database queries filtering on text length (min_length/max_length) are not optimized
  • Using LENGTH() function in WHERE clauses without index support
  • Affects OCR text, audio transcriptions, and UI monitoring queries

Proposed Solution

Add dedicated columns and indexes for text length to optimize queries:

  1. Schema Updates:
- Add text_length columns to relevant tables
- Create indexes on these new columns
- Update existing records with text lengths
  1. Code Updates:
  • Modify insertion/update logic to maintain text_length columns
  • Update search queries to use new columns instead of LENGTH() function

Tables Affected

  • ocr_text
  • audio_transcriptions
  • ui_monitoring

Expected Outcome

  • Faster queries when filtering by text length
  • Better query plan optimization
  • Reduced CPU usage for text length calculations

Bounty Requirements

  1. Implement schema migrations
  2. Update database operations code
  3. Add tests to verify performance improvement
  4. Document performance benchmarks before/after
  5. Ensure backward compatibility

#tags: #performance #database #sqlite #optimization

@louis030195 louis030195 added the enhancement New feature or request label Jan 29, 2025
Copy link

algora-pbc bot commented Jan 29, 2025

## 💎 $100 bounty • Screenpi.pe

### Steps to solve:
1. Start working: Comment /attempt #1240 with your implementation plan
2. Submit work: Create a pull request including /claim #1240 in the PR body to claim the bounty
3. Receive payment: 100% of the bounty is received 2-5 days post-reward. Make sure you are eligible for payouts

Thank you for contributing to mediar-ai/screenpipe!

Add a bountyShare on socials

Attempt Started (GMT+0) Solution
🟢 @bernardev254 Jan 29, 2025, 7:47:35 PM #1243

@bernardev254
Copy link
Contributor

bernardev254 commented Jan 29, 2025

/attempt #1208

Copy link

algora-pbc bot commented Jan 31, 2025

💡 @bernardev254 submitted a pull request that claims the bounty. You can visit your bounty board to reward.

Copy link

algora-pbc bot commented Feb 7, 2025

🎉🎈 @bernardev254 has been awarded $100! 🎈🎊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants