[SQL] Simultaneous Connection Problem
I have a table that is sequence_number (my PK), session_start_time, and session_stop_stime. I would like to query it to determine the max number of simultaneous sessions. Has anyone conquered a problem like this? It seems like it should be in a book somewhere, but I haven't found it yet. Thanks, -- Webb Sprague Programmer O1 Communications
[SQL] Convert from Seconds-Since-Epoch to Timestamp
Hi all, How do I convert from seconds (an integer) to timestamp? I am sure it is easy, but I can't find it in the docs, so far. Thanks Webb __ Do You Yahoo!? Send instant messages get email alerts with Yahoo! Messenger. http://im.yahoo.com/
Re: [SQL] Optimizing huge inserts/copy's
I am experimenting with this too. If I have any indexes at all, the copy's get VERY SLOW as the table gets big. Delete ALL your indexes, do your copy's, and then create your indexes again. Good luck. --- Jie Liang [EMAIL PROTECTED] wrote: Hi, there, I tried different ways, include vaccum table , ensure index works, it still is as slow as ~100rows per minute. Stephan Szabo wrote: On Tue, 29 Aug 2000, Jie Liang wrote: Hi, there, 1. use copy ... from '.'; 2. write a PL/pgSQL function and pass multiple records as an array. However, if your table have a foreign key constraint, it cannot be speed up, I have same question as you, my table invloving 9-13 million rows, I don't know how can I add a foreign key them also? I haven't tried it on really large tables, but does it turn out faster to use ALTER TABLE ADD CONSTRAINT to add the foreign key constraint after the data is loaded and the indexes are created? -- Jie LIANG Internet Products Inc. 10350 Science Center Drive Suite 100, San Diego, CA 92121 Office:(858)320-4873 [EMAIL PROTECTED] www.ipinc.com __ Do You Yahoo!? Yahoo! Mail - Free email you can access from anywhere! http://mail.yahoo.com/
[SQL] Optimizing huge inserts/copy's
Hi all, Does anybody have any thoughts on optimizing a huge insert, involving something like 3 million records all at once? Should I drop my indices before doing the copy, and then create them after? I keep a tab-delimited file as a buffer, copy it, then do it again about 400 times. Each separate buffer is a few thousand records. We do this at night, so it's not the end of the world if it takes 8 hours, but I would be very grateful for some good ideas... Thanks W __ Do You Yahoo!? Yahoo! Mail - Free email you can access from anywhere! http://mail.yahoo.com/
Re: [SQL] Create Primary Key + Massive Copy's?
This is my next approach--I got rid of all indexes and PK's, and then created an index with unique after everything is added. Wish me luck. W --- Stephan Szabo [EMAIL PROTECTED] wrote: We don't currently support the SQL syntax for adding a PK to a table. However, if you have the columns as NOT NULL already, adding a unique index to the columns in question has the same general effect. Stephan Szabo [EMAIL PROTECTED] On Tue, 29 Aug 2000, Webb Sprague wrote: Apropos of my last question: Is there syntax to create a primary key after the table has been defined and populated? I think I could speed things up quite a bit by not having any indexes at all when I do my mass copies. __ Do You Yahoo!? Yahoo! Mail - Free email you can access from anywhere! http://mail.yahoo.com/
Re: [SQL] \copy...
Finally--a question I think I can answer! You need to specify what delimiters you use in your .dat file; the default for COPY is tab, but you can change that to | with copy tablename from '/home/ed/import.dat' delimiters '|' Hope this works...(oops--I mean 'helps') --- Ed [EMAIL PROTECTED] wrote: Hi, I have a file that look like this : firstname|lastname|[EMAIL PROTECTED] firstname2|lastname2|[EMAIL PROTECTED] and a table foo like : firstname varchar(30), lastname varchar(30), emailvarchar(50) and I would like to do a : copy tablename from '/home/ed/import.dat'; But then, everything goes in the first field... what does i'm doing wrong?!?! Frédéric Boucher [EMAIL PROTECTED] Programmation, Support technique Jetumele Communications inc. __ Do You Yahoo!? Send instant messages with Yahoo! Messenger. http://im.yahoo.com/