What is difference between SELECT * FROM table and SELECT * FROM table WHERE 1

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
1
down vote

favorite












What is difference between SELECT * FROM table and SELECT * FROM table WHERE 1




Query 1:




 SELECT * FROM table


  1. Number of records : 103

  2. Load time : 0.0005 sec


Query 2:




 SELECT * FROM table WHERE 1 


  1. Number of records : 103

  2. Load time : 0.0003 sec


Question 1 : What is the difference between these 2 queries, if it
loads the same data.



Question 2 : Why there is these much time difference, if it loads the
same data.



Question 3 : Why phpmyadmin by default loads SELECT * FROM table WHERE 1 query ?



Question 4 :What MySQL do for ABOVE queries in MySQL Query Caching?





Note :



  • The difference is minor here because number of records are small
    (103),


but when number of records increases then time difference is also
increase.




- So let's when we have 100000 number of records then we can see
notable time difference.










share|improve this question









New contributor




Aditya Shah is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • 1




    SELECT SQL_CACHE * FROM customer; SELECT SQL_NO_CACHE * FROM customer;
    – Aditya Shah
    2 hours ago






  • 1




    by cache differences accounting for very minor time differences I was more thinking of innodb buffer pool loading (and most recent pages), key cache (if myisam), CPU cache, CPU branch predication effects etc.
    – danblack
    1 hour ago
















up vote
1
down vote

favorite












What is difference between SELECT * FROM table and SELECT * FROM table WHERE 1




Query 1:




 SELECT * FROM table


  1. Number of records : 103

  2. Load time : 0.0005 sec


Query 2:




 SELECT * FROM table WHERE 1 


  1. Number of records : 103

  2. Load time : 0.0003 sec


Question 1 : What is the difference between these 2 queries, if it
loads the same data.



Question 2 : Why there is these much time difference, if it loads the
same data.



Question 3 : Why phpmyadmin by default loads SELECT * FROM table WHERE 1 query ?



Question 4 :What MySQL do for ABOVE queries in MySQL Query Caching?





Note :



  • The difference is minor here because number of records are small
    (103),


but when number of records increases then time difference is also
increase.




- So let's when we have 100000 number of records then we can see
notable time difference.










share|improve this question









New contributor




Aditya Shah is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • 1




    SELECT SQL_CACHE * FROM customer; SELECT SQL_NO_CACHE * FROM customer;
    – Aditya Shah
    2 hours ago






  • 1




    by cache differences accounting for very minor time differences I was more thinking of innodb buffer pool loading (and most recent pages), key cache (if myisam), CPU cache, CPU branch predication effects etc.
    – danblack
    1 hour ago












up vote
1
down vote

favorite









up vote
1
down vote

favorite











What is difference between SELECT * FROM table and SELECT * FROM table WHERE 1




Query 1:




 SELECT * FROM table


  1. Number of records : 103

  2. Load time : 0.0005 sec


Query 2:




 SELECT * FROM table WHERE 1 


  1. Number of records : 103

  2. Load time : 0.0003 sec


Question 1 : What is the difference between these 2 queries, if it
loads the same data.



Question 2 : Why there is these much time difference, if it loads the
same data.



Question 3 : Why phpmyadmin by default loads SELECT * FROM table WHERE 1 query ?



Question 4 :What MySQL do for ABOVE queries in MySQL Query Caching?





Note :



  • The difference is minor here because number of records are small
    (103),


but when number of records increases then time difference is also
increase.




- So let's when we have 100000 number of records then we can see
notable time difference.










share|improve this question









New contributor




Aditya Shah is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











What is difference between SELECT * FROM table and SELECT * FROM table WHERE 1




Query 1:




 SELECT * FROM table


  1. Number of records : 103

  2. Load time : 0.0005 sec


Query 2:




 SELECT * FROM table WHERE 1 


  1. Number of records : 103

  2. Load time : 0.0003 sec


Question 1 : What is the difference between these 2 queries, if it
loads the same data.



Question 2 : Why there is these much time difference, if it loads the
same data.



Question 3 : Why phpmyadmin by default loads SELECT * FROM table WHERE 1 query ?



Question 4 :What MySQL do for ABOVE queries in MySQL Query Caching?





Note :



  • The difference is minor here because number of records are small
    (103),


but when number of records increases then time difference is also
increase.




- So let's when we have 100000 number of records then we can see
notable time difference.







mysql phpmyadmin






share|improve this question









New contributor




Aditya Shah is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Aditya Shah is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 2 hours ago





















New contributor




Aditya Shah is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 2 hours ago









Aditya Shah

1065




1065




New contributor




