Does putting a LIMIT on a DELETE clause make any difference?
am 09.09.2010 02:17:00 von Daevid Vincent
I am curious about something.
I have a "glue" or "hanging" table like so:
CREATE TABLE `fault_impact_has_fault_system_impact` (
`id_fault_impact` int(10) unsigned NOT NULL,
`id_fault_system_impact` smallint(5) unsigned NOT NULL,
KEY `fault_impact_key` (`id_fault_impact`,`id_fault_system_impact`),
KEY `id_fault_system_impact` (`id_fault_system_impact`),
CONSTRAINT `fault_impact_has_fault_system_impact_ibfk_1` FOREIGN KEY
(`id_fault_impact`) REFERENCES `fault_impact` (`id_fault_impact`) ON DELETE
CASCADE ON UPDATE CASCADE,
CONSTRAINT `fault_impact_has_fault_system_impact_ibfk_2` FOREIGN KEY
(`id_fault_system_impact`) REFERENCES `fault_system_impact`
(`id_fault_system_impact`) ON DELETE CASCADE ON UPDATE CASCADE
)
And a lookup table like this:
CREATE TABLE `fault_system_impact` (
`id_fault_system_impact` smallint(5) unsigned NOT NULL auto_increment,
`fault_sytem_impact_name` varchar(50) NOT NULL,
PRIMARY KEY (`id_fault_system_impact`)
)
I have a bunch of checkboxes in a
Re: Does putting a LIMIT on a DELETE clause make any difference?
am 09.09.2010 08:06:15 von Ananda Kumar
--001485f6d8928f706c048fcd6def
Content-Type: text/plain; charset=ISO-8859-1
Vincent,
Since the column is indexed, it would use the index during the delete.
regards
anandkl
On Thu, Sep 9, 2010 at 5:47 AM, Daevid Vincent wrote:
> I am curious about something.
>
> I have a "glue" or "hanging" table like so:
>
> CREATE TABLE `fault_impact_has_fault_system_impact` (
> `id_fault_impact` int(10) unsigned NOT NULL,
> `id_fault_system_impact` smallint(5) unsigned NOT NULL,
> KEY `fault_impact_key` (`id_fault_impact`,`id_fault_system_impact`),
> KEY `id_fault_system_impact` (`id_fault_system_impact`),
> CONSTRAINT `fault_impact_has_fault_system_impact_ibfk_1` FOREIGN KEY
> (`id_fault_impact`) REFERENCES `fault_impact` (`id_fault_impact`) ON DELETE
> CASCADE ON UPDATE CASCADE,
> CONSTRAINT `fault_impact_has_fault_system_impact_ibfk_2` FOREIGN KEY
> (`id_fault_system_impact`) REFERENCES `fault_system_impact`
> (`id_fault_system_impact`) ON DELETE CASCADE ON UPDATE CASCADE
> )
>
> And a lookup table like this:
>
> CREATE TABLE `fault_system_impact` (
> `id_fault_system_impact` smallint(5) unsigned NOT NULL auto_increment,
> `fault_sytem_impact_name` varchar(50) NOT NULL,
> PRIMARY KEY (`id_fault_system_impact`)
> )
>
> I have a bunch of checkboxes in a
Re: Does putting a LIMIT on a DELETE clause make any difference?
am 09.09.2010 16:28:21 von Johan De Meersman
--000e0cd6a95c30aeba048fd47184
Content-Type: text/plain; charset=ISO-8859-1
Correct. To verify this, simply create a select with the same structure as
your delete - the execution plan will be similar.
I do not believe limit will help you, however, as it is only applied after
execution, when the full dataset is known.
On Thu, Sep 9, 2010 at 8:06 AM, Ananda Kumar wrote:
> Vincent,
>
> Since the column is indexed, it would use the index during the delete.
>
> regards
> anandkl
>
> On Thu, Sep 9, 2010 at 5:47 AM, Daevid Vincent wrote:
>
> > I am curious about something.
> >
> > I have a "glue" or "hanging" table like so:
> >
> > CREATE TABLE `fault_impact_has_fault_system_impact` (
> > `id_fault_impact` int(10) unsigned NOT NULL,
> > `id_fault_system_impact` smallint(5) unsigned NOT NULL,
> > KEY `fault_impact_key` (`id_fault_impact`,`id_fault_system_impact`),
> > KEY `id_fault_system_impact` (`id_fault_system_impact`),
> > CONSTRAINT `fault_impact_has_fault_system_impact_ibfk_1` FOREIGN KEY
> > (`id_fault_impact`) REFERENCES `fault_impact` (`id_fault_impact`) ON
> DELETE
> > CASCADE ON UPDATE CASCADE,
> > CONSTRAINT `fault_impact_has_fault_system_impact_ibfk_2` FOREIGN KEY
> > (`id_fault_system_impact`) REFERENCES `fault_system_impact`
> > (`id_fault_system_impact`) ON DELETE CASCADE ON UPDATE CASCADE
> > )
> >
> > And a lookup table like this:
> >
> > CREATE TABLE `fault_system_impact` (
> > `id_fault_system_impact` smallint(5) unsigned NOT NULL auto_increment,
> > `fault_sytem_impact_name` varchar(50) NOT NULL,
> > PRIMARY KEY (`id_fault_system_impact`)
> > )
> >
> > I have a bunch of checkboxes in a