Results 1 to 10 of 21

Hybrid View

  1. #1
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default Re: Database user permisions

    Mentioned that the site is highly customized. Did that extra customization include additional database queries, and have those queries been structured to take advantage of the indexing (faster querying)?
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  2. #2
    Join Date
    Sep 2012
    Posts
    253
    Plugin Contributions
    0

    Default Re: Database user permisions

    Yes. The customization is mainly read only queries and they are reading indexed columns and tables. However 2 computers read every 30 seconds to get updated information and are writing as needed between those but on a peak hour of 30 orders that writing is only between 40 and 50 writes in that hour. So no where near as many writes as there are reads.

  3. #3
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default Re: Database user permisions

    Remember though, the fact that columns that are indexed and being read is not the same thing as the query being structured to take advantage of the indexing. The sequence of the queried fields can make or break the use of the indexing, as well as omitting one of the indexed columns when compared to the indices.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  4. #4
    Join Date
    Sep 2012
    Posts
    253
    Plugin Contributions
    0

    Default Re: Database user permisions

    Yes they are querried so the db narrows down the results as fast as possible and pulls as many from one query as possible.
    Here is an example of the 30 second query
    Code:
    $sql = "SELECT orders_id FROM ".TABLE_ORDERS." WHERE date_purchased < NOW() AND orders_status IN (" . implode(',',$statuses) . ") ORDER BY orders_id ASC";
    Limit by date purchased first because that eliminates the majority of the table. Then limit by status.

    Here is another one and yes I plan on changing the * to more specifics in the near future.
    Code:
    $sql = 'select * from ' . TABLE_ORDERS . ' o left join ' . TABLE_HTA . ' h ON o.orders_id = h.order_id WHERE o.date_purchased < NOW() AND o.shipping_module_code LIKE "%Flat%" AND h.status = "MADE" ORDER BY o.orders_id ASC';
    This one again limits by date. Then limits by shipping module which cuts out 60% of the orders. Then the made is the lowest percentage of finds.
    Last edited by southshorepizza; 4 Mar 2015 at 01:26 AM.

  5. #5
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default Re: Database user permisions

    Quote Originally Posted by southshorepizza View Post
    Yes they are querried so the db narrows down the results as fast as possible and pulls as many from one query as possible.
    Here is an example of the 30 second query
    Code:
    $sql = "SELECT orders_id FROM ".TABLE_ORDERS." WHERE date_purchased < NOW() AND orders_status IN (" . implode(',',$statuses) . ") ORDER BY orders_id ASC";
    Limit by date purchased first because that eliminates the majority of the table. Then limit by status.
    I'm not where I can review the indices for that table, but the use of the date comparison as provided doesn't help limit the quantity of returned rows at all... It simply returns all orders that have been made. There is no elimination of anything performed by looking for all orders purchased before now. (Even if the < was incorrect, there is/would be something missing to bound the data as there are no orders in the future...)
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  6. #6
    Join Date
    Sep 2012
    Posts
    253
    Plugin Contributions
    0

    Default Re: Database user permisions

    Actually that is part of that customization. There are future orders. But the query should be tweaked so it's between 00:00:00 and now.

  7. #7
    Join Date
    Sep 2012
    Posts
    253
    Plugin Contributions
    0

    Default Re: Database user permisions

    date_purchased BETWEEN DATE(CURRENT_DATE() - INTERVAL 1 DAY) AND NOW() ORDER BY orders_id DESC;

  8. #8
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default Re: Database user permisions

    Quote Originally Posted by southshorepizza View Post
    Actually that is part of that customization. There are future orders. But the query should be tweaked so it's between 00:00:00 and now.
    Untested, but:

    Code:
    DATE(date_purchased) = DATE(CURRENT_DATE()) and date_purchased < NOW()
    Would query on all orders for the current date (current and "future", assume though that you have more past orders than future orders.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  9. #9
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default Re: Database user permisions

    Again, and I realize the post was edited after I began response, the date "filter" does not eliminate anything. The "60% reduction" comes from the like and b.status portions of the query. It also does not prove that indexing is being optimized and I am still unable to identify the indices available as I'm not at a computer nor able to "easily" pull up the index list for the orders table.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  10. #10
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default Re: Database user permisions

    Would want something like date_purchased > DATE(CURRENT_DATE() - INTERVAL 2 WEEK)

    Which is an example of 2 weeks ago, would need to find the interval information necessary to accomodate your criteria.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 

Similar Threads

  1. v151 Fantasatico upgrade has changed permisions for my admin
    By girlboheme in forum Upgrading to 1.5.x
    Replies: 5
    Last Post: 9 Mar 2014, 01:58 PM
  2. PHP File Permisions
    By Advantage Online in forum General Questions
    Replies: 3
    Last Post: 24 Jan 2011, 11:34 PM
  3. file permisions
    By tenerifetom in forum Installing on a Linux/Unix Server
    Replies: 12
    Last Post: 6 Apr 2010, 02:24 PM
  4. EZ-Pages Permisions error after editing
    By snellc in forum Installing on a Windows Server
    Replies: 2
    Last Post: 5 Apr 2009, 10:53 PM
  5. Write only permisions on configure.ini
    By couchie in forum Installing on a Windows Server
    Replies: 4
    Last Post: 27 Apr 2007, 04:56 AM

Posting Permissions

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