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

Performance/mariadb #2096

Closed
wants to merge 3 commits into from
Closed

Conversation

Daniel-KM
Copy link
Contributor

On bases with many linked resources, the search is very slow on mariadb. So this is a fix, just a composite index in fact, that allows to search instantly for the most common queris (https://github.com/omeka/omeka-s/blob/develop/application/src/Api/Adapter/AbstractResourceEntityAdapter.php#L281-L294).

@Daniel-KM
Copy link
Contributor Author

And the filling of the primary media fixes listing when items have many medias, but no primary media. I added a similar job in module Easy Admin.

Ideally, the primary media should be filled automatically with the first media, but there are many places where it is not the case (in particular import modules). The other way is to use a stored sql procedure, but this is not very common in omeka.

@zerocrates
Copy link
Member

Just curious: have you seen this to not be the case on MySQL, or do you just have direct experience on it with MariaDB only?

@zerocrates
Copy link
Member

zerocrates commented Sep 14, 2023

On the indexes: maybe wise to have is_public as the last component instead of the first? Admin users won't use is_public in their queries, and query suitability is usually based on a leftmost prefix of the indexed columns. So an index with is_public included last should work for both queries with and without an is_public query component.

I'm less likely to take the other two commits here. The join-to-innerJoin is just cosmetic so I'd exclude it, and I think we'd probably want to do something slightly different for any changes related to setting the primary media more reliably.

@Daniel-KM
Copy link
Contributor Author

Yes, i tested on mysql (prod server on huma-num.fr) and mariadb (test server).

@Daniel-KM
Copy link
Contributor Author

For is_public, the order is important, because there is no index on is_public and when there is a composite index, the first index can be used as a single index (and the first with the second one, etc.). So the first thing is to have an index on it, so see the pr #2105 if you don't like composite index. It will resolve most of this issue too.

@zerocrates
Copy link
Member

Since we merged the independent is_public indexes you made the other PR for, I don't think we'll do this one, at least not at this time.

@zerocrates zerocrates closed this Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants