Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all 13329 articles
Browse latest View live

how to optimize this query

$
0
0
How to optimize this query.

select temp.p_id,temp.ds_id, temp.cl_id, count(md_id) from
( select ps.project_id as p_id, sd.merged_defect_id as md_id, min(sd.current_defect_status_id) as ds_id,
case
when count(distinct sd.current_classification_id) = 1
then max(sd.current_classification_id)
else null end as cl_id from project_stream ps
join stream on ps.stream_id = stream.id
join stream_defect sd on sd.stream_id = stream.id group by ps.project_id, sd.merged_defect_id )
as temp
group by temp.p_id, temp.ds_id, temp.cl_id;

----------------------------------------------------------------------------------------------------------------------------
-----------------------------------
HashAggregate (cost=1504839.71..1514243.55 rows=752307 width=32) (actual time=54109.030..54117.451 rows=4029 loops=1)
-> GroupAggregate (cost=1091071.08..1354378.39 rows=7523066 width=32) (actual time=29927.467..50490.362 rows=5021872 lo
ops=1)
-> Sort (cost=1091071.08..1109878.75 rows=7523066 width=32) (actual time=29927.428..33848.621 rows=6226048 loops=
1)
Sort Key: ps.project_id, sd.merged_defect_id
Sort Method: external merge Disk: 255608kB
-> Hash Join (cost=41881.71..51830.26 rows=7523066 width=32) (actual time=1041.006..4893.339 rows=6226048 l
oops=1)
Hash Cond: (ps.stream_id = stream.id)
-> Seq Scan on project_stream ps (cost=0.00..48.06 rows=2106 width=16) (actual time=0.012..1.925 rows
=1994 loops=1)
-> Hash (cost=35074.69..35074.69 rows=544562 width=40) (actual time=1040.665..1040.665 rows=432741 lo
ops=1)
-> Hash Join (cost=53.34..35074.69 rows=544562 width=40) (actual time=0.938..707.705 rows=43274
1 loops=1)
Hash Cond: (sd.stream_id = stream.id)
-> Seq Scan on stream_defect sd (cost=0.00..27533.62 rows=544562 width=32) (actual time=0
.015..133.335 rows=432741 loops=1)
-> Hash (cost=37.04..37.04 rows=1304 width=8) (actual time=0.895..0.895 rows=494 loops=1)
-> Seq Scan on stream (cost=0.00..37.04 rows=1304 width=8) (actual time=0.015..0.52
6 rows=494 loops=1)
Total runtime: 54195.270 ms
(15 rows)

New to PostgreSQL

$
0
0
i developed systems using mysql, many people advised me to study a new database system. I chose postgres because of the flexibility and many people recommended it to me. I uninstalled xampp from my local-machine. Now my question is what do i need to install aside from the windows installer for "postgresql-9.3.4-2-windows-x64" to start developing web based systems. I use php for back-end and html bootstrap for front-end. I want to use pgadmin III for managing database and where do i put my .php files to be able to run it locally?

access VBA code error

$
0
0
Public Sub BrowseQuery_DAO()

Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim rst2 As DAO.Recordset
Dim strSQL As String
Dim strSQL2 As String
Dim CallingDate As Date
Dim i As Integer

Set dbs = CurrentDb()
i = 0


Set rst2 = CurrentDb.OpenRecordset("T_MaxMin")
CallingDate = rst2!MaxxDate


Do While Not rst2!MaxxDate - (i + 1) = rst2!MinnDate

strSQL2 = "SELECT COUNT(ID) AS [COUNTREPEAT]" & _
"FROM [repeat_detail] " & _
"WHERE OnlyDate between " & CallingDate - (i + 7) & _
" AND " & CallingDate - (i)

Set rst = CurrentDb.OpenRecordset(strSQL2)


Debug.Print rst2!MaxxDate - (i + 1) & ", repeated Count: " & rst![COUNTREPEAT]
i = i + 1

Loop

rst.Close
rst2.Close
dbs.Close
End Sub


'guys this code return zero for repeated count but the date loop is working
'i don't have any idea why its not reflecting the number of repeated records

'sample of the result
'5/13/2014, repeated Count: 0
'5/12/2014, repeated Count: 0

ERROR: Negative substring length not allowed

$
0
0
PostgreSQL
table1:
COLUMN 1:

abcd/12345
dfgsdfgds/564356
dfgsdrf/9876

I want output :
abcd
dfgsdfgds
dfgsdrf



>select left(COLUMN1,position('/' IN COLUMN1) -1) from table1

ERROR: Negative substring length not allowed

ODBC configuration for a remote DB2

$
0
0
Hello,
I am trying to connect to a remote DB2 server hosted on a OS/390 box , from my windows 7 machine.
I tried cataloging the tcpip node and the database from the command line processor ( I have DB2 Connect installed on my windows system ) .
When I try to connect to the database using the db2 connect command I get the below error .

SQL30081N A communication error has been detected. Communication protocol
being used: "TCP/IP". Communication API being used: "SOCKETS". Location
where the error was detected: "9.63.66.46". Communication function detecting
the error: "connect". Protocol specific error code(s): "10061", "*", "*".
SQLSTATE=08001


I get the same error when I try to connect from my windows ODBC connection .

Here are the details I am given with to configure the connection

DB2SYSTEM= hostnamexx.in.xx.com
Instance=DB2
ServerType=DB2MVS
Nodetype=U
Protocol=TCPIP
Hostname=hostnamexx.in.xx.com
Portnumber=5010
Security=0

[DB>NDE4E458:DP2H]
Dir_entry_type=DCS
Authentication=SERVER
DBName=DCS4FAF6
TargetDatabase=USIBMVRDP2H

[CLI_ODBC>DP2H]
DataSourceName=DP2H
DataSourceType=System
DBALIAS=DP2H
ODBCParameters=No

I am new to DB2 and would appreciate any help in getting this set up successfully .

Thanks

Utility's throttled and Unthrottled

$
0
0
Hello,

Environment : DB2 9.7 fix pack 6, OS : red hat, Single partition,Datawarehouse

In my environment, many utilities like load,runstats,backups will run often.

BUt for huge tables runstats is running for very long time and due to that remaining jobs are getting slow.

I just want to know which priorty is best ? and what is unthrottled ?

ID = 9739
Type = RUNSTATS
Database Name = EDW
Partition Number = 0
Description = EDW.STAY_HEADER
Start Time = 06/18/2014 16:00:07.525746
State = Executing
Invocation Type = User
Throttling:
Priority = Unthrottled


db2 get dbm cfg | grep -i util*
Workload impact by throttled utilities(UTIL_IMPACT_LIM) = 10

Thanks to all.

Database structure help

$
0
0
Hi,

I have been asked to create a database for my company. However I'm unsure which approach to take. Basically our products can have one or more "sub-systems" which each have different specifications. Most of the specification titles will be relevant to each sub-system.

It is yet to be decided whether this will be for the whole organisation as one central database or if it's just for a product selector for our website.

I've come up with two ideas:

To have two tables, one detailing the main product features e.g. size, model, part number which is linked ( One-to-many) to another table with every single specification for all sub-systems and then have a "Sub-System Type" field.

Or to have a table for each sub-system, linked to the main product table. Each sub-system table then has the relevant specification for that sub-system.

If you can help with deciding which is best and the advantages and disadvantages of each, I'd greatly appreciate it. Or perhaps there's a better way of doing it?

Thanks

Top N Per Group HELP!!!

$
0
0
Quote:

SELECT COMPLAINT_qry_containment_WIP.Plan_Date, COMPLAINT_qry_containment_WIP.Tool_Number, COMPLAINT_qry_containment_WIP.Works_Order_Number, COMPLAINT_qry_containment_WIP.Job_Number, COMPLAINT_qry_containment_WIP.Customer_Code, COMPLAINT_qry_containment_WIP.Full_Name, COMPLAINT_qry_containment_WIP.Route_Status, COMPLAINT_qry_containment_WIP.Manufacturing_Site, COMPLAINT_qry_containment_WIP.Route_Operation_Name , COMPLAINT_qry_containment_WIP.BtrieveDate, COMPLAINT_qry_containment_WIP.Route_List_Code, COMPLAINT_qry_containment_WIP.Operstat_Index_No
FROM COMPLAINT_qry_containment_WIP
WHERE (((COMPLAINT_qry_containment_WIP.Operstat_Index_No ) In (Select Top 1 [COMPLAINT_qry_containment_WIP].[Operstat_Index_No] from [COMPLAINT_qry_containment_WIP] where [Works_Order_Number] Order By [COMPLAINT_qry_containment_WIP].[Route_List_Code] asc)))
ORDER BY COMPLAINT_qry_containment_WIP.Works_Order_Number, COMPLAINT_qry_containment_WIP.Route_List_Code;
OK, i have this in my query sql to pull top 1 operstat_index_No per works_Order_Number however it seems to just pull the top 1 record regardless (not by group)

ANy help appreciated

Search button with text field

$
0
0
Hi,

I'm fairly new to Access / VBA and have been trying relentlessly to get a text box / search button on my Access form to pull up a specific record. Although the null command produces the correct error msgBox, it does not show any record if I enter a correct primary key term. Probably something really simple, but I am completely stuck and cannot find the solution anywhere.

Search button = SearchButton1
Search criteria text field = SearchText1
Primary key field = UniqueAEVRef

Code:

Private Sub SearchButton1_Click()
If IsNull(SearchField1) = False Then
Me.Recordset.FindFirst "[UniqueAEVRef]=" & SearchField1
Me!SearchField1 = Null
If Me.Recordset.NoMatch Then
MsgBox "No record found", vbOKOnly + vbInformation, "Sorry"
Me!SearchField1 = Null
End If
End If
End Sub

Please help!

Inconsistant Report

$
0
0
Hey everyone,

I've got some wonkiness with one of my reports and I can't quite figure out what's going on.

I have a navigation page on my main form. This navigation page has a subreport in it. I have two records in my table on this report. They used to show perfectly fine Then all of a sudden it start to only show the first one.

This is especially weird because I can pull up the report by itself and it will show both records. I can create a new form with a navigation page and a subreport and it will show both. I can remove the old subreport on the main page and add the same one back in and it will still only show one record...

Anyone seen this before? What control did I accidentally switch to do this? Thanks.

Relationship in my front end db ?

$
0
0
I was creating a form by form wizard that has fields from 3 tables that is located on my back end db. When I finished the process, it informs that I don´t have relationship between the tables and then I was dropped in mey front end relationship tab.

These tables are all related in my back end db, why is that happening?

Highlight checkbox on got focus

$
0
0
Greetings,

I'm new to this forum, but have been lurking for awhile. I have a tabular form that has text boxes and checkboxes with each record in a row. I have all the text boxes set up with conditional formatting so that when the control has focus, the background colour changes to blue. However, I cannot use conditional formatting for the checkboxes. The users are older and find it hard to see where they are on the record when the focus goes to the checkboxes.

Is there some VBA code to highlight the actual checkbox when the user tabs into it?

I tried using a box behind the checkbox, but that affects all records. I need to just highlight the checkbox in the current record.

btw, I'm using Access 2010.

Thanks

ODBC Connection failed

$
0
0
Hi!

First of all excuse my bad english. I will try my best.

The Company which I work for offers a database program for the finacial sector. This program connects with a System-DSN entry with a MySQL database, which worked fine for a few years.

But a customer tried to install the program and send me this error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

While I tried to reconstruct this error, i got the same Error but can't reverse it.I got it after i deinstalled the ODBC-Connector-Driver even though there was a active connection. I reinstalled the Connector and the workbench but there was still that error.

The Customer even reinstalled Windows but the Error remains. But i have to say that, because the customer is in the financial sector, there are made some changes to the system. For example at the permissions.

I tried to install a newer driver and a 32 Bit Driver too, but still no improvement.

The Systems both have Win 7 (64 Bit)

I hope you can help me!

SALE - Alnitech: $60 Off For Life - Quad Core Xeon + 16GB + 2x1T + Free MONITORING

$
0
0
We provide 24x7 support for hardware-related problems for all our servers and clients!
Order now and join our happy customers club!



====================================

1. SUPERMICRO X9SRI-F Xeon E5-2620 up to 2.5GHz 2x1000GB

CPU: Hexa Core Xeon E5-2620 2.0-2.5GHz, 15MB (6 physical Cores, 12 HT cores)
RAM: 32GB ECC DDR3
HDD: 2x1000GB SATAIII WD Black 7.2K Software RAID1, HOT-SWAP!
PROACTIVE BMC LOG MONITORING: INCLUDED
Port: 100Mbps UNMETERED
Gold-level power supply: included
5 IPs for free: included
DEDICATED IPMI CONNECTED TO SEPARATE NETWORK (KVM over IP, remote media): Included
Location: Chicago, IL

REGULAR PRICE: $229.99
SALE PRICE: $169.99/monthly WOW!!
order now


====================================

2. SUPERMICRO X10SLM-F Xeon E3-1230v3 up to 3.7GHz 2x1000GB

CPU: Quad Core Xeon E3-1230v3 3.3-3.7 GHz, 8MB (4 physical Cores, 8 HT cores)
RAM: 8GB ECC DDR3
HDD: 1x1000GB SATA 7.2K (4 drive bays)
PROACTIVE HARDWARE MONITORING: INCLUDED
Port: 100Mbps UNMETERED
Gold-level power supply: included
5 IPs for free: included
DEDICATED IPMI CONNECTED TO SEPARATE NETWORK (KVM over IP, remote media): Included
Location: Asheville, NC

PRICE: $129.99/monthly
order now

====================================

3. SUPERMICRO X9SCL-F Xeon E3-1230v2 up to 3.7GHz 2x1000GB

CPU: Quad Core Xeon E3-1230v2 3.3-3.7 GHz, 8MB (4 physical Cores, 8 HT cores)
RAM: 16GB ECC DDR3
HDD: 2x1000GB SATA 7.2K Software RAID1, HOT-SWAP!
PROACTIVE HARDWARE MONITORING: INCLUDED
Port: 100Mbps UNMETERED
Gold-level power supply: included
5 IPs for free: included
DEDICATED IPMI CONNECTED TO SEPARATE NETWORK (KVM over IP, remote media): Included
Location: Chicago, IL / Asheville, NC

PRICE: $149.99/monthly
order now

====================================

4.SUPERMICRO X9DRD-iF Two Xeon E5-2620 2x1000GB

CPU: Hexa Core Xeon E5-2620 2.0-2.5GHz, 15MB (12 physical Cores, 24 HT cores)
RAM: 64GB ECC DDR3
HDD: 2x1000GB SATAIII WD Black 7.2K Software RAID1, HOT-SWAP!
PROACTIVE BMC LOG MONITORING: INCLUDED
Port: 100Mbps UNMETERED
Gold-level power supply: included
5 IPs for free: included
DEDICATED IPMI CONNECTED TO SEPARATE NETWORK (KVM over IP, remote media): Included
Location: Asheville, NC

PRICE: $329.99/monthly
order now

Access Problem Reading SQL Server Database

$
0
0
I have an Access Database program as a front end and a SQL
Server database as a back end. The program uses VBA code as well.
The VBA code in the program needs to read a SQL record
where three fields must be matched. These fields are

Buyer varchar(50)
DateAdded smalldate
PartNumber varchar(50)

I am rather new to this and cannot get the DateAdded to
work. What help can be provided will be appreciated.

Problems dropping the database

$
0
0
Hi,

I have dropped a database. the database got dropped with SQL1137W .
when i list the database its still listing the database which I dropped earlier.

How do I cleanup?? Please help

♦ Limestone Networks ♦ E3-1270v2 just $99 | Deals on dual procs | Great DB servers!

$
0
0
Limestone Networks is a leading IaaS provider of on-demand, cloud, dedicated and enterprise hosting services. We offer a redundant, low latency network, passionate support and quality infrastructure. We have satisfied clients in over 100 countries.

