Re: [SQL] qurey plan and indices
От | Patrick Giagnocavo |
---|---|
Тема | Re: [SQL] qurey plan and indices |
Дата | |
Msg-id | 37A99D4F.610E6F7C@redrose.net обсуждение исходный текст |
Ответ на | qurey plan and indices (MESZAROS Attila <tilla@chiara.csoma.elte.hu>) |
Ответы |
Re: [SQL] qurey plan and indices
Re: [SQL] qurey plan and indices |
Список | pgsql-sql |
MESZAROS Attila wrote: > > Hi, > > I've experienced a brutal speedup (order of 2) separateing the following > subquery and making it manually: > > explain select name,description > from descriptions > where in (select name > from descriptions > where description like '%Bankverbindung%'); > > Seq Scan on descriptions (cost=163.98 rows=3575 width=24) > SubPlan > -> Seq Scan on descriptions (cost=163.98 rows=2 width=12) > [I had no patient to wait the resuls...] > Correct me if I am wrong, however if using LIKE '%something%' (which means, the field contains 'something' somewhere in the field) there is never a chance to use the index you have created - a sequential table scan MUST be made, thus you have to read all 3575 rows to return the set. However, if you change your query so that you are looking for LIKE 'Bankverbindung%' then an index can be used becase you know what the first few characters are known. Hope this helps, Cordially Patrick Giagnocavo a222@redrose.net
В списке pgsql-sql по дате отправления: