Saturday, June 04, 2005

How to ask questions

Communication, it all comes back to plain old communication.  So many questions I receive assume way too much.  So, I thought I’d write about what needs to be said when you ask questions in any sort of forum.  And what needs to be provided.  That is — what you can do to make it easier and faster to

  • Get an answer. The questions with more left unsaid than said go ignored.
  • Get people interested in answering your question . It is almost like you are making a sale here!  “Hey, look at my question, I’m obviously interested in helping you give me an answer so pay attention to me”.
  • Not get frustrated.  Miscommunication leads to frustration, 100% of the time.

Remember, the internet seems speedy, and it is, but it is very much like a satellite connection.  I have virtually unlimited download bandwidth at home, but it is accompanied by extremely high latencies (turn around time)!  Forums are just like that.  If you don’t supply the needed information up front, you won’t get anything back other than requests for more information!  And then the issue of “context” creeps into play.  We’ll get into all of this in a moment.  So, here is what you need to do (in my opinion).

Provide the Setup data in a useful format

When asking a question on a forum, don’t do this:

ops$tkyte@ORA9IR2> desc orders_temp
 Name                    Null? Type
 ----------------------- ----- ---------- 
 ORDD_ORDER_NUMBER             NUMBER
 ORDD_GROSS_DOLLAR_EXT         NUMBER
 ORDD_PRD_KEY                  NUMBER
 ORDD_CAME_FROM_PRD_KEY        NUMBER
 ORDD_MASTER_RECORD            VARCHAR2(1)
 ORDD_PREPACK                  VARCHAR2(1)

 
ops$tkyte@ORA9IR2> select * from orders_temp;
 
ORDD_OR ORDD_GRO ORDD_PRD_KEY PRD_K O O
------- -------- ------------ ----- - -
7490000    84.24        58709       M Y

 206338 -3359.79              54582 N N

8 rows selected.

Because now someone interested in answering your question will have to turn that into a CREATE TABLE and INSERTS.  You need to take the time to do that.  (Cursed NULLS in there make it especially hard).  And if you have DATES in your data — by all means, to_date them with a DATE FORMAT!!!  Not everyone agrees with you on the default date mask!  And trying to figure out if that number of mmddyyyy or ddmmyyyy can drive you nuts.

create table orders_temp (
ordd_order_number number,
ordd_gross_dollar_ext number,
ordd_prd_key number,
ordd_came_from_prd_key number,
ordd_master_record varchar2(1),
ordd_prepack       varchar2(1))
/

INSERT INTO orders_temp
(ORDD_ … PREPACK)
VALUES
(7490000,84.24,58709,NULL,'M','Y')
/
That is how you need to pose this question  — the create table and the insert intos. And make sure it runs, really — don’t just type it in, actually RUN IT on your system.  Nothing more frustrating than a test case that needs debugging before the debugging of the actual problem can happen!

Provide everything you need

Remember, the person asking the question doesn’t have your comprehensive library of utility functions and everything.  In fact, they likely have nothing you have!  Make it self contained, make it stand alone.  The people reading your questions are not compilers!  If you post 50 lines of code and say ‘it fails’ — but we cannot actually run it on our systems, you will be out of luck.  This leads into the next concept, that of less is more.

Less is More

Really, this is 100% true.  Make the example small enough to fit on the back of a cocktail napkin.  Ask someone to debug 500 lines of your code and you’ll get no takers.  Trim the example down and two things will happen.  First, you’ll probably find your mistake yourself, I usually do!  Yes, it is true, if you pare the example way down, you many times will diagnose your own issues.  Before the internet and forums, this was called “debugging”.  First, we wrote really small routines (easy to digest) and second when something wasn’t working — we had to make it small to understand and be read by others.  When I first started developing, I had a 80x24 screen — 80 characters wide, 24 lines long.  The really senior people had 80x32 screens (and they thought they were really hot because of that).  Things had to be concise.  Second, once you do make it small and still don’t see the issue, the odds that someone will actually be interested enough to take a look go way up

But Be verbose

In your explanation of what is wrong.  If you say “I did this and it didn’t work, why”, you’ll probably just get a response along the lines of “my car won’t start, why?” – IF you get a response at all.  Remember, from where we are sitting — your monitor is very far away from us and crystal balls only work in movies.  You are very close to the problem, it has probably been consuming your attention for hours if not days.  To the people looking at your question however, it is a brand new thing.  They don’t have your insights and wealth of knowledge surrounding the problem.

