Page 1 of 1

DB query VS Cookies VS ??

Posted: Wed Jun 23, 2004 3:37 am
by rxsid
Hi all,

I've got a web page that already makes a MySQL connection to get data for display in the middle of the page. There are 25 rows of data that are extracted and displayed.

I want to be able to have a smaller section to one side of the page, display other information...hyperlinks (perhaps up to 10 max). I'm thinking about storing these links in another table under the respective user that's logged in (therefore making these links personalized, not site standard for everyone).

My concern is that by adding a whole new db query (I realize that I can utilize the same mysql_connection, since the tables would be in the same db) to a different table, this would be a slower solution than that of other ways...such as storing the personalized links in a cookie after doing a one time only query.

Would it be better to get the link data from the db each time the page is loaded (or other pages that would display them as well), or query the db 1x then read the cookie's each time the links need to be displayed. Or is there an even better solution? What about sessions or caching (I know next to nothing about both of those)?

Thanks in advance!

Posted: Wed Jun 23, 2004 3:40 am
by feyd
sql servers are designed to be quite fast and handle very large databases and complex queries with ease. Saying that, having 2 simple queries in a given page is trivial for it.

Posted: Wed Jun 23, 2004 3:43 am
by rxsid
thanks feyd!

that's the kind of info/reassurance I was hoping to find regarding the db side of the question.

Posted: Wed Jun 23, 2004 6:48 am
by fastfingertips
Offcourse from the server list you should exclude Sybase and Firebird because they are not accompling to:
sql servers are designed to be quite fast and handle very large databases and complex queries with ease

Posted: Wed Jun 23, 2004 7:03 am
by malcolmboston
feyd wrote:sql servers are designed to be quite fast and handle very large databases and complex queries with ease. Saying that, having 2 simple queries in a given page is trivial for it.
i have 10+ plus queries on many of my web-sites, including insert, delete, update and select statements

i have noticed no real slowdown whatsoever and my pages load up as fast in my eyes as a standard HTML page even though its very PHP heavy.

i think it very much depends on the way you organise your queries.

Posted: Wed Jun 23, 2004 11:15 am
by feyd
It can depend on organization... but I've seen queries that are 6 pages of code, that execute extremely fast. No stored procedures (outside the built-in functions).. So it's pretty safe to assume that 2 queries of almost any size and form will run pretty damn fast.