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 3336148
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:06:04+00:00 2026-05-18T00:06:04+00:00

first thing I want to know in between two algorithms which one is better

  • 0

first thing I want to know in between two algorithms which one is better

select table1.* from tabel1 inner join table2 on table1.id = table2.table1_id;

and then to extract or

select * from table2;

and then using foreach loop

select * from table1 where table1.id = table2.table1_id

*Please tell me a plausible reason also

and now I am using zend and i believe that first one is faster and better than second (i don’t know why …just some preconception)

and in zend db profiler, every time I am getting
query :DESCRIBE menu_items time: 0.00084590911865234

is there a way to minimize it?

and please tell me how to join two tables in zend using zend components

regards,

  • 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-18T00:06:05+00:00Added an answer on May 18, 2026 at 12:06 am

    Using inner join is faster than php loop due to the query response time. In the first one you’ll do just one query and the in the second many. The database is prepared to retrieve data, this means that is much faster then join tables manually whith php through different queries.

    To join with zend, you need this (Assuming you’re on Zend_Db_Table):

    $select = $this->select()->setIntegrityCheck(false);
    $select->from(array('t1'=>'table1'))
           ->join(array('t2'=>'table2'),'t2.table1_id =t1.id','*')
           ->where('t1.deleted =?',0) 
           ->group('t1.id')
           ->order('t1.date DESC')
           ->limit(4);
    $result = $this->fetchAll($select);
    

    To prevent DESCRIBE queries you can hardcode the table structure or cache it. Check here:

    http://framework.zend.com/manual/en/performance.database.html

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

Sidebar

Related Questions

I've just upgraded a native C++ project from VS2005-SP1 to VS2008-SP1 The first thing
So I have a table. First thing I want to do is put some
The first thing I do in a public method is to validate every single
I've done many web apps where the first thing you do is make a
I am calling a csh script that the first thing it does is starts
I'm setting up a public site and the first thing on my mind is
I am trying to troubleshoot an MS Access XP database and the first thing
NOTE: I am not set on using VI, it is just the first thing
I've installed PowerShell recently and one of the first things I started looking for
Everything is an object was one of the first things I learned about Ruby,

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.