Provide the Goal

Don’t post your code, your (failed) attempt and say “how can I do this”.  I get those all of the time.  The question goes along the lines of — I’m trying to get a report that looks like this [example here…] from data that looks like this [output of selects here].  I’m using this query [select ….] but it isn’t working.  Help!

There is a lot wrong with that.  First — make sure to provide the SCRIPT to create the table and data.  Second, when you show the outputs — explain “why they are the way they are”.  Don’t expect the person on the other end to be able to deduce it.  Remember, as just stated, you have been consumed by this problem for a while.  We have not.  What is obvious to you is “way out there” to us.  The assumptions you make, we don’t see them.  Understanding the model (the data model — primary, foreign, nullable, etc) and understanding the desired output is key.  Looking at your attempt that doesn’t work — only confuses us mostly!  It is hard to figure out what you might have been thinking as you wrote it — what assumptions about the SQL or PLSQL language for example you made that were wrong (and we don’t share).  That makes it impossible for us to read your failed attempt and figure out what is was meant to do.

And remember, if you cannot phrase your requirements, state your problem, in text – then you have not thought it through yet; you do not know what it is you have to accomplish!  So, if you say “it is really hard to explain”, that means you don’t understand the problem yourself — time to go back to the drawing board and think about it.  You need to be able to document what this thing is doing.

Context

I’m saying this for the third time.  You have been consumed by this problem for hours, days or weeks.  We have not.  When you followup in a threaded discussion, make sure to keep SOME of the context.  For example, on asktom when I get a question that needs more information — the system sends the person asking the question an email with a link back to the site.  The email says “use this link, I need more detail about <whatever>”.  Well, about one in ten people don’t just add additional information — they replace what WAS there with the new information.  Now I have to send them another email asking for the old material back!  I have no idea what the question was.  (that just made me think, maybe the email should say that and now it does, I just updated the template)

This is especially true in an email trail.  I get lots of email as I’m sure we all do.  When I get an email like “I tried what you said, but it did not work.”  — the only thing I can do is reply with “huh?”.  Leave some context, some bread crumbs in there. 

Less is More

This is not a cut and paste mistake, it is here twice.  People who have read my stuff before will understand this analogy — What bind variables are to application development, Less is More is to providing an example to be looked at. 

Make the example 500 lines long — chances are very slim anyone will look at it.  Make it 10 lines long and everyone will.  Do you really need a table with 300 columns to reproduce the issue?  Or would 5 columns do it.  Do these columns need to have insanely long mangled names (you have to love column names from SAP, they are the best).  Or could short — yet meaningful names be used?

Oh and make sure the example output matches the test case, nothing more frustrating then debugging a debugging session! 

Don’t Assume

Don’t assume the person on the other end of the network connection thinks, feels, defaults things, does things — the way you do.  They probably don’t.  State your assumptions.  Examples should be small.  Explanations big.

And don’t get bent out of shape if the person on the other end asks “WHY”.  Why means “you didn’t provide enough information” many times.  Other times Why means “I’ve been doing this stuff for a while, are you really sure you want to make this mistake”.  Don’t get upset of the person trying to help gives you a piece of advice you think was insulting.  It probably wasn’t.  They don’t know you, you don’t know them.  They have no idea how experienced you are (or aren’t).  They don’t know what you tried (or haven’t tried).  Their suggestion might have been obvious to you (and hence ‘insulting’), but not so obvious to them.  Don’t get offended, until both people know who they are talking to — no assumptions about level of knowledge can be made.  And remember, we all overlook the obvious sometimes – I do, you do, we all do – so sometimes stating the obvious is the solution.  So, don’t be insulted.
 

POST A COMMENT

36 Comments:

Blogger Rachel said....

are you sure you aren't also talking about how to deal with Metalink? I learned early on to provide EVERY piece of information I could think of, or I'd get "could you please send me this" a number of times.

Another thing that bothers me when people post questions to the forums is when they flag them as "urgent" and then an hour later post a note yelling at the list members for not answering. Urgent problems should not be sent to an email forum.

When I ask a question, I do try to include the list of what I've done. I do this whether I'm posting to a forum, opening a TAR or asking someone in person. Saves time and energy on both parts, we don't have to reinvent the wheel.

And when answering a question, I'll often say "let me know if I'm making this too complicated or too basic, I don't know how much you know about this"

Courtesy, on both sides of the questioning, never hurts

Sat Jun 04, 08:38:00 PM EDT  

Blogger Thomas Kyte said....

I wasn't talking about asktom only here.

I was talking about ANY forum, ANYWHERE, ANYTIME..

and yes, when I wake up in the morning and see the "my database crashed with XXXX, help me now". Only it is some 8 or 10 hours later. Latency, it is all about LATENCY...

Sat Jun 04, 08:44:00 PM EDT  

Blogger Eric said....

One of the other things I noted when people ask questions is that they don't tell what the problem really is. They have thought of a solution for a problem that is not working. A path has been chosen to solve a problem and the path is not working. An analogy would be to bring a tree down with a heavy axe and then needing a stronger person because you can not lift the axe often enough. While you could also use a saw or a chain saw. The question asked would be like 'How can I become stronger to lift the axe?' while the real question is 'How can I bring the tree down?' And of course this leads to much confusion and not so optimal communication.

Sun Jun 05, 05:46:00 AM EDT  

Anonymous Pratap said....

And provide other info like version of the database.

These issues are not limited to forums alone, but communication within the office. Many times people come and say "this is not working" or "it is failing". Then a lot of to and fro communication follows that just wastes time.

Sun Jun 05, 05:54:00 AM EDT  

Anonymous Anonymous said....

You have shown us a typical "Day in the life of Tom Kyte". IIRC, I havent seen any mention of exercise in your routine. With the kind of sedentary job that we all have, getting a physical workout is very important to overall health, isnt it?

Thanks

Sun Jun 05, 06:39:00 AM EDT  

Blogger Thomas Kyte said....

is that they don't tell what the problem really is

that was the desire behind the "Provide the Goal" section. Tell us what you are trying to accomplish, not what you've done.

versions

I cannot believe I left that off!

Sun Jun 05, 08:44:00 AM EDT  

Blogger Thomas Kyte said....

IIRC

had to go look that up, "if I recall correctly"...

Well, I like working outside (believe that was mentioned) but in the nicely decorated back basement (not, 100% concrete look and feel) there is a lifecycle, stair stepper, weights (they don't get used as much :) and a TV for the news. Try to get down there a couple of times a week when not traveling.

And when traveling, there is always the run from plane to plane as you try to make connections ;)

Sun Jun 05, 08:48:00 AM EDT  

Blogger vexed said....

Tom,

What always surprises me is how often people are awed by your ability to solve and elucidate problems via a very quantitative, scientific approach, when in fact that ability is available to anyone who wishes to follow the guidelines you laid out in this post and those expounded upon in modern science in general.

I don't mean this message to detract from your deep knowledge of Oracle -- your posts are fantastically insightful -- but only to emphasize that such knowledge and insight is not "magic" -- it's reading, thinking, and testing things in a methodical and carefully planned way, and then evaluating the results, something most scientists are trained to do from the get-go. It's called the scientific method, and if more Oracle (and other computer science) practitioners adhered to it, I think there would be many fewer problems and misconceptions about the way things work.

Sun Jun 05, 05:09:00 PM EDT  

Blogger vexed said....

By the way, I model my own expositions when teaching Oracle and/or presenting an argument for a particular solution on your way of delineating, testing, and analyzing the results of a problem.

In particular, with regard to performance issues, my standard response -- *always* -- is "test it." When someone asks "is this the way to do things," even if it's trivial and seemingly "obvious" that it might be, I insist on testing the solution in a real environment. Make no assumptions is my dictum. I am curious as to whether you agree with this approach.

Sun Jun 05, 05:14:00 PM EDT  

Blogger Joel Garry said....

[i]And when traveling, there is always the run from plane to plane as you try to make connections ;) [/i]

http://www.airportgyms.com/

Sun Jun 05, 06:33:00 PM EDT  

Blogger Thomas Kyte said....

my standard response -- *always* -- is "test it."

amen.

Sun Jun 05, 07:07:00 PM EDT  

Blogger Thomas Kyte said....

http://www.airportgyms.com/

trust me, the last thing you want is to be stuck next to me after working out.

