question about performance

From: Robert Urban <urban(at)unix-beratung(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: question about performance
Date: 2008-07-20 18:08:21
Message-ID: 48837F15.5010401@unix-beratung.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi PostgreSQLer,

if I have a table, the_table, with a DATE field, i'll call it 'day', and I'd
like to find all rows whos day falls within a given month, which of the
following methods is faster/costs less:

1.

SELECT * FROM the_table WHERE day LIKE '2008-01-%';

2.

SELECT * FROM the_table
WHERE ( day BETWEEN '$month_begin' AND '$month_end' );

# where $month_begin is '2008-01-01' and $month_end is '2008-01-31';

thanks,

Rob Urban

Responses

Browse pgsql-general by date

  From Date Subject
Next Message A. Kretschmer 2008-07-20 18:36:48 Re: question about performance
Previous Message Pavel Stehule 2008-07-20 15:22:59 Re: Writing a user defined function