|
|
|
| Non-WTF Job: C++ Developer at Good Grievance (Ronkonkoma, NY) |
| « Prev | Page 1 | Page 2 | Next » |
|
It's only fetching the current item_id... not the whole table, unless I'm very much mistaken...
|
Re: Yes, the Table is Still There
2008-07-16 08:03
•
by
Kluge Doctor
(unregistered)
|
|
With a computers, we can bring OCD to the next level!
|
Re: Yes, the Table is Still There
2008-07-16 08:05
•
by
Kluge Doctor
(unregistered)
|
It's the whole table of item_id, every record! |
|
Select $WTF
From Comments Where TRWTF = 'Stupid Developer'; |
Re: Yes, the Table is Still There
2008-07-16 08:07
•
by
anon-e moose
(unregistered)
|
|
better to be safe than sorry
|
|
For a while I was playing an online (American) football sim. Rather than buying forum software (which they could have easily afforded) they decided to write their own. Their justification came down to about 7 different ways of saying "because we want to."
Anyway, one of the things they heard constantly was that their forums ran too slow. Turns out they were calculating # of posts on every page load. The turned off post count (instead of just fixing the bug) and forums sped up by several orders of magnitude. |
|
So ... the real WTF is the forum software? That has never happened before.
|
|
Isn't TRWTF the forum software on THIS site?
|
|
They're allocating 100 characters for the item_id? What are they putting in there, the item's full name and postal address?
|
Re: Yes, the Table is Still There
2008-07-16 08:27
•
by
benza
(unregistered)
|
|
Too bad we don't have the full query, I'm pretty sure it does not even add the item_id and item_lang columns.
|
Re: Yes, the Table is Still There
2008-07-16 08:40
•
by
Arancaytar
|
It executes an SQL query that would fetch all rows (no LIMIT). PHP probably fetches the resulting rows, and even if it doesn't, the poor database server has its work cut out. |
|
And here I thought that the WTF was the "item cache" which is slower than what it's intended to cache...
|
Re: Yes, the Table is Still There
2008-07-16 08:54
•
by
D2oris
(unregistered)
|
Win. |
|
This code reminds me of a certain interview WTF.
"The alter statements lead you to run the CREATE TABLE query, but there is no CREATE TABLE in SQL. What do you do?" |
Re: Yes, the Table is Still There
2008-07-16 09:11
•
by
Thomas P
(unregistered)
|
|
Google code search gives the answer:
http://anotherraid.googlecode.com/svn/trunk/ar/itemstats/includes/itemcache.php The software home page: http://code.google.com/p/anotherraid/ A World of Warcraft raid tracking, planning and in the future dkp-point system. |
That is quite impressive. Let's say it now takes one second to load a page. Before they disabled the count, it was taking one thousand seconds (three orders of magnitude), which is sixteen minutes and forty seconds. I admire your patience to wait that long for a single page! |
|
What could have possibly been the intention of the developer who wrote this?
After the first time it runs, the table is there. End of story! It would have been more efficient to simply catch a database error (which you should be doing anyway) and notify someone there was a problem. {Forgive me if I simply stated the obvious} |
Re: Yes, the Table is Still There
2008-07-16 09:18
•
by
alx
(unregistered)
|
|
This just checks to see if items are cached. if not they are added in the cache table.
My understanding is that the code above should increase performance |
Re: Yes, the Table is Still There
2008-07-16 09:24
•
by
Anon
(unregistered)
|
I'd assume taylonr measures their orders of magnitude as powers of 2 instead of powers of 10. Therefore, 3 orders of magnitude would only be 8 seconds (still longer than I'd be willing to wait). |
|
They need to talk to Aaron from this WTF to learn about “WHERE clauses and other optimization techniques.”
Also, am I the only one that thinks ALTERing db tables on the fly is a bad idea? |
Re: Yes, the Table is Still There
2008-07-16 09:33
•
by
Waffle
(unregistered)
|
RAS Syndrome ! |
|
Is the real WTF that you're using a hunk of opensource code and you didn't file that as a bug or submit a fix?
|
Well, it makes perfect sense if you look at how they purge the cache:
|
|
TRWTF is that noone has mentioned the blatantly incorrect use of ALTER TABLE within application code...
|
|
It's good practise to make sure the table is still there.
After all, if it wasn't there, what would you take pictures against? |
Re: Yes, the Table is Still There
2008-07-16 10:09
•
by
FredSaw
|
This should be a featured comment. |
Re: Yes, the Table is Still There
2008-07-16 10:26
•
by
SawFred
(unregistered)
|
This should be a featured comment. |
|
The real WTF is the app apparently has full privileges on the database instead of SELECT/UPDATE. Forget the massive SELECT being run all the time, if you're creating/altering tables at runtime you're doing something wrong
|
Re: Yes, the Table is Still There
2008-07-16 11:01
•
by
skin
(unregistered)
|
|
agreed!
|
Re: Yes, the Table is Still There
2008-07-16 11:03
•
by
danixdefcon5
|
This code is just waiting for Bobby Tables to come around... |
Re: Yes, the Table is Still There
2008-07-16 11:03
•
by
AlanGriffiths
(unregistered)
|
This is not a featured comment! |
Re: Yes, the Table is Still There
2008-07-16 11:05
•
by
fruey
(unregistered)
|
|
Sorry my bad.
SELECT item_id FROM item_cache there's no WHERE clause at all, you are totally right. WTF? |
|
look at the bright side: at least its not creating a new SQL connection every time its called ;D
|
|
I was sooo disappointed when this post had nothing to do with a wooden table!
|
Well, there are uses for ALTER TABLE in an application, but that isn't one of them. At most, they should go into an admin part that's only used every now and then... np: Underworld - I'm A Big Sister, And I'm A Girl, And I'm A Princess, And This Is My Horse (RiverRun Project) |
PHP doesn't fetch any rows automatically, at least not with any of the APIs that I've used. Still, the DBMS has to perform a full table scan for each comment. Beyond that, this code is just too stupid to comprehend. |
Re: Yes, the Table is Still There
2008-07-16 12:52
•
by
Andrew
(unregistered)
|
Maybe, they're binary orders of magnitude. 2**N grows a bit slower than 10**M. Eight seconds is tolerable. |
Re: Yes, the Table is Still There
2008-07-16 13:06
•
by
AlexG
(unregistered)
|
The alter statements lead you to run the CREATE TABLE query, but there is no CREATE TABLE in SQL. Why is that, Leon? |
|
Anon, Andrew:
I too thought: "Maybe he meant binary?" But on further reflection I can think of any time I've ever seen someone use intelligently use the phrase "orders of magnitude" in anything but base ten. So no. It can't be binary. If you're someone who wants to justify " orders of magnitude" as a binary scale, then you're just as depraved as those hard drive companies and their "GB=1000KB". |
Re: Yes, the Table is Still There
2008-07-16 13:27
•
by
reading nazi
(unregistered)
|
|
But reading earlier posts is not?
|
Re: Yes, the Table is Still There
2008-07-16 13:34
•
by
emurphy
|
Given the sterling quality of the original submission, I have to ask: do the damnfools actually purge the cache this way? |
Re: Yes, the Table is Still There
2008-07-16 14:17
•
by
Anrs
(unregistered)
|
Maybe your assumption is wrong, and it now takes 0,07 seconds to load the page. And maybe "several" can be just two. |
Re: Yes, the Table is Still There
2008-07-16 14:30
•
by
Monkey Brains
(unregistered)
|
Perhaps he meant it in an emotional sense and not a mathematical one, being without a stopwatch and all. Some posters will jump at any chance to display their superior math skills. |
Re: Yes, the Table is Still There
2008-07-16 15:22
•
by
Sigivald
(unregistered)
|
You seem to have an extraneous "the" in there. Let me help: the real WTF is forum software. You're welcome. (Actually, I think the WTF-for-reals is having to use BBCode.) |
I can't think of any situations where altering the database from within application code is the best strategy. However, I'm always on the lookout for better ways to do things. Could you give an example of a use case where altering the DB schema from application code is best practice? (Or maybe you were just trying to be sarcastic in your comment...) |
Re: Yes, the Table is Still There
2008-07-16 15:40
•
by
real_aardvark
|
Ah, the black swan excuse. "I've never seen it, so it can't be true." Or, more precisely in your case, "I may have seen it, but I can't remember it, so from a personal cognitive point of view, it can't be true." Or alternatively, by redefining the sense of "intelligently," you are guilty of petitio principii. I've always been accustomed to think of the final order of magnitude in base ten as "any multiple higher than the square root of ten, and less than ten to the power of 3/2" which just feels like a better bracketing system, somehow. Anyhow ... you're completely ignoring, amongst other things, Pogson's system for measuring apparent magnitude, which measured orders of magnitude by the intuitively obvious multiple of the fifth root of one hundred. If you squinted hard at that web page, maybe it just looked enough like half of the North Star ... |
|
Thank God it was a db table, not a wooden one.
Imagine a system where every time you request a page, it is printed, put on a wooden table, having a picture taken of it, then that picture is developed, scanned in and shown. But first we need to check if the table is still there, of course. If it is not there, instead of TRUE (picture was taken) or FALSE (picture was not taken), it returns WOODEN_TABLE_NOT_FOUND, leading to the CD tray to open and the server to reset... |
Re: Yes, the Table is Still There
2008-07-16 16:58
•
by
silent d
(unregistered)
|
If it was a wooden table, the app would need to contact a carpenter every time it needed to CREATE a new table or ALTER an existing one. But to DROP a table, anyone strong enough to pick up the table in the first place will do. |
Re: Yes, the Table is Still There
2008-07-16 17:30
•
by
Bobbo
(unregistered)
|
Oxford English dicco says maybe it can't. Just saying, like. |
| « Prev | Page 1 | Page 2 | Next » |