It takes at least an hour for my internal thermostat to re-adjust, until then -- well -- "wet" describes it. Not sure I want to be in the middle seat between two people that just worked out either!

;)

Sun Jun 05, 07:09:00 PM EDT  

Anonymous Anonymous said....

I agree with you fully on how to ask a question the right way, but sometimes, even with little information, the way you answer the questions does make me suspicious that you do have a crystal ball, though you have denied having such a thing. Your answers were so to the point, that I was thinking that you are actually sitting in front of my screen and seeing what I see.

Mon Jun 06, 09:32:00 AM EDT  

Anonymous John Spencer said....

Tom:

I have seen many "How to Ask a Question" posts on various forums, and yours was one of the best I've seen. Often these posts are slightly hostile and more than a little condescending. Your's was nicely phrased, and, as always, you state the why's of your advice. Great job.

I would add one piece of advice to your list. If you are getting an error, post it. Not just the top error, but the whole error stack. It helps a lot in debugging.

Mon Jun 06, 10:53:00 AM EDT  

Anonymous Anonymous said....

Tom,
Your guidelines on how to ask a question in a forum are very precise ,very reasonable and to the point as always .
I may add one more item - some people never bothers to update their questions after it has been answered with the results - If the answer has helped , its always good to let everyone know. Saying something like " Thanks Tom , it worked perfectly " should also be part of the good question asking practices.

And what about the other side of the picture - how to answer a posted question :)

I have seen a few times people suggesting what has already been mentioned in the question to have not worked !

Mon Jun 06, 11:13:00 AM EDT  

Blogger Thomas Kyte said....

If you are getting an error, post it.

agreed...

I should have been more clear in

...
But Be verbose
In your explanation of what is wrong. If you say "I did this and it didn't work", why, you'll probably just get a response along the lines of "my car won't start, why?"

Mon Jun 06, 11:13:00 AM EDT  

Blogger Kevin Kirkpatrick said....

One other thing - if you *do* resolve the issue (whether using advice of others, or on your own), please have the courtesy to post a follow-up of what worked.

When I run into a technical issue in a new environment (e.g. two weekends ago, setting up linux for the first time ever), I can search and find posts from 10 other people who ran into the same problem; but not a single one of which includes a post indicating whether/how the issue was fixed (or whether/how the poster got around it).

It's like saying: "You're time is cheap enough to help me fix my problem, but my time is too valuable to help others fix it".

Mon Jun 06, 12:51:00 PM EDT  

Anonymous John Spencer said....

Tom:

"I should have been more clear in

...
But Be verbose"

A very wise man posted http://tkyte.blogspot.com/2005/05/precise.html :-)

I think the emphasis in my previous post should have been on "the whole error stack"

John

Mon Jun 06, 02:27:00 PM EDT  

Anonymous John Kanagaraj said....

Tom,

Another issue that I have seen creep up is one of social/conversational/cultural differences. For example, someone posts a question which needs further clarification and someone would respond with this literal text: "Stupid Question - Did you try XXX followed by YYY?". What the person replying meant was "I am probably asking a stupid question, but did you try XXX followed by YYY?"... BUT to the original poster, it comes across as "You asked a stupid question - you should have tried XXX followed by YYY!". The only solution is understanding from all sides!

Another, very irritating issue (to me at least, and I think for many other here as well), is the use of shorthand such as "Can U help me? R U using version x.y?". This again goes back to the cultural/social issue - one tends to use this style since one's friends use it...

Tue Jun 07, 12:27:00 PM EDT  

Blogger Thomas Kyte said....

Another issue

Absolutely. Some days the way a question is phrased can make me a bit hot under the collar, then I wait to answer it... Most times I believe it to be a misunderstanding, mis-communication. A certain bluntness that was not intended can be conveyed by accident.


And yes, that short hand speak, that would be something that bothers me as well :)

Tue Jun 07, 12:35:00 PM EDT  

Blogger Robert Blackwell said....

You might find this a nice complement to your post.

Thu Jun 09, 09:55:00 PM EDT  

Blogger Thomas Kyte said....

That was very nice.

Lots of head nodding up and down while reading that one. It is a keeper.

Thanks!

Thu Jun 09, 10:12:00 PM EDT  

Anonymous umzugsunternehmen said....

@Robert Blackwell
your posted link doesn´t work!?!

Sat Oct 08, 04:48:00 PM EDT  

