MySQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMySQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 10th, 2000, 05:00 PM
IdNotFound IdNotFound is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2000
Location: Niteroi, RJ, Brazil
Posts: 30 IdNotFound User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
Send a message via ICQ to IdNotFound
I am using MySQL with PHP and when trying to divide a result in multiple pages of 10 results each, I asked myself something that I couldn't answer...

What is faster?

1) Two selects
SELECT id FROM table
SELECT * FROM table LIMIT 10


2) or one BIG select?
SELECT * FROM table

I need to get the toatl results so the script can display the correct number of pages.

Since it applies to searches too, the select may be big, like:

SELECT * FROM table WHERE keyword LIKE "%key1%" AND keyword LIKE "%key2%" AND keyword LIKE "%key3%" ...

So, what is the fastest solution?

Thanks!!

------------------
Eduardo Teixeira Cardoso
PHP Programmer from Brazil
idnotfound@vircio.com.br

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMySQL Help > What "kind" of SELECT is faster?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT