Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2012
    Posts
    1

    Unanswered: query optimization

    Hi I have to optimize query i have a less knowledge of sql plz help
    query is
    SELECT SUM(creative.impressions_delta) AS deltaIMPS, SUM(creative.clicks_delta) AS deltaClicks, SUM(creative.actions_delta) AS deltaPCActions, SUM(creative.piactions_delta) AS deltaPIActions FROM advertiser, campaign, creative, access_control WHERE advertiser.asset_id = campaign.advertiser_id AND campaign.asset_id = creative.campaign_id AND advertiser.asset_id = access_control.asset_id AND access_control.asset_type = 'advertiser' AND access_control.menu_item = 'N' AND access_control.action = 'owner' AND access_control.network_id = 305

  2. #2
    Join Date
    Dec 2012
    Posts
    4
    Hello,

    This query is already fairly basic. The most apparent way to optimize it (if not already done) is to create table indexes for the columns being filtered in the WHERE clause:

    access_control.menu_item
    access_control.action
    access_control.network_id

    Run an explain query before and after creating the indexes and compare the costs. Theoretically, if the cost has gone down after creating the indexes, the query is more optimized. If the access_control table has a small amount of data in it, though, indexes may not be necessary.

    That's the best I can do with the limited information provided!

    Joe

Posting Permissions

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