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

  • Home
  • SEARCH
  • 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 6137631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:45:03+00:00 2026-05-23T17:45:03+00:00

I have to develop a web application for movies. For now, in my database,

  • 0

I have to develop a web application for movies.
For now, in my database, I have a table for the relations between figures and movies and another for the relations between actors (wich are also figures) and movies.
The last one also contains information about the character.

My question in not about the normalization at all, I would like to know if it’s more efficient in term of speed to do two queries for each tables or to merge them to a single one with NULL values for character in some tuples and do a single query ?

EDIT:

The two queries for now (figure side, to get his acting and career):

$query1 = '
        SELECT RelationFigureCardType.department, RelationFigureCardType.job, Movie.card_type_id, Movie.id, Movie.original_name, Movie.release_date, Movie.cover, Movie.cover_ext
        FROM relation_figure_cards AS RelationFigureCard
            RIGHT JOIN relation_figure_card_types AS RelationFigureCardType ON 
                (RelationFigureCard.relation_figure_card_type_id = RelationFigureCardType.id)
            RIGHT JOIN cards AS Movie ON
                (RelationFigureCard.card_id = Movie.id)
        WHERE 
            RelationFigureCard.figure_card_id = '.$figureId.'
            AND RelationFigureCard.last_card_version = 1
        ORDER BY Movie.card_type_id, RelationFigureCardType.priority, Movie.release_date
        ;
    ';

$query2 = '
        SELECT RelationActorCard.is_main, RelationActorCard.is_guest, Movie.card_type_id, Movie.id, Movie.original_name, Movie.release_date, Movie.cover, Movie.cover_ext, Character.id, Character.original_name, Character.cover, Character.cover_ext
        FROM relation_actor_cards AS RelationActorCard
            RIGHT JOIN cards AS `Character` ON 
                (RelationActorCard.character_card_id = Character.id)
            RIGHT JOIN cards AS Movie ON
                (RelationActorCard.card_id = Movie.id)
        WHERE 
            RelationActorCard.figure_card_id = '.$figureId.'
            AND RelationActorCard.last_card_version = 1
        ORDER BY Movie.card_type_id, Movie.release_date
        ;
    ';
  • 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-05-23T17:45:04+00:00Added an answer on May 23, 2026 at 5:45 pm

    I’d strongly suspect the single-query approach to be faster.

    I’d even more strongly suspect it to be faster when you’re not using a stored procedure but executing the two queries one after the other from a scripting interpreter like PHP, or any other process that allows you to interface with MySQL.

    If you want a reliable answer for your case, there is a very simple answer:

    Perform a test for your particular scenario with real data and compare the performance. (This is called “benchmarking”.)

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

Sidebar

Related Questions

I have to develop a web application in Java, a pretty big one with
I need to develop web application using ASP.net with C# to handle mysql database
I must develop a simple web application to produce reports. I have a single
I have an assignment to develop a web application firewall. I have been researching
I have to develop a real-time web application, where the server needs to inform
I'm planning to develop a web application which will have many static pages (about,
I want to develop a web application and I have access this API. In
I need to develop a web application, i have two choices mvc3 straight forward
i'm need to develop and web application that uses maps, and i have two
I have develop a small web application in asp.net (c#) for uploading files into

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.