pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
new problem!  Is there any Faster workaround ??
3+ messages / 2 participants
[nested] [flat]

* new problem!  Is there any Faster workaround ??
@ 2002-04-09 21:46 Rajesh Kumar Mallah <mallah@trade-india.com>
  2002-04-10 15:44 ` Re: new problem!  Is there any Faster workaround ?? Jeff Eckermann <jeff_eckermann@yahoo.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Rajesh Kumar Mallah @ 2002-04-09 21:46 UTC (permalink / raw)
  To: pgsql-sql

Hi folks,

I think there is still  a problem ,

email_bank contains  ~ 1  million  records  and t_a contains 58 records
both are indexed on email_id ( integer colmn.)  i want to remove these 58
records
from email_bank  where email_id  in t_a  &  email_bank match.

but the below is still slow !


explain delete from email_bank where exists (select email_id from t_a where
email_bank.email_id=t_a.email_id) ;
NOTICE:  QUERY PLAN:

Seq Scan on email_bank  (cost=0.00..1760313.80 rows=1009397 width=6)
  SubPlan
    ->  Seq Scan on t_a  (cost=0.00..1.73 rows=1 width=4)

EXPLAIN

PS:
I ran  VACUUM ANALYZE on email_bank and t_a and  both are indexed on
email_id  before
the explain .


regds
mallah.


Rajesh Kumar Mallah wrote:

> Hi folks,
>
> We require to do below or similar quite often
>
> DELETE  from t_a where email in (select email from t_b);
>
> everyone knows "IN" is pain fully slow currently in pgsql
> is the any fster alternative to above query
>
> regds
> Mallah.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: new problem!  Is there any Faster workaround ??
  2002-04-09 21:46 new problem!  Is there any Faster workaround ?? Rajesh Kumar Mallah <mallah@trade-india.com>
@ 2002-04-10 15:44 ` Jeff Eckermann <jeff_eckermann@yahoo.com>
  2002-04-11 06:46   ` Re: new problem!  Is there any Faster workaround ?? Rajesh Kumar Mallah <mallah@trade-india.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Jeff Eckermann @ 2002-04-10 15:44 UTC (permalink / raw)
  To: Rajesh Kumar Mallah <mallah@trade-india.com>; pgsql-sql

A join probably will work best for you.  A quick way
to do an implicit join:

delete from email_bank where email_id = t_a.email_id;

--- Rajesh Kumar Mallah <mallah@trade-india.com>
wrote:
> Hi folks,
> 
> I think there is still  a problem ,
> 
> email_bank contains  ~ 1  million  records  and t_a
> contains 58 records
> both are indexed on email_id ( integer colmn.)  i
> want to remove these 58
> records
> from email_bank  where email_id  in t_a  & 
> email_bank match.
> 
> but the below is still slow !
> 
> 
> explain delete from email_bank where exists (select
> email_id from t_a where
> email_bank.email_id=t_a.email_id) ;
> NOTICE:  QUERY PLAN:
> 
> Seq Scan on email_bank  (cost=0.00..1760313.80
> rows=1009397 width=6)
>   SubPlan
>     ->  Seq Scan on t_a  (cost=0.00..1.73 rows=1
> width=4)
> 
> EXPLAIN
> 
> PS:
> I ran  VACUUM ANALYZE on email_bank and t_a and 
> both are indexed on
> email_id  before
> the explain .
> 
> 
> regds
> mallah.
> 
> 
> Rajesh Kumar Mallah wrote:
> 
> > Hi folks,
> >
> > We require to do below or similar quite often
> >
> > DELETE  from t_a where email in (select email from
> t_b);
> >
> > everyone knows "IN" is pain fully slow currently
> in pgsql
> > is the any fster alternative to above query
> >
> > regds
> > Mallah.
> >
> > ---------------------------(end of
> broadcast)---------------------------
> > TIP 1: subscribe and unsubscribe commands go to
> majordomo@postgresql.org
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: new problem!  Is there any Faster workaround ??
  2002-04-09 21:46 new problem!  Is there any Faster workaround ?? Rajesh Kumar Mallah <mallah@trade-india.com>
  2002-04-10 15:44 ` Re: new problem!  Is there any Faster workaround ?? Jeff Eckermann <jeff_eckermann@yahoo.com>
@ 2002-04-11 06:46   ` Rajesh Kumar Mallah <mallah@trade-india.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Rajesh Kumar Mallah @ 2002-04-11 06:46 UTC (permalink / raw)
  To: Jeff Eckermann <jeff_eckermann@yahoo.com>; +Cc: pgsql-sql

Thanks Jeff .

i was not aware of this syntax , i will try it
next time  when i require to do something like this.

unfortunately i have deleted this time
using perl dbi


mallah.

Jeff Eckermann wrote:

> A join probably will work best for you.  A quick way
> to do an implicit join:
>
> delete from email_bank where email_id = t_a.email_id;
>
> --- Rajesh Kumar Mallah <mallah@trade-india.com>
> wrote:
> > Hi folks,
> >
> > I think there is still  a problem ,
> >
> > email_bank contains  ~ 1  million  records  and t_a
> > contains 58 records
> > both are indexed on email_id ( integer colmn.)  i
> > want to remove these 58
> > records
> > from email_bank  where email_id  in t_a  &
> > email_bank match.
> >
> > but the below is still slow !
> >
> >
> > explain delete from email_bank where exists (select
> > email_id from t_a where
> > email_bank.email_id=t_a.email_id) ;
> > NOTICE:  QUERY PLAN:
> >
> > Seq Scan on email_bank  (cost=0.00..1760313.80
> > rows=1009397 width=6)
> >   SubPlan
> >     ->  Seq Scan on t_a  (cost=0.00..1.73 rows=1
> > width=4)
> >
> > EXPLAIN
> >
> > PS:
> > I ran  VACUUM ANALYZE on email_bank and t_a and
> > both are indexed on
> > email_id  before
> > the explain .
> >
> >
> > regds
> > mallah.
> >
> >
> > Rajesh Kumar Mallah wrote:
> >
> > > Hi folks,
> > >
> > > We require to do below or similar quite often
> > >
> > > DELETE  from t_a where email in (select email from
> > t_b);
> > >
> > > everyone knows "IN" is pain fully slow currently
> > in pgsql
> > > is the any fster alternative to above query
> > >
> > > regds
> > > Mallah.
> > >
> > > ---------------------------(end of
> > broadcast)---------------------------
> > > TIP 1: subscribe and unsubscribe commands go to
> > majordomo@postgresql.org
> >




^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2002-04-11 06:46 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-04-09 21:46 new problem!  Is there any Faster workaround ?? Rajesh Kumar Mallah <mallah@trade-india.com>
2002-04-10 15:44 ` Jeff Eckermann <jeff_eckermann@yahoo.com>
2002-04-11 06:46   ` Rajesh Kumar Mallah <mallah@trade-india.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox