som3on3 15 Newbie Poster

Hi, i need some help, since mysql benchmark don't work well on select i need help with a query
what will be the fastest way? to use this query:

select * from news n, users u where n.users_id = u.users_id and u.users_id = '1' limit 0, 20

using like this is pretty slow (table are indexed, over 1 billion records)
My question is: if i put this query in a stored procedure and then call it

call showNews(userx)

will be faster? and use lower cpu resources?
Thanks

som3on3 15 Newbie Poster

Micorsoft sucks! they could give winxp for free but... they don't want to do it. that's why they will fall

som3on3 15 Newbie Poster

thanks for the help, found in the end something;
well i need a function like that because i am using multiple types if arrays including array[] so to type everytime sizeof(array)/sizeof(int) takes more time then i desire, and know my code reached 2000 lines, and is not even done yet, hard to write every type of array.size()
so i made this:

template <typename T>
int len(vector< T > array) {
	return (int)array.size();
}

int len(int *array) {
	int size = sizeof(array)/sizeof(int);
	return size;
}

wich helps me a lot for doing:

for(int i=0; i<len(array); i++) {

}

nice, isn't it?
tanks once again

som3on3 15 Newbie Poster

sorry for disturbing;
i have another question

i want to make a function len()

so can return the size of a vector
how can i make

int len( vector< any_type_of_vector(int,string....) array) {
   return (int)array.size();
}

thanks for your time

som3on3 15 Newbie Poster

really thanks for your big help, can i vote you somewhere or something like this?

Salem commented: You click on "Add to reputation" at the top of each post +15
som3on3 15 Newbie Poster

ok, now how can i put all that array in a new array?
so that i can have more then 1 array["fruit"] = "apple";
??
to be array["fruit"] = apple;
array["fruit"] = strawberry;
array["car"] = bmw;
array["car"] = audi;

please help :(

som3on3 15 Newbie Poster

Thanks!!!!

som3on3 15 Newbie Poster

can anyone help me convert this to c++??

<?php
function show_me($info) {
$arr = array('fruit' => 'apple', 'car' => 'bmw');
return $arr[$info];
}


echo show_me('fruit');
//or echo show_me('car')
?>