Zen Cart Logo
Forums / PayPal Express Checkout support / Paypal_Session Table is Huge

Paypal_Session Table is Huge

Locked

Views: 1,966

Results 1 to 14 of 14
This thread is locked. New replies are disabled.
8 Mar 2010, 4:50 PM
#1
ksoup avatar

ksoup

Zen Follower

Join Date:
Jan 2004
Posts:
413
Plugin Contributions:
1

Paypal_Session Table is Huge

Zen 1.3.8

Can this table zen_paypal_session be purged to a certain point? It is over 100MB. Is that typical?

8 Mar 2010, 9:37 PM
#2
cjpinder avatar

cjpinder

Totally Zenned

Join Date:
Apr 2007
Location:
Herts. UK
Posts:
893
Plugin Contributions:
0

Re: Paypal_Session Table is Huge

Hmm...well I've had a look at that table on my own site and been through the ZC code. As far as I can tell stuff goes into that table but is never removed from it. The only exception to this is if you are using PDT in which case the session record is removed when a successful PDT is recorded. Without PDT the session information stays there forever.

So if you are using straight PayPal IPN (without PDT) the table will just keep growing and growing.

As far as I can see, once the order has come through into the ZC Admin, the record in the paypal_session table is no longer required. It may be a bug, I'm not sure.

Maybe DrByte could give his opinion?

Regards,
Christian.

8 Mar 2010, 9:55 PM
#3
cjpinder avatar

cjpinder

Totally Zenned

Join Date:
Apr 2007
Location:
Herts. UK
Posts:
893
Plugin Contributions:
0

Re: Paypal_Session Table is Huge

I just found this thread...
http://www.zen-cart.com/forum/showthread.php?t=103166
...where DrByte says that the table can be purged once all the orders have come through.

The fact that records are never removed from the table looks like a bug to me though. Especially as they have an expiry date on them, you would expect them to be removed after that date.

Regards,
Christian.

8 Mar 2010, 11:22 PM
#4
cjpinder avatar

cjpinder

Totally Zenned

Join Date:
Apr 2007
Location:
Herts. UK
Posts:
893
Plugin Contributions:
0

Re: Paypal_Session Table is Huge

To prune the paypal_session table, first take a backup of your Zen Cart database, then go to Tools > Install SQL Patches, paste in the following...

