Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Result Cache for queries with joins
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Eugene Janusov  
View profile  
 More options Oct 31 2008, 8:57 am
From: Eugene Janusov <esy...@gmail.com>
Date: Fri, 31 Oct 2008 05:57:47 -0700 (PDT)
Local: Fri, Oct 31 2008 8:57 am
Subject: Result Cache for queries with joins
Greetings.

I have more than simple code:

$files = Doctrine_Query::create()
        //->useResultCache(true)
        ->from('File f')
        ->innerJoin('f.type t')
        ->where('f.type_id = ?', 5)
        ->orderBy('f.id DESC')
        ->limit(2)
        ->execute();

foreach($files as $file) {
        $justForTest = $file->type->id;

}

Doctrine profiler tells that there is one "execute" event, which DQL
seems like:
SELECT ...
FROM files f
INNER JOIN files_types f2 ON f.type_id = f2.id
WHERE f.type_id = ?
ORDER BY f.id DESC
LIMIT 2

And that is just what I expect.

If uncomment useResultCache(true) line and refresh page two times,
first query with INNER JOIN disappears, which also is expected because
of caching. But now profiler reports about two new additional queries
like:
SELECT ... FROM files_types f WHERE f.id = ?

Why does this happen, and is it correct behavior when using caching?

Doctrine 1.0.3.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jonathan Wage  
View profile  
 More options Oct 31 2008, 9:06 am
From: "Jonathan Wage" <jonw...@gmail.com>
Date: Fri, 31 Oct 2008 08:06:06 -0500
Local: Fri, Oct 31 2008 9:06 am
Subject: Re: [doctrine-user] Result Cache for queries with joins

I don't think so. It sounds like the data from the FileType model is not
being cached and re-constructed back from the cache properly. Can you create
a ticket and test case?

- Jon

--
Jonathan H. Wage
Open Source Software Developer & Evangelist
http://www.jwage.com
http://www.doctrine-project.org
http://www.symfony-project.org

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jonathan Wage  
View profile  
 More options Oct 31 2008, 9:06 am
From: "Jonathan Wage" <jonw...@gmail.com>
Date: Fri, 31 Oct 2008 08:06:45 -0500
Local: Fri, Oct 31 2008 9:06 am
Subject: Re: [doctrine-user] Result Cache for queries with joins

So, since it isn't being reconstructed properly when you access the data it
is issuing individual queries to lazy load the data when you access
properties from the "type" join.

- Jon

--
Jonathan H. Wage
Open Source Software Developer & Evangelist
http://www.jwage.com
http://www.doctrine-project.org
http://www.symfony-project.org

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Eugene Janusov  
View profile  
 More options Nov 2 2008, 11:27 am
From: Eugene Janusov <esy...@gmail.com>
Date: Mon, 03 Nov 2008 03:27:12 +1100
Local: Sun, Nov 2 2008 11:27 am
Subject: Re: [doctrine-user] Re: Result Cache for queries with joins

> I don't think so. It sounds like the data from the FileType model is not
> being cached and re-constructed back from the cache properly. Can you create
> a ticket and test case?

http://trac.doctrine-project.org/ticket/1636
Hope, my first test case for Doctrine is correct.

--
Best regards,
Eugene Janusov.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Eugene Janusov  
View profile  
 More options Nov 4 2008, 12:04 am
From: Eugene Janusov <esy...@gmail.com>
Date: Tue, 04 Nov 2008 16:04:16 +1100
Local: Tues, Nov 4 2008 12:04 am
Subject: Re: [doctrine-user] Re: Result Cache for queries with joins
Hmm. Can't understand…

I've found what is the problem. Doctrine_Record::serialize() removes
references before serialization, therefore data of joined models is not
cached at all.

But then I've found that section "7.1.12 Serializing" of User Manual
states: "Records can be serialized, but remember: Doctrine cleans all
relations, before doing this." So, it looks like a "documented" behavior.

--
Best regards,
Eugene Janusov.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jonathan Wage  
View profile  
 More options Nov 4 2008, 11:38 am
From: "Jonathan Wage" <jonw...@gmail.com>
Date: Tue, 4 Nov 2008 10:38:34 -0600
Local: Tues, Nov 4 2008 11:38 am
Subject: Re: [doctrine-user] Re: Result Cache for queries with joins

Ok. Well document that in your ticket and we'll see if we can come up with a
solution specific for caching so that relationships are maintained.

- Jon

--
Jonathan H. Wage
Open Source Software Developer & Evangelist
http://www.jwage.com
http://www.doctrine-project.org
http://www.symfony-project.org

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google