Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8093761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:34:22+00:00 2026-06-05T20:34:22+00:00

In this example below: my $rs = $schema->resultset(‘CD’)->search( { ‘artist.name’ => ‘Bob Marley’ ‘liner_notes.notes’

  • 0

In this example below:

my $rs = $schema->resultset('CD')->search(
{
  'artist.name' => 'Bob Marley'
  'liner_notes.notes' => { 'like', '%some text%' },
},
{
  join     => [qw/ artist liner_notes /],
  order_by => [qw/ artist.name /],
}
);

The DBIx cookbook says that this is the sql that will be generated:

# Equivalent SQL:
# SELECT cd.*, artist.*, liner_notes.* FROM cd
# JOIN artist ON cd.artist = artist.id
# JOIN liner_notes ON cd.id = liner_notes.cd
# WHERE artist.name = 'Bob Marley'
# ORDER BY artist.name

But from the rest of the cookbook, I’ve been lead to believe that the query would only select cd.*, unless of course prefetch was used like so:

my $rs = $schema->resultset('CD')->search(
{
  'artist.name' => 'Bob Marley'
  'liner_notes.notes' => { 'like', '%some text%' },
},
{
  join     => [qw/ artist liner_notes /],
  order_by => [qw/ artist.name /],
  prefetch => [qw/ artist liner_notes/],
}
);

Below is the statement that leads me to believe this:

[Prefetch] allows you to fetch results from related tables in advance

Can anyone explain to me either what I’m missing here? Or not? Thanks a lot!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T20:34:23+00:00Added an answer on June 5, 2026 at 8:34 pm

    The Equivalent SQL contradicts the previous section of the cookbook and looks like an error.

    Join will use the columns from the joined tables when performing the query and applying the filter and sorting conditions, but it won’t return the columns for the joined tables. This means that if you do $cd->artist->name then it will need it to do an additional SELECT artist.* FROM artist WHERE artist.id = ? to get the artist’s name each time you call that statement.

    Prefetch is used to select all columns from the prefetch tables as well. It is more efficient to use prefetch when you actually need those columns, e.g. so you can do $cd->artist->name without needing it to do the additional query. But if you don’t need those columns then you have an unnecessary performance hit for loading up that data.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In the Jquery example below, I would like to expand $(this) before it is
this example below works when hover event is trigered and when its not, its
For this code example below, usually I would use [self fall]; instead of the
Given the example below, can someone please show me how this could be called?
I've simplified my JavaScript code to the example below; this code is giving me
How do you get to the next node below this For example <ul id=secondary-nav>
UPDATE 2011.09.13 This bug has been resolved by Adobe. The example code below now
I know how to do this... I'll give example code below. But I can't
This example uses a StringWriter to hold the serialized data, then calling ToString() gives
An example would set the context right, the example below captures the various states

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.