sql - Oracle Query or statement issue, and performance tuning -



sql - Oracle Query or statement issue, and performance tuning -

i'm having issues getting query execute properly. have table 70 1000000 rows. i'm trying search ip table distinct ip's assigned client between specific dates. these dates controlled deallocation date.

thus,

i'm trying search table ips assigned client when deallocation date null or between 1st , 31st of month. query have doesn't run quickly, first time ran or on same line deallocation_date null, returned every row.

here query first way ran it, , returned every client not client searching for, took maybe 1 min start executing.

select distinct e.ip_address, a.customer_name, c.vm_id, d.allocation_date, d.deallocation_date customers a, vm_groups b, vms c, vm_ip_address_histories d, ip_addresses e a.customer_id=30 , a.customer_id = b.customer_id , b.vm_group_id = c.vm_group_id , c.vm_id = d.vm_id , d.ip_address_id = e.ip_address_id , d.deallocation_date null or trunc(d.deallocation_date) between to_date('1-oct-14') , to_date('31-oct-14') /

the sec way ran it, hasn't returned 15 minutes later

select distinct e.ip_address, a.customer_name, c.vm_id, d.allocation_date, d.deallocation_date customers a, vm_groups b, vms c, vm_ip_address_histories d, ip_addresses e a.customer_id=30 , a.customer_id = b.customer_id , b.vm_group_id = c.vm_group_id , c.vm_id = d.vm_id , d.ip_address_id = e.ip_address_id , d.deallocation_date null or trunc(d.deallocation_date) between to_date('1-oct-14') , to_date('31-oct-14') /

this way didn't solve thought did, didnt homecoming values deallocation dates.

select distinct e.ip_address, a.customer_name, c.vm_id, d.allocation_date, d.deallocation_date customers a, vm_groups b, vms c, vm_ip_address_histories d, ip_addresses e a.customer_id=30 , a.customer_id = b.customer_id , b.vm_group_id = c.vm_group_id , c.vm_id = d.vm_id , d.ip_address_id = e.ip_address_id , (d.deallocation_date null or trunc(d.deallocation_date) between to_date('1-oct-14') , to_date('31-oct-14')) /

i tried , returned values null again.:

select distinct e.ip_address, a.customer_name, c.vm_id, d.allocation_date, d.deallocation_date customers a, vm_groups b, vms c, vm_ip_address_histories d, ip_addresses e a.customer_id=30 , a.customer_id = b.customer_id , b.vm_group_id = c.vm_group_id , c.vm_id = d.vm_id , d.ip_address_id = e.ip_address_id , exists (select * vm_ip_address_histories d.deallocation_date null or trunc(d.deallocation_date) between to_date('1-oct-14') , last_day('1-oct-14')) /

select distinct e.ip_address, a.customer_name, c.vm_id, d.allocation_date, d.deallocation_date customers a, vm_groups b, vms c, vm_ip_address_histories d, ip_addresses e a.customer_id=30 , a.customer_id = b.customer_id , b.vm_group_id = c.vm_group_id , c.vm_id = d.vm_id , d.ip_address_id = e.ip_address_id , (d.deallocation_date null or d.deallocation_date between to_date('01-10-2014', 'dd-mm-yyyy') , to_date('31-10-2014 23:59:59', 'dd-mm-yyyy hh24:mi:ss')) /

sql oracle oracle11g

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -