Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 813939FBB5C for ; Tue, 24 Jul 2007 16:43:21 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 94215-04 for ; Tue, 24 Jul 2007 16:43:18 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 1B61B9FBB3E for ; Tue, 24 Jul 2007 16:43:17 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.1/8.14.1) with ESMTP id l6OJhFJs015141; Tue, 24 Jul 2007 15:43:15 -0400 (EDT) To: arnaulist@andromeiberica.com cc: PostgreSQL Performance Subject: Re: index over timestamp not being used In-reply-to: <46A6537B.6010604@andromeiberica.com> References: <46A64475.3040201@andromeiberica.com> <14907.1185305095@sss.pgh.pa.us> <46A6537B.6010604@andromeiberica.com> Comments: In-reply-to Arnau message dated "Tue, 24 Jul 2007 21:31:07 +0200" Date: Tue, 24 Jul 2007 15:43:15 -0400 Message-ID: <15140.1185306195@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200707/324 X-Sequence-Number: 26008 Arnau writes: >> Alternatively, do you really need to_timestamp at all? The standard >> timestamp input routine won't have any problem with that format: >> t.timestamp_in >= '20070101' > This is always I think I'm worried, what happens if one day the internal > format in which the DB stores the date/timestamps changes. I mean, if > instead of being stored as YYYYMMDD is stored as DDMMYYYY, should we > have to change all the queries? You are confusing internal storage format with the external representation. > I thought the > to_char/to_date/to_timestamp functions were intented for this purposes No, they're intended for dealing with wacky formats that the regular input/output routines can't understand or produce. regards, tom lane