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

Consider indexing discriminator columns #49

Open
mtbc opened this issue Mar 9, 2020 · 4 comments
Open

Consider indexing discriminator columns #49

mtbc opened this issue Mar 9, 2020 · 4 comments

Comments

@mtbc
Copy link
Member

mtbc commented Mar 9, 2020

A GIN index may work rather well when there are few distinct values on a column. (Could possibly verify by trying a GIN index on eventlog.action.)

@joshmoore
Copy link
Member

Just ran into this while looking for masks on IDR.

cc: @sbesson @manics

@joshmoore
Copy link
Member

on idr-testing:

idr=# \timing
Timing is on.
idr=# create index shape_discriminator on shape using gist(discriminator);
ERROR:  data type character varying has no default operator class for access method "gist"
HINT:  You must specify an operator class for the index or define a default operator class for the data type.
Time: 17.133 ms
idr=# create extension btree_gist;
CREATE EXTENSION
Time: 1016.033 ms (00:01.016)
idr=# create index shape_discriminator on shape using gist(discriminator);
CREATE INDEX
Time: 132258.252 ms (02:12.258)
idr=# select count(m) from shape m where m.discriminator = 'mask';
  count
---------
 1308091
(1 row)

Time: 2046.354 ms (00:02.046)

Vastly faster, but still no images I'm looking for:

idr=# select i.id, count(m) from image i, roi r, shape m where i.id = r.image and r.id = m.roi and m.discriminator = 'mask' and i.series > 0 group by i.id;
 id | count
----+-------
(0 rows)

Time: 7032.757 ms (00:07.033)

@mtbc
Copy link
Member Author

mtbc commented Jul 28, 2020

👍 Further, as well as the btree_gin extension, could even consider going as far as the pg_trgm extension to enable USING GIN(name, LOWER(value) gin_trgm_ops) for indexing columns that should support infix string search, e.g., for mapr.

@mtbc
Copy link
Member Author

mtbc commented Sep 15, 2020

infix string search

e.g., for IDR, update_yeast_genes.py has infix search on map annotation values.

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

No branches or pull requests

2 participants