Re: Query planner issue
От | Andrea Moretto |
---|---|
Тема | Re: Query planner issue |
Дата | |
Msg-id | 09B6D861-8394-4BE8-A75B-B90FB78FAA65@gmail.com обсуждение исходный текст |
Ответ на | Re: Query planner issue (Richard Huxton <dev@archonet.com>) |
Список | pgsql-general |
Dear Richard, you are right. So Postgres takes a lot of time to get out an impossible result! The query I wrote is just a test, the concatenation is only a dummy. On 19/set/08, at 12:33, Richard Huxton wrote: > 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 Andrea Moretto moretto.andrea@gmail.com ------------------------------------------------------- CONFIDENTIALITY NOTICE This message and its attachments are addressed solely to the persons above and may contain confidential information. If you have received the message in error, be informed that any use of the content hereof is prohibited. Please return it immediately to the sender and delete the message. -------------------------------------------------------
В списке pgsql-general по дате отправления: