If I have something like:
CREATE INDEX idx_myTable_field_x
ON myTable
USING btree (field_x);
SELECT COUNT(field_x), field_x FROM myTable GROUP BY field_x ORDER BY field_x;
Imagine myTablearound 500,000 rowsand most of the values field_xare unique.
Since I am not using any suggestion WHERE, will the created index even have any effect in my query?
Change . I ask this question because I do not get the difference between the queries before and after creating the index; They always take about 8 seconds (which, of course, is too much time!). Is this behavior expected?
source
share