473,763 Members | 1,320 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cannot Delete

Hi,
hi have a table with 2.5 million records which i try do delete. i have
several constraints on it too.
i tried to delete the records using delete but it does not seem to work.
the delete runs forever. hrs...
i cannot truncate it as it complains about foreign keys.

What is the problem ?

Thanks
Alex

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 11 '05 #1
5 2231
Not sure about 2.5 million records but try running "VACUUM ANALYSE"
before the delete and during (every now and then).

Had the same problem with 100,000 records and it did the trick nicely.
Hi,
hi have a table with 2.5 million records which i try do delete. i have
several constraints on it too.
i tried to delete the records using delete but it does not seem to
work. the delete runs forever. hrs...
i cannot truncate it as it complains about foreign keys.

What is the problem ?

Thanks
Alex

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddres sHere" to ma*******@postg resql.org)

Nov 11 '05 #2
Alex <al**@meerkatso ft.com> writes:
hi have a table with 2.5 million records which i try do delete. i have
several constraints on it too.
i tried to delete the records using delete but it does not seem to work.
the delete runs forever. hrs...
i cannot truncate it as it complains about foreign keys.


It's a good bet that you need to create indexes on the columns that
reference this table via foreign keys. Without such indexes, updates
and deletes on the referenced table will be really slow.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 11 '05 #3
I still have this problem...
my table currently only has 60k records. it has two foreign keys . one
to a table with
15 records the other to a table with 250 records both with a primary key
as suggested.
the table itself is referenced by another table.

although I have about 10mio records in other tables , this one is rather
small... still i manage to delete 2-3 records / second.
I tried vacuum, the db and tables and did not gain any performance.

I experience this problem on different machines and yet, when i reload
the date it did speed up things considerably.

Any suggestions what could be wrong? Maybe a configuration issue ?

Thanks
Alex
Tom Lane wrote:
Alex <al**@meerkatso ft.com> writes:
hi have a table with 2.5 million records which i try do delete. i have
several constraints on it too.
i tried to delete the records using delete but it does not seem to work.
the delete runs forever. hrs...
i cannot truncate it as it complains about foreign keys.


It's a good bet that you need to create indexes on the columns that
reference this table via foreign keys. Without such indexes, updates
and deletes on the referenced table will be really slow.

regards, tom lane


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postg resql.org so that your
message can get through to the mailing list cleanly

Nov 12 '05 #4
Alex wrote:
I still have this problem...
my table currently only has 60k records. it has two foreign keys . one
to a table with
15 records the other to a table with 250 records both with a primary
key as suggested.
the table itself is referenced by another table.

although I have about 10mio records in other tables , this one is
rather small... still i manage to delete 2-3 records / second.
I tried vacuum, the db and tables and did not gain any performance.

I experience this problem on different machines and yet, when i reload
the date it did speed up things considerably.

Any suggestions what could be wrong? Maybe a configuration issue ?


HOW is this table referenced in another table?
By both of the foreign keys,
a separate integer substitute key in this table?

BTW, what kind of keys are you using, string, integer, float,what?

Please (re)post the table defintions to the 4 tables.

--
"You are behaving like a man",
is an insult from some women,
a compliment from an good woman.

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 12 '05 #5
Alex wrote:
I tried vacuum, the db and tables and did not gain any performance.
Did you try VACUUM only or VACUUM ANALYZE (or even just ANALYZE)?
I experience this problem on different machines and yet, when i reload
the date it did speed up things considerably.


It does sound like you haven't ANALYZE'd your data. Try that.

--
Linux homer 2.4.18-14 #1 Wed Sep 4 13:35:50 EDT 2002 i686 i686 i386
GNU/Linux
2:30pm up 291 days, 6:04, 9 users, load average: 6.08, 6.02, 6.01

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE/ikvSNYbTUIgzwfA RAkucAJ490ss7DO vus/WKIJHnA/V7vHJMtgCfd1wi
o0yaK7VHCPIeQFy q1iSGtiA=
=vVqN
-----END PGP SIGNATURE-----

Nov 12 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3762
by: David | last post by:
I have a problem that I cannot delete components that are placed on a R\abbed page in Visual Basic.Net 2003. The form uses a Tab Control with several pages. I have a Panel on the page and then some combo boxes, labels and text boxes. For some reason, I cannot delete any of these controls from the form (not even the Tab control istelf). The Delete and Cut options in the right click menu have been ghosted out as is the options from Edit...
20
37396
by: Brad Eck | last post by:
"The only operators that cannot be overloaded are :: (scope resolution), . (member selection), and .* (member selection through pointer to function). Quoting from Stroustrup's 3rd edition of _The C++ Programming Language_, section 11.2 (page 263), these three operators 'take a name, rather than a value, as their second operand and provide the primary means of referring to members. Allowing them to be overloaded would lead to subtleties.'"...
3
9450
by: tbone | last post by:
We were using sql authentication on our sql server 2000 servers, But need to use windows authentication. I have an sql user jdoe that owns many different objects in multiple databases. I have tried adding the windows login of jdoe with the exact same permissions as the sql user jdoe, but it complains because it says jdoe already exists. So I attempt to delete the sql user of jdoe (remembering the permissions so I can reapply them to...
2
1380
by: Natan | last post by:
I'm getting this exception when trying to delete a file: System.UnauthorizedAccessException: Access to the path "d:\root\sigma\anexos\" is denied. the thing is that i can save files in this folder, but cannot delete. I enabled the advanced folder security in XP, gave full access to ASPNET and IUSR_MACHINENAME users to this folder. Finally I gave full access to "All" user and tried impersonating.... no sucess..
4
2396
by: news.microsoft.com | last post by:
I need some help here guys.... i have been simply trying to delete a file from the webserver using asp.net using the following code. System.IO.File.Delete(FullPath); however the error message i get is the following The process cannot access the file "e:\inetpub\wwwroot\client_dev\brands\Product_images\1450.jpg" because it is
6
10680
by: Aaron Smith | last post by:
Ok. I have a dataset that has multiple tables in it. In one of the child tables, I have a column that I added to the DataSet (Not in the DataSource). This column does not need to be stored in the data on the datasource. It simply gets the first name and last name of an instructor and displays it in the grid. I have two major problems.... One, it doesn't display in the column until the row is saved, (Even after calling a refresh on the...
4
5592
by: gerardianlewis | last post by:
Any help appreciated. (VB.NET under XP and Vista, SP1 installed) My code, inherited from a VB6 version of an app that ran under W98, loads an image from a file into a PictureBox. The user may want to move or delete the file that is being shown. The corresponding event- driven code for "delete this picture" uses: My.Computer.FileSystem.DeleteFile(sPath)
2
15007
by: SCPOS | last post by:
Cannot delete X: It is being used by another person or program. Close any programs that might be using the file and try again. Of course I have tried closing any programs I know of that may be using the file (used X because the filename does not matter...it is a specific log file name to the application). I am logged onto a Windows Server 2003 computer that acts as a server for a LAN, but is physically joined to a domain. The local...
8
20434
by: Stefano Sabatini | last post by:
Hi all, I'm encountering this while trying to implement a factory singleton method to generate objects. The singleton has a static map which binds a static creation function defined in each class to the type of the object to be created. Here it is the code, which is a modification of the wikipedia C++ factory example code: ----------------------------------8<--------------------------------
0
9563
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9386
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9938
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9822
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8822
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5270
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
3523
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2793
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.