indexing - Indexes in Postgresql -


we have table users (userid, username, category, pincode) in postgresql

if create indexes like:

  1. create index category_idx(category) on users;
  2. create index category_pincode_idx(category, pincode) on users;

and query table users as:

select * users category = somevalue;  

which index applied?

executing following statement reveal index execution planner pick depending on current data set:

explain select * users category = somevalue; 

please advised planner might chose not use index if amount of data not warrant use of index because full table scan on few rows might quicker.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -