Indexing affects only the WHERE clause?
Posted
by
andre matos
on Stack Overflow
See other posts from Stack Overflow
or by andre matos
Published on 2011-01-05T18:42:43Z
Indexed on
2011/01/05
18:53 UTC
Read the original article
Hit count: 173
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 myTable
with around 500,000 rows
and most of field_x
values being unique.
Since I don't use any WHERE
clause, will the created index have any effect at all in my query?
Edit: I'm asking this question because I don't get any relevant difference between query-times before and after creating the index; They always take about 8 seconds (which, of course is too much time!). Is this behaviour expected?
© Stack Overflow or respective owner