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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T09:52:22+00:00 2026-05-18T09:52:22+00:00

a database call wich gets unlimited entries (can be 10 or 10.000), like this:

  • 0
  • a database call wich gets unlimited entries (can be 10 or 10.000), like this:

    SELECT * FROM boo WHERE id = %d AND (approved = '1' OR (user = %d AND approved = '0'))

  • 2 database calls, one which gets exactly 10 entries, and another one which gets a single entry:

    SELECT * FROM boo WHERE id = %d AND approved = '1' LIMIT 10

    SELECT * FROM boo WHERE user = %d AND approved = '0'

note that I can’t make my own db query. I can only use a set of functions that do the queries above…

which option is more efficient / faster?

  • 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-18T09:52:23+00:00Added an answer on May 18, 2026 at 9:52 am

    This is really tough to answer, but here’s an outline to consider to get better performance:

    1. You have not mentioned which columns you are indexing (if you are). Indexing the columns that you want to select and the ones that you use conditions on can help you get a better performance. Keep in mind that indexing will incur heavier write costs, among other things. If your common case for these columns is lookup, I would say go for indexing.

    2. Make sure that you select the columns that you actually need, instead of selecting all. That is another factor that will get you a better performance.

    3. Keep in mind: Each query has its own overhead. Adding more queries will incur more cost.

    4. Keep in mind: You need to actually thing about the average performance. For example, I see that one of your queries is dependent on a certain user. Ask yourself, who are these users, are they just random website users that will have a couple of records associated with them? or are these users a tight community that keep posting and have a lot of comments associated with them? These questions will help you determine and approximate the number of returned results (average) and that should be used to make a good decision about which way you should go with.

    Hope that helps!

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

Sidebar

Related Questions

Hi How can I return an array from a database call. in this format:
How can I call Access's Compact and Repair Database utility from within C++? I'm
how I can call database stored procedure if someone is leaving page? For example,
I got two tables in my database: user and call. User exists of 3
Can you read out the name of a PHP constant from a database and
I would like to make a database call in a partial view in asp.net
I have a normal Database call that gathers information from my database. i use
I have the following values from a database call that I want to apply
I am looking to make a database call based on user input. The line
I have a multidimensional array from a a MySQL database call. It looks something

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.