delete from `paypal_session` where expiry < unix_timestamp();
```...and hit the Send button.

That will remove any PayPal IPN session records that have expired.

Regards,
Christian.
9 Mar 2010, 12:19 AM
#5
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,709
Plugin Contributions:
56

Re: Paypal_Session Table is Huge

Make a suggestion that this be added to Tools->Store Manager. There are other things like this such as email cleanup that might also be good candidates for a page like this.

9 Mar 2010, 12:31 AM
#6
cjpinder avatar

cjpinder

Totally Zenned

Join Date:
Apr 2007
Location:
Herts. UK
Posts:
893
Plugin Contributions:
0

Re: Paypal_Session Table is Huge

swguy:

Make a suggestion that this be added to Tools->Store Manager.
Possibly, but with just one additional line of code the PayPal module can be made to do the clean up automatically in the background without the user ever having to worry about it.

I can see no logical reason for the paypal session information to stay in the table after the expiry date. I think it just got missed.

Regards,
Christian.

9 Mar 2010, 2:53 PM
#7
paulm avatar

paulm

Totally Zenned

Join Date:
Nov 2003
Posts:
1,878
Plugin Contributions:
5

Re: Paypal_Session Table is Huge

CJPinder:

I can see no logical reason for the paypal session information to stay in the table after the expiry date.I think the data should be kept until a final status has been received form Paypal.

Maybe Paypal works different, but in general it's possible that a transaction status is "Payed", but not yet received by the shop. Also after the expiry date.

9 Mar 2010, 6:14 PM
#8
cjpinder avatar

cjpinder

Totally Zenned

Join Date:
Apr 2007
Location:
Herts. UK
Posts:
893
Plugin Contributions:
0

Re: Paypal_Session Table is Huge

paulm:

I think the data should be kept until a final status has been received form Paypal.

Maybe Paypal works different, but in general it's possible that a transaction status is "Payed", but not yet received by the shop. Also after the expiry date.
The paypal_session records are used solely with PayPal IPN and only need to be kept until the IPN call-back has occurred and the order has been created. After that the information is never used. The expiry time is set for 2 days after the PayPal transaction starts. If the IPN call-back hasn't happened within 2 days it probably isn't going to and you should have taken action about it before then anyway.

Regards,
Christian.

17 Mar 2010, 4:35 PM
#9
ksoup avatar

ksoup

Zen Follower

Join Date:
Jan 2004
Posts:
413
Plugin Contributions:
1

Re: Paypal_Session Table is Huge

Thank you so much, Christian :) Did you make a suggestion for the future? (it would probably sound better coming from you because you obviously know your stuff :) )

All my orders were processed and complete, I ran the query through navicat and the table is so nice and shiny!!! :)

CJPinder:

To prune the paypal_session table, first take a backup of your Zen Cart database, then go to Tools > Install SQL Patches, paste in the following...

delete from paypal_session where expiry < unix_timestamp();

> 
> That will remove any PayPal IPN session records that have expired.
> 
> Regards,
> Christian.
17 Mar 2010, 4:42 PM
#10
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Paypal_Session Table is Huge

The suggestion is noted for future consideration.

In fact, a Store Manager option for this is already built-in to v2.0.0 development code.

17 Mar 2010, 5:42 PM
#11
ksoup avatar

ksoup

Zen Follower

Join Date:
Jan 2004
Posts:
413
Plugin Contributions:
1

Re: Paypal_Session Table is Huge

DrByte:

The suggestion is noted for future consideration.

drbyte... thank you, also for all you do! :)

19 Mar 2010, 10:15 AM
#12
simonbbc avatar

simonbbc

New Zenner

Join Date:
Apr 2009
Posts:
41
Plugin Contributions:
0

Re: Paypal_Session Table is Huge

Dr Byte sorry to add this one in but regarding sessions, is there a fix or some qwork being done on the Zen Cart IE8 issue when returning back to the site from Paypal.... Only it's causing a lot of trouble with alot of people.

Simonbbc:frusty:

20 Mar 2010, 12:22 AM
#13
simonbbc avatar

simonbbc

New Zenner

Join Date:
Apr 2009
Posts:
41
Plugin Contributions:
0

Re: Paypal_Session Table is Huge

simonbbc:

Dr Byte sorry to add this one in but regarding sessions, is there a fix or some qwork being done on the Zen Cart IE8 issue when returning back to the site from Paypal.... Only it's causing a lot of trouble with alot of people.

Simonbbc:frusty:

It sppears that my problem is with setting cookies and Zen ID be passed back to OR NOT IE8 once I come back to complete the order from Paypal....

HELP, I am really not getting anywhere with this apart from going round in circles...

Can anyone help with this session issue at all...
When I try to pay then look in the session table I have loads of unclosed sessions obviously... but IE8 is not allowing the session to keep going in order to finish the payment....

PLEASE anyone

20 Mar 2010, 1:54 PM
#14
cjpinder avatar

cjpinder

Totally Zenned

Join Date:
Apr 2007
Location:
Herts. UK
Posts:
893
Plugin Contributions:
0

Re: Paypal_Session Table is Huge

simonbbc:

Can anyone help with this session issue at all...
When I try to pay then look in the session table I have loads of unclosed sessions obviously... but IE8 is not allowing the session to keep going in order to finish the payment....
I don't think your issues has anything to do with size of the PayPal sessions table. You might have more luck starting a new thread rather than hijacking an irrelevant one.

You might also try this fix...
http://www.zen-cart.com/forum/showpost.php?p=857376&postcount=30
...which was for a different problem but was to do with IE8 and sessions so may fix your problem too.

Regards,
Christian.