Re: [PORTS] Port Bug Report: Wild memory use for badly written SQL - Mailing list pgsql-ports

From Bruce Momjian
Subject Re: [PORTS] Port Bug Report: Wild memory use for badly written SQL
Date
Msg-id 199906022009.QAA09293@candle.pha.pa.us
Whole thread Raw
In response to Port Bug Report: Wild memory use for badly written SQL  (Unprivileged user <nobody>)
Responses Re: [PORTS] Port Bug Report: Wild memory use for badly written SQL
List pgsql-ports
> select * from ts_syllabus where
>   (ts_key like '1%' and ts_lang='swe') or
>   (ts_key like '2%' and ts_lang='swe') or
>   (ts_key like '3%' and ts_lang='swe') or
>   (ts_key like '4%' and ts_lang='swe') or
>   (ts_key like '5%' and ts_lang='swe') or
>   (ts_key like '6%' and ts_lang='swe') or
>   (ts_key like '7%' and ts_lang='swe') or
>   (ts_key like '8%' and ts_lang='swe') or
>   (ts_key like '9%' and ts_lang='swe')

This is a mix of two issues, the indexing of LIKE converts the above to
a more complex case that can use indexes, and OR's explode the query
optimizer's conversion of the where clause to CNF format.  Not much we
can do in the short term to fix this.

--
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

pgsql-ports by date:

Previous
From: Unprivileged user
Date:
Subject: Port Bug Report: Wild memory use for badly written SQL
Next
From: "G. Anthony Reina"
Date:
Subject: Re: [PORTS] Windows 95 PgAccess Help with PSQL