Aditya Shah is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Aditya Shah is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Aditya Shah is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







  • 1




    SELECT SQL_CACHE * FROM customer; SELECT SQL_NO_CACHE * FROM customer;
    – Aditya Shah
    2 hours ago






  • 1




    by cache differences accounting for very minor time differences I was more thinking of innodb buffer pool loading (and most recent pages), key cache (if myisam), CPU cache, CPU branch predication effects etc.
    – danblack
    1 hour ago












  • 1




    SELECT SQL_CACHE * FROM customer; SELECT SQL_NO_CACHE * FROM customer;
    – Aditya Shah
    2 hours ago






  • 1




    by cache differences accounting for very minor time differences I was more thinking of innodb buffer pool loading (and most recent pages), key cache (if myisam), CPU cache, CPU branch predication effects etc.
    – danblack
    1 hour ago







1




1




SELECT SQL_CACHE * FROM customer; SELECT SQL_NO_CACHE * FROM customer;
– Aditya Shah
2 hours ago




SELECT SQL_CACHE * FROM customer; SELECT SQL_NO_CACHE * FROM customer;
– Aditya Shah
2 hours ago




1




1




by cache differences accounting for very minor time differences I was more thinking of innodb buffer pool loading (and most recent pages), key cache (if myisam), CPU cache, CPU branch predication effects etc.
– danblack
1 hour ago




by cache differences accounting for very minor time differences I was more thinking of innodb buffer pool loading (and most recent pages), key cache (if myisam), CPU cache, CPU branch predication effects etc.
– danblack
1 hour ago










1 Answer
1






active

oldest

votes

















up vote
3
down vote














Question 1 : What is the difference between these 2 queries, if it loads the same data.




None.




Question 2 : Why there is these much time difference, if it loads the same data.




Within margin of error and your first query may have put them in a cache making it slightly faster.




Question 3 : Why phpmyadmin by default loads SELECT * FROM table WHERE 1 query ?




Because it's a bit special. There are many odd behaviors of what phpMyAdmin manipulates queries in a browser to before it gets to SQL. Programmatic convenience maybe.




Question 4 :What MySQL do for ABOVE queries in MySQL Query Caching?




Query caching is based on the literal text of the query, and some session variables. They would be cached differently.
PS. Query cache is evil.






share|improve this answer






















  • What does exactly meaning of bit special of here context ?
    – Aditya Shah
    2 hours ago






  • 1




    And evil query cache before you ask :-)
    – danblack
    2 hours ago










  • @AdityaShah: I believe "it's a bit special" simply means "it has its own peculiarities (aka odd behaviours)".
    – Andriy M
    10 mins ago










  • Yes, did a few edits to clarify that colloquialism. Hopefully clear now. Thanks for the formatting. I'll take note of it.
    – danblack
    8 mins ago










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "182"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);






Aditya Shah is a new contributor. Be nice, and check out our Code of Conduct.









 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f218302%2fwhat-is-difference-between-select-from-table-and-select-from-table-where-1%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
3
down vote














Question 1 : What is the difference between these 2 queries, if it loads the same data.




None.




Question 2 : Why there is these much time difference, if it loads the same data.




Within margin of error and your first query may have put them in a cache making it slightly faster.




Question 3 : Why phpmyadmin by default loads SELECT * FROM table WHERE 1 query ?




Because it's a bit special. There are many odd behaviors of what phpMyAdmin manipulates queries in a browser to before it gets to SQL. Programmatic convenience maybe.




Question 4 :What MySQL do for ABOVE queries in MySQL Query Caching?




Query caching is based on the literal text of the query, and some session variables. They would be cached differently.
PS. Query cache is evil.






share|improve this answer






















  • What does exactly meaning of bit special of here context ?
    – Aditya Shah
    2 hours ago






  • 1




    And evil query cache before you ask :-)
    – danblack
    2 hours ago










  • @AdityaShah: I believe "it's a bit special" simply means "it has its own peculiarities (aka odd behaviours)".
    – Andriy M
    10 mins ago










  • Yes, did a few edits to clarify that colloquialism. Hopefully clear now. Thanks for the formatting. I'll take note of it.
    – danblack
    8 mins ago














up vote
3
down vote














Question 1 : What is the difference between these 2 queries, if it loads the same data.




None.




Question 2 : Why there is these much time difference, if it loads the same data.




Within margin of error and your first query may have put them in a cache making it slightly faster.




Question 3 : Why phpmyadmin by default loads SELECT * FROM table WHERE 1 query ?




Because it's a bit special. There are many odd behaviors of what phpMyAdmin manipulates queries in a browser to before it gets to SQL. Programmatic convenience maybe.




Question 4 :What MySQL do for ABOVE queries in MySQL Query Caching?




Query caching is based on the literal text of the query, and some session variables. They would be cached differently.
PS. Query cache is evil.






share|improve this answer






















  • What does exactly meaning of bit special of here context ?
    – Aditya Shah
    2 hours ago






  • 1




    And evil query cache before you ask :-)
    – danblack
    2 hours ago










  • @AdityaShah: I believe "it's a bit special" simply means "it has its own peculiarities (aka odd behaviours)".
    – Andriy M
    10 mins ago










  • Yes, did a few edits to clarify that colloquialism. Hopefully clear now. Thanks for the formatting. I'll take note of it.
    – danblack
    8 mins ago












up vote
3
down vote










up vote
3
down vote










Question 1 : What is the difference between these 2 queries, if it loads the same data.




None.




Question 2 : Why there is these much time difference, if it loads the same data.




Within margin of error and your first query may have put them in a cache making it slightly faster.




Question 3 : Why phpmyadmin by default loads SELECT * FROM table WHERE 1 query ?




Because it's a bit special. There are many odd behaviors of what phpMyAdmin manipulates queries in a browser to before it gets to SQL. Programmatic convenience maybe.




Question 4 :What MySQL do for ABOVE queries in MySQL Query Caching?




Query caching is based on the literal text of the query, and some session variables. They would be cached differently.
PS. Query cache is evil.






share|improve this answer















Question 1 : What is the difference between these 2 queries, if it loads the same data.




None.




Question 2 : Why there is these much time difference, if it loads the same data.




Within margin of error and your first query may have put them in a cache making it slightly faster.




Question 3 : Why phpmyadmin by default loads SELECT * FROM table WHERE 1 query ?




Because it's a bit special. There are many odd behaviors of what phpMyAdmin manipulates queries in a browser to before it gets to SQL. Programmatic convenience maybe.




Question 4 :What MySQL do for ABOVE queries in MySQL Query Caching?




Query caching is based on the literal text of the query, and some session variables. They would be cached differently.
PS. Query cache is evil.







share|improve this answer














share|improve this answer



share|improve this answer








edited 11 mins ago









Andriy M

15.3k53470




15.3k53470










answered 2 hours ago









danblack

6527




6527











  • What does exactly meaning of bit special of here context ?
    – Aditya Shah
    2 hours ago






  • 1




    And evil query cache before you ask :-)
    – danblack
    2 hours ago










  • @AdityaShah: I believe "it's a bit special" simply means "it has its own peculiarities (aka odd behaviours)".
    – Andriy M
    10 mins ago










  • Yes, did a few edits to clarify that colloquialism. Hopefully clear now. Thanks for the formatting. I'll take note of it.
    – danblack
    8 mins ago
















  • What does exactly meaning of bit special of here context ?
    – Aditya Shah
    2 hours ago






  • 1




    And evil query cache before you ask :-)
    – danblack
    2 hours ago










  • @AdityaShah: I believe "it's a bit special" simply means "it has its own peculiarities (aka odd behaviours)".
    – Andriy M
    10 mins ago










  • Yes, did a few edits to clarify that colloquialism. Hopefully clear now. Thanks for the formatting. I'll take note of it.
    – danblack
    8 mins ago















What does exactly meaning of bit special of here context ?
– Aditya Shah
2 hours ago




What does exactly meaning of bit special of here context ?
– Aditya Shah
2 hours ago




1




1




And evil query cache before you ask :-)
– danblack
2 hours ago




And evil query cache before you ask :-)
– danblack
2 hours ago












@AdityaShah: I believe "it's a bit special" simply means "it has its own peculiarities (aka odd behaviours)".
– Andriy M
10 mins ago




@AdityaShah: I believe "it's a bit special" simply means "it has its own peculiarities (aka odd behaviours)".
– Andriy M
10 mins ago












Yes, did a few edits to clarify that colloquialism. Hopefully clear now. Thanks for the formatting. I'll take note of it.
– danblack
8 mins ago




Yes, did a few edits to clarify that colloquialism. Hopefully clear now. Thanks for the formatting. I'll take note of it.
– danblack
8 mins ago










Aditya Shah is a new contributor. Be nice, and check out our Code of Conduct.









 

draft saved


draft discarded


















Aditya Shah is a new contributor. Be nice, and check out our Code of Conduct.












Aditya Shah is a new contributor. Be nice, and check out our Code of Conduct.











Aditya Shah is a new contributor. Be nice, and check out our Code of Conduct.













 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f218302%2fwhat-is-difference-between-select-from-table-and-select-from-table-where-1%23new-answer', 'question_page');

);

Post as a guest













































































Comments

Popular posts from this blog

What does second last employer means? [closed]

List of Gilmore Girls characters

Confectionery