Javascript backend scripts - Query response hangs

I am modifying a database Read script to filter based on data within a related table.
However, when this is executed from my iOS app, it hangs. A response is never sent back.
Here's what I have. What am I doing wrong?
function read(query, user, request) {
var helpers = require('../shared/helpers.js');
helpers.getUserEmailNew(user, function (email) {
//console.log("User '%j' maps to email address: %j", user, email);
// Return surveys for the currently authenticated user
// by the email address we just found.
var sql = 'select * from SurveyAnswer where SurveyId in ' +
'(select id from survey where username = ? and submitted = 0 and __deleted = 0)';
mssql.query(sql, [email], {
success: function(results) {
request.respond(statusCodes.OK, results);
error: function(err) {
console.log("Error retrieving SurveyAnswer records: " + err);
request.respond(500, err);
The referenced getUserEmailNew helper is not the issue as it is referenced in the same way just fine within other scripts.
If there is a better way to include related tables within a query, I'm all ears!
Thanks :)

In digging deeper into this issue, I wanted to prove that the above script was indeed successfully executing. To do this, I added a log entry within the
success callback of my mssql query:
console.log("Retrieved %j SurveyAnswers for %j", results.length, email);
When I observe the logs while my client is requesting this table data, I see entry after entry (essentially running for all eternity before forcing the app to close) the above text. Essentially, it says something like "Retrieved 257 SurveyAnswers for
[email protected]".
Now, as a point of clarification, I am utilizing offline synchronization via the 1.3.2 version of the WindowsAzure.MobileServices component within a Xamarin iOS app. I have no issues with any other table that I am synchronizing data from, but this is the
only table where I'm running a dynamic mssql query instead of simply response.execute().
My first inclination after looking at the logs was that the offline sync process automatically implements data paging. Surely this must mean that not running the response.execute() method is breaking its attempt at paging. To test this theory, I limited
the result set to 10 rows. No dice. Still endless calls by virtue of the above log entries.
For completion's sake, here's my sync call to this particular Read script on the SurveyAnswer table from my mobile app (was working before I switched over to the mssql call):
await this.table.PullAsync(uniqueId, table.CreateQuery());
Again, this same call works for all other tables just fine, as well as this table while I was still implementing a simple response.execute() within my read script on the server.
What am I missing here? This is driving me nuts! Is there a better way to include other tables within my select query than how I'm doing it above? I figure it is possible to run a response.execute() and then in the success callback, make a separate call
to the other table and then loop through my results, removing any that don't apply, but this seems like it would be wildly inefficient, especially if I'm dumping thousands of records.
Thoughts? Suggestions? Please?

Similar Messages

  • How to get query response time from ST03 via a script ?

    Hello People,
    I am trying to get average query response time for BW queries with a script (for monitoring/historisation).
    I know that this data can be found manually in ST03n in the "BI workload'.
    However, I don't know how to get this stat from a script.
    My idea is to run a SQL query to get this information, here is the state of my query :
    select count(*) from sapbw.rsddstat_olap
    where calday = 20140401
    and (eventid = 3100 or eventid = 3010)
    and steptp = 'BEX3'
    The problem is that this query is not returning the same number of navigations as the number shown in ST03n.
    Can you help me to set the correct filters to get the same number of navigation as in ST03n ?
    Regards.

    Hi Experts,
    Do you have ideas for this SQL query ?
    Regards.

  • How to find the backend  SQL query of the JSP page in OIC

    Does anybody how the best way to find the backend SQL QUERY of OIV JSP page?

    How To Generate Trace Files in in HTML/JSP (using Profile Option)
    •     • Note: This requires proper responsibility to set SQL Initialization statement using Profile option.      
         Step 1.     Login to the desired Form application.     
         Step 2.     Select +Profile >> System ('Find System Profile Values' screen will pop up)     
         Step 3.     Check 'User' and Type in the Username (in which the account for that user will be trace)     
         Step 4.     Type 'Initialization%' in the Profile box and Hit 'Find' (Click here for preview.)     
         Step 5.     In the User box, type the following statement and Hit 'Save' (Click here for preview)
         BEGIN FND_CTL.FND_SESS_CTL('','','TRUE','TRUE','','ALTER SESSION SET TRACEFILE_IDENTIFIER = TESTING MAX_DUMP_FILE_SIZE = 5000000 EVENTS ='||''''||' 10046 TRACE NAME CONTEXT FOREVER, LEVEL 12'||'''');END;     
         Note:     specify any name you like to identify your trace, in this case, testing is the end name on the trace. You can also specify the amount of data allowable to be in the trace, in this case, 5000000 is the amount set. Make sure you hit 'Save' afterwards.[Quotes in the statement are all 'Single' quotes.]
              specifying TRACEFILE_IDENTIFIER value is mandatory when setting up the trace using the above profile option value
         Step 6.     Login to HTML / JSP page with username/password and start your flow. (Everything you do once login to HTML / JSP will get trace.)     
         Step 7.     Logout of HTML / JSP application once you completed with your flow.      
         Step 8.     Go back to the Profile option in the Form application and delete the Initialization SQL statement, and Hit 'Save'.     
         Step 9.     Log in to the database server or login server and retrieve your trace file.
         Identify and retrieve the trace file using the tracefile_identifier specified in Step 5.
         In this case the tracefile_identifier is “TESTING”. (Click here for Trace file locations) *     
         Note:     If you need to regenerate your trace or tracing a new flow, then repeat Step 1 to Step 8. To avoid self-confusion, choose a different name for your trace identifier everytime you set to trace.     
         Step 10.     See TKPROF section on how to format trace file into readable text.
         Trace Options Definition
         No Trace          Tracing is not activated
         Activities will not get traced.
         Regular Trace
         (Level 1)          Contains SQL, execution statistics, and execution plan.
         Provides execution path, row counts as well as produces smallest flat file.
         Trace with Binds
         (Level 4)          Regular Trace plus value supplied to SQL statement via local variables.
         Trace with Waits
         (Level 8)          Regular Trace plus database operation timings that the SQL waited to have done in order to complete, i.e. disk access.
         Trace with Binds and Waits
         (Level 12)          Regular trace with both waits and binds information.
         Contains the most complete information and will produce the largest trace file.
    ****Send me an email to [email protected],I will share the document with you.

  • Help required in optimizing the query response time

    Hi,
    I am working on a application which uses a jdbc thin client. My requirement is to select all the table rows in one table and use the column values to select data in another table in another database.
    The first table can have maximum of 6 million rows but the second table rows will be around 9000.
    My first query is returning within 30-40 milliseconds when the table is having 200000 rows. But when I am iterating the result set and query the second table the query is taking around 4 millisecond for each query.
    the second query selection criteria is to find the value in the range .
    for example my_table ( varchar2 column1, varchar2 start_range, varchar2 end_range);
    My first query returns a result which then will be used to select using the following query
    select column1 from my_table where start_range < my_value and end_range> my_value;
    I have created an index on start_range and end_range. this query is taking around 4 millisseconds which I think is too much.
    I am using a preparedStatement for the second query loop.
    Can some one suggest me how I can improve the query response time?
    Regards,
    Shyam

    Try the code below.
    Pre-requistee: you should know how to pass ARRAY objects to oracle and receive resultsets from java. There are 1000s of samples available on net.
    I have written a sample db code for the same interraction.
    Procedure get_list takes a array input from java and returns the record set back to java. You can change the tablenames and the creteria.
    Good luck.
    DROP TYPE idlist;
    CREATE OR REPLACE TYPE idlist AS TABLE OF NUMBER;
    CREATE OR REPLACE PACKAGE mypkg1
    AS
       PROCEDURE get_list (myval_list idlist, orefcur OUT sys_refcursor);
    END mypkg1;
    CREATE OR REPLACE PACKAGE BODY mypkg1
    AS
       PROCEDURE get_list (myval_list idlist, orefcur OUT sys_refcursor)
       AS
          ctr   NUMBER;
       BEGIN
          DBMS_OUTPUT.put_line (myval_list.COUNT);
          FOR x IN (SELECT object_name, object_id, myvalue
                      FROM user_objects a,
                           (SELECT myval_list (ROWNUM + 1) myvalue
                              FROM TABLE (myval_list)) b
                     WHERE a.object_id < b.myvalue)
          LOOP
             DBMS_OUTPUT.put_line (   x.object_name
                                   || ' - '
                                   || x.object_id
                                   || ' - '
                                   || x.myvalue
          END LOOP;
       END;
    END mypkg1;
    [pre]
    Testing the code above. Make sure dbms output is ON.
    [pre]
    DECLARE
       a      idlist;
       refc   sys_refcursor;
       c number;
    BEGIN
       SELECT x.nu
       BULK COLLECT INTO a
         FROM (SELECT 5000 nu
                 FROM DUAL) x;
       mypkg1.get_list (a, refc);
    END;
    [pre]
    Vishal V.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How to obtain the Query Response Time of a query?

    Given the Average Length of Row of tables and the number of rows in each table,
    is there a way we get the query response time of a query involving
    those tables. Query includes joins as well.
    For example, suppose there 3 tables t1, t2, t3. I wish to obtain the
    time it takes for the following query:
    Query
    SELECT t1.col1, t2.col2
    FROM t1, t2, t3
    WHERE t1.col1 = t2.col2
    AND t1.col2 IN ('a', 'c', 'd')
    AND t2.col1 = t3.col2
    AND t2.col1 = t1.col1 (+)
    ORDER BY t1.col1
    Given are:
    Average Row Length of t1 = 200 bytes
    Average Row Length of t2 = 100 bytes
    Average Row Length of t3 = 500 bytes
    No of rows in t1 = 100
    No of rows in t2 = 1000
    No of rows in t3 = 500
    What is required is the 'query response time' for the said query.

    I do not know how to do it myself. But if you are running Oracle 10g, I believe that there is a new tool called: SQL Tuning Advisor which might be able to help.
    Here are some links I found doing a google search, and it looks like it might meet your needs and even give you more information on how to improve your code.
    http://www.databasejournal.com/features/oracle/article.php/3492521
    http://www.databasejournal.com/features/oracle/article.php/3387011
    http://www.oracle.com/technology/obe/obe10gdb/manage/perflab/perflab.htm
    http://www.oracle.com/technology/pub/articles/10gdba/week18_10gdba.html
    http://www.oracle-base.com/articles/10g/AutomaticSQLTuning10g.php
    Have fun reading:
    You can get help from teachers, but you are going to have to learn a lot by yourself, sitting alone in a room ....Dr. Seuss
    Regards
    Tim

  • OBIEE -10.1.3.4.1 - high physical and logical query response

    Hi All,
    I am facing an performance issue in OBIEE 10g .My report is taking 2 mins to come up and when i fired the physical query in the db the data is coming in 2 secs.
    Below is the details from the log file.Here I observed that response time for physical and logical query is 109 sec ~ 2 mins.Please provide me the helpful pointers.
    +++Administrator:370000:370015:----2013/01/22 07:28:04
    -------------------- Execution Node: <<2650466>>, Close Row Count = 3332, Row Width = 26000 bytes
    +++Administrator:370000:370015:----2013/01/22 07:28:04
    -------------------- Execution Node: <<2650466>> DbGateway Exchange, Close Row Count = 3332, Row Width = 26000 bytes
    +++Administrator:370000:370015:----2013/01/22 07:28:04
    -------------------- Execution Node: <<2650466>> DbGateway Exchange, Close Row Count = 3332, Row Width = 26000 bytes
    +++Administrator:370000:370015:----2013/01/22 07:28:04
    -------------------- Query Status: Successful Completion
    +++Administrator:370000:370015:----2013/01/22 07:28:05
    -------------------- Rows 3332, bytes 86632000 retrieved from database query id: <<2650466>>
    +++Administrator:370000:370015:----2013/01/22 07:28:05
    -------------------- Physical query response time 109 (seconds), id <<2650466>>
    +++Administrator:370000:370015:----2013/01/22 07:28:05
    -------------------- Physical Query Summary Stats: Number of physical queries 1, Cumulative time 109, DB-connect time 0 (seconds)
    +++Administrator:370000:370015:----2013/01/22 07:28:05
    -------------------- Rows returned to Client 3332
    +++Administrator:370000:370015:----2013/01/22 07:28:05
    -------------------- Logical Query Summary Stats: Elapsed time 109, Response time 109, Compilation time 0 (seconds)

    Did you run the SQL from a client on the OBIEE server or your local machine? Does the Physical SQL on the OBIEE server against the DB run in 2 Seconds and when sent by the OBIEE server it takes 109 seconds?? Is that correct?

  • SQL Query Editor Hangs Completely!

    Hi,
    I am working on Dell Precision 360,Windows XP with 512MB RAM.
    Problem is Studio creator works almost well with the 512MB RAM(esp. by increasing the process priority),
    but whenever I open the SQL Query Editor to edit a query it hangs completely.
    I don't think it hangs due to memory shoratge problem.
    what could be the reason or is their some other alternative ,coz whenever it hangs i have to manually kill the process due to which sometime some files get corrupted.

    Hi,
    The system requirements for Creator 2 can be found at:
    ttp://developers.sun.com/prodtech/javatools/jscreator/features/sysreqs/index.html
    As can be seen 1 GB RAM is required. At 512 MB the performance will be affected.
    Cheers
    Giri

  • Sql Query Editor hangs

    Hi after attaching a table component in a jsp.....and the selecting the table from the datasource...... the Sql Query editor hangs when trying to click on the table-nameRowset entry in the outline..
    could anybody tell me what might be wrong

    Hi,
    The system requirements for Creator 2 can be found at:
    ttp://developers.sun.com/prodtech/javatools/jscreator/features/sysreqs/index.html
    As can be seen 1 GB RAM is required. At 512 MB the performance will be affected.
    Cheers
    Giri

  • How to get Query response Time?

    II am on BI 7.0. I ran some queries using RSRT command. I want to find how much time the queries took.
    I went to
    st03 -> expert mode -> BI system load-> select today / week/month according to the query runtime day
    I do not see any Info Providers. Query was on a cube so why no Info Providers.
    Does something have to turned on InfoPorvider to show.
    When I look  in RSDDSTAT_OLAP table, I do see many rows but cannot make any sense. Is there some documentation on how to get total  query time from this table?
    Is there any other way to get query response time?
    Thanks a lot.

    HI,
    why not use RSRT ? You can add database statistics option in "Execut & Debug" and you get all the runtime metrics of your query
    In transaction RSRT, enter the query name and press u2018Execute +Debugu2019.
    Selecting u2018Display Statistics Datau2019 .
    After executing the query will return a list of the measured metrics.
    The event id / text describes the steps  (duration in seconds):
    "OLAP: Read data" gives the SQL statements repsonse time (ok - because the SAP
    application server acts as an Oracle client a little network traffic from the db server is included,
    but as far as you not transferring zillions of rows it can be ignored)
    But it gives you much more (i.e. if the OLAP cache gets used or not )...
    In the "Aggreagate statistcs" you get all the infoproviders involved in that query.
    bye
    yk

  • Disabling cached query responses?

    Here's the problem I have...
    Whenever I go to our SharePoint site to upload a document, CSA will flag whatever file I click on in the "Open file" window (before I go to upload) and query me if I want to give access to iexplore.exe to read the file. If a normal user is in this situation, they'd probably click no. Then, when you go to upload that file, the access is automatically blocked by the remembered query answer.
    The query I've made (I made a specific one for this) DISABLES the "Don't Ask Me Again" option. My question is how can I disable all cached responses so that users can deny access in a certain situation, then grant access in another? Or is there a way to force the Agent to clear it's cached responses every couple minutes?

    It is the Don't ask again checkbox available from the Query Settings page in the MC that controls whether the end user has the ability to have a query response remembered permanently. As the administrator, you decide whether or not users have the option to choose Don't ask again. If user queries do not include a Don't ask again option and responses are only cached temporarily (for approximately an hour) users can click the Clear button in the agent Query User Responses window to delete all temporarily cached responses.
    Look at the URL for more information
    http://www.cisco.com/en/US/products/sw/secursw/ps5057/products_configuration_guide_chapter09186a0080424780.html#wp962337

  • Fact Dimension Attribute causing extreme slow query response

    I am using SSAS OLAP in SQL Server 2012. My server has 16 GB or RAM - it has only OLAP engine that is being used - nothing related to the relational engine. My fact table has a column called Product Status - for which I've a Fact dimension. Fact table has
    18M rows, but the Product Staus has only 2-3 distinct values. When my users bring that attribute in their analysis, the response time is very slow - 10 to 15 minutes. Can anyone share their experiences with how I can go about optimizing this?
    I tried to use the user based optimization, but the wizard suggests no aggregations.
    Thanks!
    GBM

    Hi GBM,
    For a cube of moderate to large size, partitions can greatly improve query performance, load performance, and ease of cube maintenance. Have you define partitions in your cube? Here is a good article regaridng Analysis Services Query Performance Top 10 Best
    Practices for your reference, please see:
    http://technet.microsoft.com/en-us/library/cc966527.aspx
    To troubheshoot MDX query performance issue, we can create a trace to capture some events for further investigation in this case. Please see the articles below how to troubleshoot SSAS MDX query performance issue:
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/f1f57e7b-eced-4009-b635-3ebb1d7fa5b0/how-do-i-troubleshoot-the-slow-mdx-query-performance
    http://www.mssqltips.com/sqlservertip/2886/improving-sql-server-analysis-services-query-response-time-with-msmdsrv/
    Hope this helps.
    Regards,
    Elvis Long
    TechNet Community Support

  • Rules of thumb for acceptable query response times?

    Once I read a statement from SAP which said that users typically tolerate
    response times up to 7 seconds. So you should strive to achive this goal.
    Unfortunately I cannot remember in which document or webpage this
    statement was made. Does anybody happen to have a reference for this rule
    or any other SAP rules about the BW query response times?
    Regards,
    Mark

    Share with us the situations where your query is running slow. How many rows are you returning via SQL Commands?
    On reports; the maximum row count being returned and/or the pagination scheme can have impact on performance.
    Jeff

  • About Firefox plug-ins/scripts without response, don't ask me agin~

    for image:http://zhidao.baidu.com/question/1510245430866340020.html?quesup2&oldq=1
    hi, guys, english is my second language, but I'll try my best~~~
    Sometime I use Firefox, will tint “Have no response to the script or plugin”, my question is when I choose “don't ask me agin”:
    1. If hint show again, ALL WEB will According to my choice;
    2. If hint show again, ONLY THIS WEB will According to my choice;
    Which one Firefox will perform?
    and, if i close firefox, “don't ask me agin” Settings are saved? (or Just for this time, when i start Firfox agin, the hint will show again )
    the last question, How can I cancel “don't ask me agin”

    Do you mean the unresponsive error message about a JavaScript that is running?
    That choice is stored globally for all web pages.
    As this can block the Firefox use interface, it is best not to select that choice.
    You can reset the related pref on the <b>about:config</b> page via the right-click context menu to undo this choice.
    *http://kb.mozillazine.org/dom.max_script_run_time
    *http://kb.mozillazine.org/Unresponsive Script Warning

  • Javascript to java - applet.requestfocus hangs browser

    Following is my javascript which invokes the method jsSetFocus() on the applet to set focus on a button in applet.
    <script>
    function appletSetFocus() {
    document.applet.jsSetFocus();
    document.applet.requestFocus(); //this line has problem
    window.onfocus = appletSetFocus;
    </script>
    Everything works perfectly on the first invocation of the applet. When i hit the refresh button to reload the applet the browser hangs. If i go to some other page and then come back to the applet the second time in this case also it is working properly.
    The problem occurs on the refresh button and only on the requestfocus line. If this line is commented, then
    everything is great again....
    I am using 1.3.1, IE 5.5 sp1, NT4 sp6.
    Can anyone help?
    Vineet.

    Forgot to mention... the problem comes only when i hit refresh and go to some other window and try to come back to the window with the applet... that when the javascript function is invoked.
    Vineet

  • Is there a way to have your PS script Query the name of your local Mail Server?

    Hey Guys, 
      Really hoping someone can help me out here. I am currently working on a script that Automates the entire user creation process (AD account, Exchange Mailbox, UCM Soft phone). I want this script to be universal for all systems I have to work with.
    By this I mean that I can run the script on various systems (Different Domains) without ever having to modify the code. 
      I have run into a bit of a problem while trying to automate the PSSession component of my script. I would like to be able to run he script and it inserts the relevant Mail server name based on some sort of Lookup or query. I am currently circumventing
    the issue by having a text box pop up asking for the mail server name. It works, but its not really what I want for the end product. Its frustrating seeing as I have overcome similar issues for things like UPNs, AD Server, etc....
       I have though about having it pull from the DNS MX records, but there are a number of different records for different Mail servers.
      Any help would be awesome!

    Notice that this has drifted a whole long way from the original question.  I pointed out that it is easy with Exchange but if the servers are in different companies or are not part of an enterprise deployment then you need to look at the local AD and
    seek to the top. Any one mailbox wwil get you an exchange server to remote into and use the exchange shell to discover the network.
    ¯\_(ツ)_/¯
    Looking back over the thread, that may be my fault.  I mistook the comment about checking MX to mean he's just looking for a mail relay. 
    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

Maybe you are looking for