<div dir="ltr"><div><div>I tried -&gt;delete and -&gt;delete_all both operation was deleting one by one. The version of DBIx::Class is 0.08250<br><br></div>You guessed right :) I had changed the table name but the code is no different, here is the code and schema definition of $rs<br>

<br>$schema-&gt;resultset(&#39;AlertParameterValue&#39;)-&gt;search({ProfileId =&gt; 712})-&gt;delete;<br><br></div><div>Schema Class is below and I don&#39;t have cascade relationship or is_deferable<br><br>use utf8;<br>

<br>package PAMS::WWW::Schema::Result::AlertParameterValue;<br><br>use strict;<br>use warnings;<br><br>use Moose;<br>use MooseX::NonMoose;<br>use MooseX::MarkAsMethods autoclean =&gt; 1;<br>extends &#39;DBIx::Class::Core&#39;;<br>

<br>__PACKAGE__-&gt;table(&quot;AlertParameterValue&quot;);<br><br>__PACKAGE__-&gt;add_columns(<br>    &quot;Id&quot;,<br>    {<br>        data_type         =&gt; &quot;integer&quot;,<br>        is_auto_increment =&gt; 1,<br>

        is_nullable       =&gt; 0,<br>        sequence          =&gt; &quot;\&quot;AlertParameterValue_Id_seq\&quot;&quot;,<br>    },<br>    &quot;ProfileId&quot;,<br>    {data_type =&gt; &quot;integer&quot;, is_nullable =&gt; 1},<br>

    &quot;Value&quot;,<br>    {data_type =&gt; &quot;varchar&quot;, is_nullable =&gt; 0, size =&gt; 255},<br>);<br><br>__PACKAGE__-&gt;set_primary_key(&quot;Id&quot;);<br><br># Created by DBIx::Class::Schema::Loader v0.07035 @ 2013-06-19 16:08:39<br>

# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ykWXuRi/+hlXQIwEwVakfQ<br><br>__PACKAGE__-&gt;belongs_to(<br>    Profile =&gt; &#39;PAMS::WWW::Schema::Result::AlertProfile&#39;,<br>    {&#39;foreign.Id&#39; =&gt; &#39;self.ProfileId&#39;}<br>

);<br><br># PgLog Settings goes here<br>__PACKAGE__-&gt;load_components(qw/PgLog/);<br><br># You can replace this text with custom code or comments, and it will be preserved on regeneration<br>__PACKAGE__-&gt;meta-&gt;make_immutable;<br>

<br>1;<br></div><br><div><br></div></div><div class="gmail_extra"><br clear="all"><div><div dir="ltr"><div><br></div>Best Regards,    <br>Sheeju Alex<br>
<div style="display:inline"></div></div></div>
<br><br><div class="gmail_quote">On Fri, Aug 29, 2014 at 12:04 PM, Peter Rabbitson <span dir="ltr">&lt;<a href="mailto:rabbit+dbic@rabbit.us" target="_blank">rabbit+dbic@rabbit.us</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="HOEnZb"><div class="h5">On 08/28/2014 02:01 PM, Sheeju Alex wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi All,<br>
<br>
     Is there any way in DBIx to delete all rows from resultset in a<br>
single query, it looks like delete and delete_all will delete the<br>
resultset row by row.<br>
<br>
my $rs = $schema-&gt;resultset(&#39;User&#39;)-&gt;<u></u>search({GroupId =&gt; 712});<br>
$rs-&gt;delete_all;<br>
<br>
If there are 100 Users in User table then the above statement will<br>
delete in 100 query instead is there a way to delete in single query.<br>
<br>
DELETE FROM User WHERE GroupId = 712;<br>
</blockquote>
<br></div></div>
This is exactly how -&gt;delete_all is supposed to work (one by one, so that the business logic is invoked on per-object basis).<br>
<br>
This is not supposed to happen with $rs-&gt;delete however. Please provide your version of DBIx::Class, and the true definition of the $rs (I have a strong suspicion you did *not* give us the actual code).<div class="HOEnZb">

<div class="h5"><br>
<br>
<br>
______________________________<u></u>_________________<br>
List: <a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class" target="_blank">http://lists.scsys.co.uk/cgi-<u></u>bin/mailman/listinfo/dbix-<u></u>class</a><br>
IRC: <a href="http://irc.perl.org#dbix-class" target="_blank">irc.perl.org#dbix-class</a><br>
SVN: <a href="http://dev.catalyst.perl.org/repos/bast/DBIx-Class/" target="_blank">http://dev.catalyst.perl.org/<u></u>repos/bast/DBIx-Class/</a><br>
Searchable Archive: <a href="http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk" target="_blank">http://www.grokbase.com/group/<u></u>dbix-class@lists.scsys.co.uk</a><br>
</div></div></blockquote></div><br></div>