Search Postgresql Archives

Re: Query planner issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Andrea Moretto wrote:
> I've got a table called DETAILS, the primary key is : DE_ID char(12),
> there is another field CO_ID char (12).

> If I run "explain analyze select * from details where co_id || co_id =
> '0100760153722324445';" it runs a sequential scan not using the index
> (which takes about 1000000 times than using the index):

That query can never return any rows. You're appending co_id to itself
then testing against a non-repeating string. Furthermore it's 19 chars
long rather than 24. Is this really what you're trying to do?

Read up on "indexes on expressions" in chapter 11 of the manuals, for
indexing this sort of thing. I don't think it will help you here though.

-- 
  Richard Huxton
  Archonet Ltd


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux