[SQL] Table Copy.

2002-09-19 Thread PostgreSQL Server
HI! I'm new to postgres. I need to have a table as a copy of another one. Example: CREATE TABLE one ( fileda INTEGER, filedb INTEGER, filedc INTEGER ); CREATE TABLE two ( fileda INTEGER, filedb INTEGER, filedc INTEGER ); As on insert to table o

[SQL] DATE TIME INDEX ?

2002-11-16 Thread PostgreSQL Server
I have been tring to use index on timestamps: I have a table with a timestamp filed with index on it. I nned to extract all the ids of the table with datarx >= a date <= a date or between 2 dates I found that the only way to force postgres to use index is: explain select id,datarx::da

[SQL] INDEX PROBLEMS ?

2002-11-16 Thread PostgreSQL Server
On postgres 7.2.3 I have found what follows: explain select * from documents where iddoc>1; Seq Scan on lotti (cost=0.00..831.79 rows=26783 width=98) EXPLAIN explain select * from documents where iddoc=1; Index Scan using lotti_pkey on lotti (cost=0.00..2.26 rows=1 width=98) Why index is n