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

tl;dr: I want a high-level introduction to Rails, which covers what I need to
I know how to get the attributes of an element, using jquery. But I'm
Ok, here's an easy one: I have a table in MySQL where I keep
I add in an interface builder a scroll view to the view, and included
I am a beginner to PHP and MySQL so please bear with me... I
I have a Windows Service that monitors a COM port connected to a vendors
So my current project is mostly in Python, but I'm looking to rewrite the
My team and I are working on a .net web app project for the
I am making the classic AR app for Android. I am using a SurfaceView
I have an asp.net mvc 3 application. In this application I have a reminder

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.