This repository was archived by the owner on Jan 28, 2021. It is now read-only.
This repository was archived by the owner on Jan 28, 2021. It is now read-only.
Indexes on language func does not work with aliased cols #639
Closed
Description
discovered at https://github.com/src-d/empathy-sessions/issues/37#issuecomment-470041061
time srcd sql "SELECT file_path, language(file_path, blob_content)
FROM files
WHERE language(file_path, blob_content)='JSX';"
+------------------------------------+--------------------------------+
| FILE PATH | LANGUAGE(FILES FILE PATH, |
| | FILES BLOB CONTENT) |
+------------------------------------+--------------------------------+
| src/js/components/posts.jsx | JSX |
| src/js/components/repositories.jsx | JSX |
+------------------------------------+--------------------------------+
real 0m12.926s
Then I created an index, following your example to create an index on language expresion
$ time srcd sql "CREATE INDEX files_lang_idx ON files USING pilosa (language(file_path, blob_content));
+
+
real 0m0.236s
And queried again, and the time processing was reduded from ~15s to ~.3s what is nice.
But then I queried using an aliased column... and ~15s again.
$ time srcd sql "SELECT file_path, language(file_path, blob_content) as lang
FROM files
WHERE lang='JSX';"
...
real 0m12.147s