![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Confirmed User
Join Date: Aug 2002
Posts: 160
|
![]() Say for example you have 10 000 products in a table and they all fall into 30 categories.
Now you want to select 50 products from a couple of those categories (could be any amount between 1-30 of those categories pending on how many the user wants). Do you, A: make one select query to get all 10 000 products and filter the results yourself. or B: make one select query per category(meaning 1-30 queries) and limit each query to 50. Which would be more efficient? |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
WINNING!
Industry Role:
Join Date: Oct 2002
Posts: 14,579
|
If on train going 40 mph. gets a 30 min headstart, when will the train going 55 catch up?
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
Confirmed User
Join Date: Apr 2002
Location: Houston
Posts: 5,651
|
B as long as your query is efficient.
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
Too lazy to set a custom title
Join Date: Jan 2002
Location: Holland
Posts: 9,870
|
B and i dont thinks you wanna show 1000 products at the same time... 20 cats times 50 products .....so B
__________________
Don't let greediness blur your vision | You gotta let some shit slide icq - 441-456-888 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 |
Confirmed User
Join Date: May 2002
Location: MI
Posts: 1,827
|
OR depending on your skill level you use joins and such and if your tables are setup right you might be able to pull all the information you need in a single query with GROUP BY and other similar SQL functions. Do reasearch about the DB type and understand when and when not to use database normalization.
All really depends on the layout and what you are trying to get specifically from it. Andy
__________________
Latest MMA news. http://www.mmawrapup.com |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 |
Confirmed User
Join Date: Aug 2002
Posts: 160
|
yeah. think i'll write both functions and run 'em up against each other.
and yes i do have to much time on hand ![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 |
Confirmed User
Join Date: Aug 2002
Posts: 160
|
ok. you have all the products along with all the category id's in one table. so you want to select 50 products per categoryid, but it's not that easy.
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 | |
Confirmed User
Industry Role:
Join Date: Aug 2001
Posts: 3,578
|
Quote:
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 |
Confirmed User
Join Date: Jul 2002
Location: I Love Ixtapa, Mexico ö
Posts: 616
|
You seem to keep asking questions and its a bit uncclear exactly what you want. However keep in mind one thing ..... let sql do the work as opposed to PHP,Perl, etc. Dont pull out all the data , then sort - you want to sort , etc. then pass the relevant data into your program. You will always get better results if you do the sorting, etc. within sql. If you cant create a query for it, you will need to go back and redesign your db (write it down first , dont create as you go). If you wing it you will run into issues down the road , be they performance, normalization, etc.
Rory ![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#10 |
Confirmed User
Join Date: Aug 2002
Posts: 160
|
thanks allot guys.
i was a bit unsure about 20 queries or one hughe one. |
![]() |
![]() ![]() ![]() ![]() ![]() |