Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Allow session garbage collection to use an index #6110

Merged
merged 1 commit into from
Apr 14, 2014
Merged

Allow session garbage collection to use an index #6110

merged 1 commit into from
Apr 14, 2014

Conversation

hjr3
Copy link
Contributor

@hjr3 hjr3 commented Apr 8, 2014

Performing arithmetic in the where clause prevents MySQL from using an index. The garbage collection becomes increasingly more expensive to run as traffic grows.

Performing arithmetic in the where clause prevents MySQL from using an index. The garbage collection becomes increasingly more expensive to run as traffic grows.
@@ -164,10 +164,9 @@ public function destroy($id)
public function gc($maxlifetime)
{
$platform = $this->tableGateway->getAdapter()->getPlatform();
return (bool) $this->tableGateway->delete(sprintf('%s + %s < %d',
return (bool) $this->tableGateway->delete(sprintf('%s < %d',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does mysql really not optimize this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I can provide a sql fiddle to prove it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hjr3 it's fine - I was really just wondering why MySQL always manages to disappoint me :D

@weierophinney weierophinney added this to the 2.3.1 milestone Apr 14, 2014
@weierophinney weierophinney self-assigned this Apr 14, 2014
weierophinney added a commit that referenced this pull request Apr 14, 2014
Allow session garbage collection to use an index
weierophinney added a commit that referenced this pull request Apr 14, 2014
@weierophinney weierophinney merged commit eaecf25 into zendframework:master Apr 14, 2014
weierophinney added a commit that referenced this pull request Apr 14, 2014
@hjr3 hjr3 deleted the patch-1 branch April 16, 2014 04:24
weierophinney added a commit to zendframework/zend-session that referenced this pull request May 15, 2015
Allow session garbage collection to use an index
weierophinney added a commit to zendframework/zend-session that referenced this pull request May 15, 2015
weierophinney added a commit to zendframework/zend-session that referenced this pull request May 15, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants