From: | "Little, Douglas" <DOUGLAS(dot)LITTLE(at)orbitz(dot)com> |
---|---|
To: | Richard Broersma <richard(dot)broersma(at)gmail(dot)com>, Josh <jgooding(at)ttitech(dot)net> |
Cc: | "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Greetings folks, dumb question maybe? |
Date: | 2010-05-12 21:09:13 |
Message-ID: | 8585BA53443004458E0BAA6134C5A7FB061CA5A5@EGEXCMB01.oww.root.lcl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
I've been using the generate_series function and finding it very useful. It generates an integer, but I cast to 'day' interval.
Might be useful.
doug
-----Original Message-----
From: pgsql-sql-owner(at)postgresql(dot)org [mailto:pgsql-sql-owner(at)postgresql(dot)org] On Behalf Of Richard Broersma
Sent: Wednesday, May 12, 2010 4:05 PM
To: Josh
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: [SQL] Greetings folks, dumb question maybe?
On Wed, May 12, 2010 at 10:32 AM, Josh <jgooding(at)ttitech(dot)net> wrote:
> I am trying to create a function that loads 100M test records into a
> database, however I am having a hard time building the function that does
> so.
Here is one idea a function, but is could be wrapped by one:
p2082849b=> INSERT INTO Testtable ( n, c, d )
p2082849b-> WITH RECURSIVE T(n,c,d) as ( SELECT 1, 'A', CAST(
'2009-12-31' AS DATE ) + INTERVAL '1 DAY'
p2082849b(> UNION ALL SELECT n + 1, c, d + INTERVAL '1 day'
p2082849b(> FROM T
p2082849b(> WHERE n <= 10000)
p2082849b-> SELECT n,c,d FROM T;
INSERT 0 10001
--
Regards,
Richard Broersma Jr.
Visit the Los Angeles PostgreSQL Users Group (LAPUG)
http://pugs.postgresql.org/lapug
From | Date | Subject | |
---|---|---|---|
Next Message | Gnanakumar | 2010-05-13 07:04:19 | Re: Invalid message format Exception |
Previous Message | Richard Broersma | 2010-05-12 21:04:49 | Re: Greetings folks, dumb question maybe? |