-
Notifications
You must be signed in to change notification settings - Fork 2k
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
datastore Api repeatedly create index #3932
Comments
Well, maybe I find the reason.
Which means even I already have the same primary_key, datatstore would drop the exist unique index , then build it again . |
@shengshuaijohnson is the same problem present in more recent versions? 2.3 is no longer supported |
@wardi There is similar logic in latest version: https://github.com/ckan/ckan/blob/master/ckanext/datastore/backend/postgres.py#L785 |
Thanks, @shengshuaijohnson. I verified this problem and created PR with provided patch |
Ok, thank you :) |
…y-create-index [#3932] Create datastore indexes only if they are not exist
CKAN Version if known (or site URL)
2.3
Please describe the expected behaviour
I've directly excuted the SQL string of
ckanext/datastore/db.py::_get_index_names()
in postgresql:(Also replaced
%s
with my resource_id )Then got the output below:
I expecte that the method in
db.py
(for latest ckan it should be ckanext/datastore/backend/postgres.py) returns the same results (16 indexes) .Please describe the actual behaviour
I've added some logs for
create_indexes()
:When I call
datastore_create
to create data(again and again), always get the log below:There are only 15 indexes , then the api wants to excute the SQL to create an unique index.
But actually, this unique index was already created ,I even excuted the sql in pg:
It seems
_get_index_names
didn't work as expect, and this create_index operation just took me much time, which made the API in bad performance.What steps can be taken to reproduce the issue?
Do logging above and use the script below:
The text was updated successfully, but these errors were encountered: