Thread: OID & indexes.
hi, Is the OID fileld indexed and if not can I create index on it. Thanx ===== iVAN raptor@unacs.bg =====
raptor <raptor@unacs.bg> writes: > Is the OID fileld indexed and if not can I create index on it. No, and yes. OID is just like any regular column as far as indexing is concerned. You should make an index on it if you plan to do lots of 'WHERE oid = something' queries. regards, tom lane
> hi, > > Is the OID fileld indexed and if not can I create index on it. It is not indexed by default. You have to create an index on it. -- 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, Pennsylvania19026
raptor ha scritto: > hi, > > Is the OID fileld indexed and if not can I create index on it. > The OID field is not indexed by default but you can create an index on it as: create index idx_name on table_name (oid); José
Hi all, I'm having a problem to make a select statement with a date type field. I have a table with a field named date_in and this field is a date type. Well, I need to do a select where the month is 09 and the year is 1999. I tried: SELECT * FROM calls WHERE date_in LIKE '09%1999' ORDER BY date_in or SELECT * FROM calls WHERE date_in LIKE '09-__-1999' ORDER BY date_in or SELECT * FROM calls WHERE date_in LIKE '09%' AND date_in LIKE '%1999' ORDER BY date_in using psql command and I received the following message: ERROR: There is more than one possible operator '~~' for types 'date' and 'unknown' You will have to retype this query using an explicit cast Could anybody help me ? Thanks in advance, Paulo Kappke Cyclades Brazil
Paulo Roberto Kappke wrote: > Hi all, > > I'm having a problem to make a select statement with a date type field. > > I have a table with a field named date_in and this field is a date type. > Well, I need to do a select where the month is 09 and the year is 1999. > I tried: > > SELECT * FROM calls WHERE date_in LIKE '09%1999' ORDER BY date_in > or > SELECT * FROM calls WHERE date_in LIKE '09-__-1999' ORDER BY date_in > or > SELECT * FROM calls WHERE date_in LIKE '09%' AND date_in LIKE '%1999' > ORDER BY date_in > > using psql command and I received the following message: > > ERROR: There is more than one possible operator '~~' for types 'date' > and 'unknown' > You will have to retype this query using an explicit cast > > Could anybody help me ? > > Thanks in advance, > Paulo Kappke > Cyclades Brazil > > ************ Try this: select * from calls where date_part('month', date_in::datetime) = '09' and date_part('year', date_in::datetime) = '1999' order by date_in I use PostgreSQL 6.5.1 on RedHat Linux 6.0. -- Best, George Moga, george@flex.ro george@cicnet.ro