"Chad Thompson" <chad@weblinkservices.com> writes:
> select l.id, l.full_phone into "8_15_2002_NeverquitPushOneMessaging"=20
> from list_tz l, call_results cr=20
> where client_id =3D 8=20
> and ((cr.result =3D 'Busy') or (cr.result =3D 'Busy-Reorder') or (cr.result=
> =3D 'Busy-Timeout') or (cr.result =3D 'No Signal') or (cr.result =3D 'No C=
> ircuit Signal') or (cr.result =3D 'No Answer') or (cr.result =3D 'No Solici=
> tation'))=20
> and cr.calldate between '6/4/2002' and '8/14/2002';
> call_results is a table with just over 1 million lines, list_tz is a temp t=
> able created in another function w/ anywhere from 10 to 50 K lines.
Perhaps a join condition would be a good idea ;-). As-is, you're
selecting from the cross product of those tables, which could be up to
50 billion lines.
regards, tom lane