Deepa <kdeepa@midascomm.com> writes:
> In the above result, I cannot able to see much difference between
> the time consumed using primary key and non-primary key value. Even in
> some cases, I can able to see that using non primary key value retrieves record faster
> than using primary key.
Try running "analyze tablename". If you don't run analyze periodically
postgres won't know about changes in the data such as a table growing large
enough to warrant using an index.
If that doesn't help, run your query in psql with the word "explain" before it
and send the results. Also send the output of \d tablename.
explain will say exactly what postgres is doing to run your query. It looks
like the query with the primary key may not be using an index.
--
greg