Re: Greetings folks, dumb question maybe?

From: Richard Broersma <richard(dot)broersma(at)gmail(dot)com>
To: Josh <jgooding(at)ttitech(dot)net>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Greetings folks, dumb question maybe?
Date: 2010-05-12 21:04:49
Message-ID: AANLkTikyHpSv1d6mWLk0NfMJ3mpqqHpmnNfuTf7SY5EO@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Little, Douglas 2010-05-12 21:09:13 Re: Greetings folks, dumb question maybe?
Previous Message Josh 2010-05-12 17:57:14 Re: Greetings folks, dumb question maybe?