Our philosophy is that we have partners not customers. Our success is dependent upon yours, so whether you’re big or small, we make every effort to exceed your hosting expectations with simple processes, a solid network and superior service.

Simple. Solid. Superior.

For a limited time, we’re offering great discounts on select single and dual proc Xeon dedicated servers! These systems are effective as game servers, shared web hosting servers, database servers, web servers, cloud hosting servers, VPS hosting servers, and other business solutions.


Single Processor Dedicated Servers

Intel Xeon E3-1270 V2 (3.5GHz/core)
4GB RAM
500GB SATA2 HDD or 60GB SSD
20GB NAS storage
100Mbps port speed
10,000GB outbound bandwidth
Unmetered inbound bandwidth
Only $99!

Get Started Here!


Dual Processor Dedicated Servers

Dual Quad Xeon 5620 (2.4GHz/core)
4GB RAM
250GB RE SATA2 or 60GB SSD
20GB NAS storage
100Mbps port speed
10,000GB outbound bandwidth
Unmetered inbound bandwidth
Only $150.00!

Get Started Here!


Dual Quad Xeon 5640 (2.66GHz/core)
4GB RAM
250GB RE SATA2 or 60GB SSD
20GB NAS storage
100Mbps port speed
10,000GB outbound bandwidth
Unmetered inbound bandwidth
Only $200.00!

Get Started Here!


Dual Hexa-Core Xeon 5650 (2.66GHz/core)
4GB RAM
250GB RE SATA2 or 60GB SSD
20GB NAS storage
100Mbps port speed
10,000GB outbound bandwidth
Unmetered inbound bandwidth
Only $225.00!

Get Started Here!


Take a look at our full list of dedicated servers.


LSN Cloud Servers & Solutions

Take 20% OFF any cloud server or virtual appliance! Promo Code: CLOUDTWENTY


Limestone Networks Features:

• Fast Provisioning
• Internap Flow Controller
• Enterprise DDoS Protection
• Multiple Tier 1 Fiber Carriers
• Tier 3+ SAS-70 Type II Certified Datacenter
• Located on protected Dallas 911 Power Grid
• Redundant Core & Border Routers
• Support responses < 10 Minutes
• 24x7x365 Passionate Support
• Dedicated Account Specialists
• First-Class Reseller Program
• Competitive Prices
• Free SSL
• And more!!!


Subscribe to our monthly newsletter for the best specials!

We've partnered with WSM to provide custom migration solutions. Learn More!


Follow us on Twitter @limestoneinc
Like us on Facebook: Facebook.com/LimestoneInc

If you have any questions about this sale, you can send me a private message or reply to this thread.

Mathematic Quiz

$
0
0
Hi guys,
i must make a mathematical quiz with 20 questions with score and time countdown.
after the quiz finish the score must be stored so the next time the user will login can find his score to improve it.

My question is i must make 20 forms for each question or i can make 1 form and put there all the questions.
The questions are multiple choice

thanks a lot

Insert Into SQL to many entries

$
0
0
Hi all,

I created an append query to insert data into another table based on the current entry of a specific field in the main form.
The data is inserted into a subform.
The problem I have is the following:
The first time the query runs (I acnnot runit via a button but in the query section only) everything works fine.
The second time it wirks but adds 6 instead of 2 entries. The next time 18 ... and so on. Any ideas?

INSERT INTO sh_information ( sh_information, sh_memo, sh_from, sh_schedule, sh_type, sh_name )
SELECT profile.profile_information, profile.profile_memo, profile.profile_from, profile.profile_schedule, profile.profile_type, q_togetthe_shname.sh_name
FROM profile, sh_information, q_togetthe_shname;

Uh Oh! MAJOR Brilliant DB Problem

$
0
0
I have been using happily Brilliant DB Ultimate for several months now since I purchased 10.06.

All of a sudden today, it pops a a message saying my Trial period is over.

WHAT FLIPPING TRIAL? I bought and paid for the full version several months ago.

Is it trying to force me to upgrade?


HELP!!!!!!!!!!!!!!!!!!!!

Larry:mad::mad::mad::mad::mad::mad:
Viewing all 13329 articles
Browse latest View live