From: | "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com> |
---|---|
To: | ibarg(at)noao(dot)edu |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: valid use of wildcard |
Date: | 2008-10-30 02:56:57 |
Message-ID: | dcc563d10810291956pf6c0e7cpc8a8f50c53fd6ae7@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Wed, Oct 29, 2008 at 5:04 PM, Irene Barg <ibarg(at)noao(dot)edu> wrote:
> Hi,
>
> Is the following query a valid use of the 'wildcard' in (='2008-10-27%')?
>
>> [arcsoft(at)dsan4 arcsoft]$ psql metadata
>> Password: Welcome to psql 8.1.9, the PostgreSQL interactive terminal.
>>
>> metadata=# SELECT * FROM viewspace.siap AS t WHERE
>> t."startDate"='2008-10-27%' AND t.prop_id LIKE '%' LIMIT 1000;
>
> Causes the %CPU to jump and process lingers for over an hour.
Bad move. dates aren't strings, and their format can change based on
what you've got set for datestyle.
If you want a start date (that's a date or a timestamp) then use the
proper operators
where startDate='2008-10-27'
If startDate is a text / varchar type then you need to change it to a
date. storing dates in strings is bad.
From | Date | Subject | |
---|---|---|---|
Next Message | Eus | 2008-10-30 03:12:54 | Why Postgresql Public Schema Is Not Owned By The DB Owner By Default |
Previous Message | Tom Lane | 2008-10-30 02:19:53 | Re: Can't restart Postgres |