Postgres Performance Improvement of fulltextsearch file provider for DB operations via appropriate indexing of oc_filecache
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 36.9k
- Forks
- 5.2k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 713
Description
How to use GitHub
- Please use the 👍 reaction to show that you are interested into the same feature.
- Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
- Subscribe to receive notifications on status change and new comments.
The implementation of this improvement is documented in https://github.com/nextcloud/fulltextsearch/issues/850
Since this needs to be implemented into the Postgres DB initialization I also post it in here.
Having an ILIKE SQL operation on the "name" field of table "oc_filecache" while the default index is a compound BTREE index over the fields "parent" and "name" slows down responsiveness of a query massively.
The relevant default indexes:
CREATE INDEX fs_parent_name_hash ON public.oc_filecache USING btree
(
parent,
name
)
;
CREATE INDEX fs_storage_path_prefix ON public.oc_filecache USING btree
(
storage,
path
)
;
add the following indexes:
CREATE EXTENSION IF NOT EXISTS pg_trgm;
CREATE INDEX fs_name_gin_trgm ON public.oc_filecache USING GIN (name gin_trgm_ops);
CREATE EXTENSION IF NOT EXISTS pg_trgm;
CREATE INDEX fs_path_gin_trgm ON public.oc_filecache USING GIN (path gin_trgm_ops);
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the implementation described in nextcloud/fulltextsearch issue 850 and locate the PostgreSQL database initialization in the server repository. The work is done when the pg_trgm extension and the proposed GIN trigram indexes for oc_filecache.name and oc_filecache.path are added appropriately and the database setup remains valid.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100