Re: the results from a query - question - Mailing list pgsql-general

From Tom Lane
Subject Re: the results from a query - question
Date
Msg-id 20843.1049294501@sss.pgh.pa.us
Whole thread Raw
In response to the results from a query - question  ("Johnson, Shaunn" <SJohnson6@bcbsm.com>)
List pgsql-general
"Johnson, Shaunn" <SJohnson6@bcbsm.com> writes:
> explain
> select *
> -- INTO dev_gm_er_prof01
> FROM
>   db2_gm_reg_prof_01
> WHERE
> db2_gm_reg_prof_01.place_of_service = 2 and
> db2_gm_reg_prof_01.diagnosis_cd not like '29%' and
> db2_gm_reg_prof_01.diagnosis_cd  not like '30%' and
> db2_gm_reg_prof_01.diagnosis_cd not like '310%' and
> db2_gm_reg_prof_01.diagnosis_cd not like '311%' and
> db2_gm_reg_prof_01.diagnosis_cd not like '312%' and
> db2_gm_reg_prof_01.diagnosis_cd not like '313%' and
> db2_gm_reg_prof_01.diagnosis_cd not like '314%' and
> db2_gm_reg_prof_01.diagnosis_cd not like '315%' and
> db2_pos_reg_prof_01.diagnosis_cd not like '316%'
      ^^^

Isn't that a typo?

> Is this *really* supposed to bring back 4587594094 rows into this
> table they are trying to create?

If the two tables indeed have ~2K and ~2M rows respectively, then yes,
an unconstrained join of the two will yield ~4G rows ...

            regards, tom lane


pgsql-general by date:

Previous
From: Ian Barwick
Date:
Subject: Re: the results from a query - question
Next
From: Tom Lane
Date:
Subject: Re: Forcing use of indexes