Port Bug Report: SELECT with like on indexed column say it uses Index scan but didn't do it
От | Unprivileged user |
---|---|
Тема | Port Bug Report: SELECT with like on indexed column say it uses Index scan but didn't do it |
Дата | |
Msg-id | 199906091843.OAA40355@hub.org обсуждение исходный текст |
Список | pgsql-ports |
============================================================================ POSTGRESQL BUG REPORT TEMPLATE ============================================================================ Your name : Alexander N Shulyak Your email address : alec@nikts.nk.ukrtel.net Category : Severity : Summary: SELECT with like on indexed column say it uses Index scan but didn't do it System Configuration -------------------- Operating System : FreeBSD-3.1 Linux redhat-6.0 PostgreSQL version : 6.5-Beta3 Compiler used : egcs-1.1.2 release Hardware: --------- P II Celeron,64M RAM,HDD 4.3M 6X86, 32M RAM, HDD 2.1M Versions of other tools: ------------------------ flex-2.5.4 -------------------------------------------------------------------------- Problem Description: -------------------- When I do query select * from spr where phone like '3554__'; time of execution is jast like the dolumn is not indexed. \d spr returns: Table = spr +----------------------------------+----------------------------------+-------+ | Field | Type | Length| +----------------------------------+----------------------------------+-------+ | name | varchar() | 0 | | strhousnum | int4 | 4 | | housind | char() | 1 | | korpus | varchar() | 0 | | flat | varchar() | 0 | | phone | varchar() | 0 | | id | int4 | 4 | | flag | varchar() | 0 | | subname | varchar() | 0 | | sstrhousnum | int4 | 4 | | shousind | char() | 1 | | skorpus | varchar() | 0 | | sflat | varchar() | 0 | | subnote | varchar() | 0 | | mod | int2 | 2 | +----------------------------------+----------------------------------+-------+ Index: spr_phone Query explain select * from spr where phone like '3554__'; returns: NOTICE: QUERY PLAN: Index Scan using spr_phone on spr (cost=3785.45 rows=1 width=146) EXPLAIN s -------------------------------------------------------------------------- Test Case: ---------- Quest SELECT with LIKE on big enoughe table and wait for result -------------------------------------------------------------------------- Solution: --------- --------------------------------------------------------------------------
В списке pgsql-ports по дате отправления: