Jump to content

Recommended Posts

Hello,

  I have this large inner join query that is causing frequent timeouts on our server and I was wondering if there was anyway I could streamline it so it would work all the time.  The strange thing is that when I copy and paste this query into phpMyAdmin, it runs in 0.0711.  I've tried many different versions of this as a regular join table and this query below:

 

SELECT property.property_id, property.acres, property.addr2, property.agent_id, property.appl_fee, property.agency_id, property.built, property.city, property.clubhouse_onsite, property.contact_rental, property.contact_repair, property.contact_security, property.current_hits, property.description, property.display_priority, property.elem_school, property.fitness, property.gated_entrance, property.last_view_date, property.laundry, property.fenced_yard, property.patio, property.car_port, property.util_water, property.lease_week, property.lease_year, property.list_address, property.location_id, property.market_id, property.max_income, property.middle_school, property.min_income, property.modify_date, property.num_tenants, property.pet_bool, property.pet_fee, property.pet_policy, property.photo1, property.photo1_capn, property.photo2, property.photo2_capn, property.playground, property.pool, property.title, property.public_trans, property.school_dist, property.two_car_garage, property.one_car_garage, property.state, property.storage, property.street_num, property.street_name, property.tax_credit, property.template, property.tennis_courts, property.unit_num, property.util_cable, property.util_electric, property.util_gas, property.util_included, property.util_lawn, property.util_oil, property.well_water, property.util_pool, property.util_trash, property.city_water, property.why_removed, property.zip4, property.zip5, property.page_title, property.page, property.available_date, property.garage, property.util_phone, property.util_heat, property.util_hot_water, property.allow_dogs, property.allow_cats, property.site_id, property.prop_type, property.specials, property.section_8, property.screened_porch, property.deck, property.deck_storage, property.patio_storage, property.available_str, property.storage_room,property.court_yard, layout.layout_id, layout.appl_fee, layout.ac, layout.always_avail, layout.area, layout.basement, layout.bath, layout.beds, layout.deck, layout.carpet, layout.central_hvac, layout.patio, layout.deposit, layout.layout_description, layout.fireplace, layout.floorplan, layout.fridge, layout.furnished, layout.garbage_disp, layout.dining_room, layout.hardwood_floors, layout.heat_pump, layout.layout_title, layout.list_search, layout.list_begin_date, layout.list_end_date, layout.num_units, layout.parking, layout.pet_fee, layout.photo, layout.photo_capn, layout.rent, layout.rent_high, layout.rooms, layout.central_oil_heat, layout.screen_patio, layout.dishwasher, layout.central_gas, layout.stove, layout.ceiling_fan, layout.central_electric, layout.total_hits, layout.washer_dryer, layout.wd_hookups, layout.yard, layout.jacuzzi, layout.agency_id, layout.walk_in_closets, layout.microwave, layout.util_phone, layout.attic, layout.dryer_conns, layout.den,layout.family_room,layout.bonus_room, layout.new_carpet, layout.unfin_basement, layout.gas_space_heater, layout.washer_conns, layout.electric_baseboard_heat,layout.zip,layout.specials, layout.storage, layout.fenced_yard, layout.one_car_garage, layout.two_car_garage,layout.water_included, layout.page,layout.layout_photo_capn,layout.wall_ac, layout.electric_heat FROM property INNER JOIN layout ON layout.property_id = property.property_id WHERE (property.property_id=125 AND layout.property_id=125)

while($row = mysql_fetch_assoc($result)){ $db_vars[] = $row; }
$db_vars = $db_vars[0];

 

Any help would be greatly appreciated.

Link to comment
https://forums.phpfreaks.com/topic/164945-large-query-causing-timeout/
Share on other sites

I dont know if it will work or not but cant you just use an asterisk?

SELECT * FROM property INNER JOIN layout ON layout.property_id = property.property_id WHERE (property.property_id=125 AND layout.property_id=125)

while($row = mysql_fetch_assoc($result)){ $db_vars[] = $row; }
$db_vars = $db_vars[0];

 

Im not sure...

Just an idea, but im probably wrong.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.