Blogger Thomas Kyte said....

umzugsunternehmen

it worked for me?

Sat Oct 08, 05:08:00 PM EDT  

Anonymous umzugsunternehmen said....

@ Thomas Kyte:
sorry, you´re right!!!
strange yesterday it did not.
maybe i had to many beer ;-)

Mon Oct 10, 01:47:00 PM EDT  

Anonymous Anonymous said....

Tom,
I am wondering that How can i ask you a question thru asktom.oracle.com

Thnaks,
Teja

Tue Nov 22, 08:02:00 AM EST  

Blogger Thomas Kyte said....

when I am available to take them, there is a button on the home page to submit them.

Tue Nov 22, 08:35:00 AM EST  

Anonymous Anonymous said....

Hi Tom,

Time is now March 2006.
When do you think you will be available next to accept more Questions on your site ?

Tue Mar 21, 05:15:00 PM EST  

Anonymous Anonymous said....

Hi Tom,

I wanted to know how to write a sql query to select a particular city from a list of states.

For eg: Suppose there is city LA and Tacoma. These two cities can exist in different states. I want a query to select only from CA. Pls advice.

Thu Dec 14, 05:07:00 PM EST  

Blogger Charlie 1 木匠 said....

The INSERT SQL is broken,

It should be:

INSERT INTO orders_temp
(ORDD_ORDER_NUMBER, ORDD_GROSS_DOLLAR_EXT, ORDD_PRD_KEY, ORDD_CAME_FROM_PRD_KEY, ORDD_MASTER_RECORD, ORDD_PREPACK)
VALUES
(7490000,84.24,58709,NULL,'M','Y')

Thu Jul 16, 03:30:00 PM EDT  

Anonymous bobby said....

hi tom,

where does a newly created table goes (to buffer or to datafile) ???

Fri Jun 11, 12:26:00 AM EDT  

Blogger Thomas Kyte said....

@bobby

the table goes to the system catalog, which might be cached in the buffer cache, might not be cached in the buffer cache.

the table data does the same. The answer is "it depends, it goes where it goes"


Probably, a create table as SELECT will do a direct path load (to disk)

A create table, followed by an insert as SELECT will probably go to cache.

A create table followed by an insert /*+ APPEND */ as select will probably go to disk

A create table followed by insert values will probably go to cache.

Fri Jun 11, 06:56:00 AM EDT  

Anonymous Anonymous said....

select
count(*) as "total",
to_char(ea.revdt,'Mon') as "month",
prog.pro_code,
(sum(ea.amtapprop) / ea.amtapprop) as "totalAmount"
from csris_ea_m ea
join csris_progmon_m prog on ea.progmonid=prog.progmonid
group by to_char(ea.revdt,'Mon'), prog.pro_code

everytime i execute my query it returns ORA-00979: not a GROUP BY expression

Wed Aug 25, 07:16:00 AM EDT  

Blogger Thomas Kyte said....

@anonymous

funny how on a posting about how to ask a question (with a section on providing the setup in a useful form and provide everything you need) - you pose a question that goes against everything written.

when I run your query, I receive "table or view does not exist" - not sure why you get what you get - maybe because *you have some tables with those names????*

but if you look at your query, it should be obvious:

select
count(*) as "total",
to_char(ea.revdt,'Mon') as "month",
prog.pro_code,
(sum(ea.amtapprop) / ea.amtapprop) as "totalAmount"
...

count(*) = aggregate
to_char(ea.revdt,'mon') = group
prog.pro_code = group
sum(ea.amtappro) = aggregate
ea.amtapprop = group


I'm not sure what you are trying to achieve with:

(sum(ea.amtapprop) / ea.amtapprop) as "totalAmount"


as that would just be the same as the count(*)....


Maybe you need to post your "goal" as well (yet another section in the article!!!!!! )

Wed Aug 25, 11:56:00 AM EDT  

Blogger Shah Firdous said....

Hello Sir,

I got the etiquette of asking questions, yet I didn't find the way to ask you a question? I am almost knew to this world of oracle, could you please let me know how can i ask you a question, I mean provide me the link etc.

Thu Apr 25, 04:40:00 PM EDT  

Blogger Thomas Kyte said....

http://asktom.oracle.com is where i take questions...

Thu Apr 25, 05:03:00 PM EDT  

POST A COMMENT

<< Home