Speeding up in-line queries

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default Speeding up in-line queries

    Hi All

    I know this is a 'try it yourself' thing, but is it generally true that
    in-line query (A):

    strSQLQuery = "update accounts set fred='" & strfred & "',bob='" & strbob &
    "', etc

    is not pretty to read as one long string, BUT a lot faster to execute than
    in-line query (B):

    strSQLQuery = "update accounts set "
    strSQLQuery = strSQLQuery & "fred='" & strfred & "',"
    strSQLQuery = strSQLQuery & "bob='" & strbob & "',
    etc etc

    Yes?

    Thanks

    Robbie


    Astra Guest

  2. Similar Questions and Discussions

    1. Speeding up SQL queries
      Hello group, I have a database with a lot of entries (I'm talking about ten-thousands) running on a rather slow machine (500 Mhz, 128 Mb memory)....
    2. Need help speeding up an algorithm...
      I created a pretty simple Perl script to create .m3u files for all genres in my music library. (I eventually want to expand the script to be able...
    3. Speeding up
      Hi folks, just looking for hints. FMP 6.0v4 Dev on Win 98 (about to shift to XP) I'm running a solution every week that combines 3 text files...
    4. Speeding up LWP::Simple
      Hi all, I am looking to collect the HTML of approximately 30 million urls, in as simple a manner as possible, perhaps using the LWP::Simple...
    5. Help with speeding up searches
      "Jeroen Braun" <jnjbraun@euronet.nl> wrote in message news:<3e72995a$0$57483$1b62eedf@news.euronet.nl>... The table was not built by me. I was...
  3. #2

    Default Re: Speeding up in-line queries

    Astra wrote:
    > Hi All
    >
    > I know this is a 'try it yourself' thing, but is it generally true
    > that in-line query (A):
    >
    > strSQLQuery = "update accounts set fred='" & strfred & "',bob='" &
    > strbob & "', etc
    >
    > is not pretty to read as one long string, BUT a lot faster to execute
    > than in-line query (B):
    >
    > strSQLQuery = "update accounts set "
    > strSQLQuery = strSQLQuery & "fred='" & strfred & "',"
    > strSQLQuery = strSQLQuery & "bob='" & strbob & "',
    > etc etc
    >
    > Yes?
    >
    It's faster, but not a LOT faster. You will only be able to notice the
    difference in a loop that's building a huge string.

    The real problem is the possibility of SQL Injection:
    [url]http://www.sqlsecurity.com/DesktopDefault.aspx?tabid=23[/url]
    [url]http://www.nextgenss.com/papers/advanced_sql_injection.pdf[/url]
    [url]http://www.nextgenss.com/papers/more_advanced_sql_injection.pdf[/url]

    You should not be using dynamic sql. Stored procedures is the most secure
    methodology.

    Bob Barrows

    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"


    Bob Barrows [MVP] Guest

  4. #3

    Default Re: Speeding up in-line queries

    Other than the building of the string, there will be no difference in
    executing (A) vs. (B). These queries will look identical to the database.

    And I agree with Bob. STOP USING AD HOC SQL.

    --
    [url]http://www.aspfaq.com/[/url]
    (Reverse address to reply.)





    "Astra" <info@NoEmail.com> wrote in message news:40d348fe$1_4@127.0.0.1...
    > Hi All
    >
    > I know this is a 'try it yourself' thing, but is it generally true that
    > in-line query (A):
    >
    > strSQLQuery = "update accounts set fred='" & strfred & "',bob='" & strbob
    > &
    > "', etc
    >
    > is not pretty to read as one long string, BUT a lot faster to execute than
    > in-line query (B):
    >
    > strSQLQuery = "update accounts set "
    > strSQLQuery = strSQLQuery & "fred='" & strfred & "',"
    > strSQLQuery = strSQLQuery & "bob='" & strbob & "',
    > etc etc
    >
    > Yes?
    >
    > Thanks
    >
    > Robbie
    >
    >

    Aaron [SQL Server MVP] Guest

  5. #4

    Default Re: Speeding up in-line queries

    Hi Guys

    Thanks for the feedback, but I've got use ad hoc queries because my db is
    MySQL 4.

    Can't afford SQL Server hosting at present, as I'm trying to get my foot in
    the door with clients.

    Rgds

    Robbie

    Aaron [SQL Server MVP] <ten.xoc@dnartreb.noraa> wrote in message
    news:eHg2yjgVEHA.3420@TK2MSFTNGP12.phx.gbl...
    Other than the building of the string, there will be no difference in
    executing (A) vs. (B). These queries will look identical to the database.

    And I agree with Bob. STOP USING AD HOC SQL.

    --
    [url]http://www.aspfaq.com/[/url]
    (Reverse address to reply.)





    "Astra" <info@NoEmail.com> wrote in message news:40d348fe$1_4@127.0.0.1...
    > Hi All
    >
    > I know this is a 'try it yourself' thing, but is it generally true that
    > in-line query (A):
    >
    > strSQLQuery = "update accounts set fred='" & strfred & "',bob='" & strbob
    > &
    > "', etc
    >
    > is not pretty to read as one long string, BUT a lot faster to execute than
    > in-line query (B):
    >
    > strSQLQuery = "update accounts set "
    > strSQLQuery = strSQLQuery & "fred='" & strfred & "',"
    > strSQLQuery = strSQLQuery & "bob='" & strbob & "',
    > etc etc
    >
    > Yes?
    >
    > Thanks
    >
    > Robbie
    >
    >



    Laphan Guest

  6. #5

    Default Re: Speeding up in-line queries

    > Thanks for the feedback, but I've got use ad hoc queries because my db is
    > MySQL 4.
    If you say up front what database platform / version you are using, you are
    less likely to get irrelevant advice.

    We can't remember what database platform every single user is using.
    Especially when you switch randomly from astra to laphan and back again...

    --
    [url]http://www.aspfaq.com/[/url]
    (Reverse address to reply.)


    Aaron [SQL Server MVP] Guest

  7. #6

    Default Re: Speeding up in-line queries

    Hi Aaron

    Apols for the schizophrenia.

    I really appreciate the advice from both of you and will try to remember to
    confirm my setup.

    Forgiven? :0)

    Now about the best way to flit between http and https when end users like to
    go back and forth....



    Aaron [SQL Server MVP] <ten.xoc@dnartreb.noraa> wrote in message
    news:uHBRZ3jVEHA.1472@TK2MSFTNGP09.phx.gbl...
    > Thanks for the feedback, but I've got use ad hoc queries because my db is
    > MySQL 4.
    If you say up front what database platform / version you are using, you are
    less likely to get irrelevant advice.

    We can't remember what database platform every single user is using.
    Especially when you switch randomly from astra to laphan and back again...

    --
    [url]http://www.aspfaq.com/[/url]
    (Reverse address to reply.)




    Laphan Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139